<a href="https://console.cloud.google.com/apis/credentials">Get Your Api Credentials Here</a> <a href="https://calendar.google.com/calendar">Get your Calender ID</a> <?php include_once("wp-load.php"); function get_calender_events() { $params = array(); /*Get current date*/ $current_date = date('Y-m-d H:i:s'); /*Convert it to google calendar's rfc_format */ $rfc_format = date("c", strtotime($current_date)); $params[] = 'orderBy=startTime'; $params[] ='maxResults=100'; $params[] = 'timeMin='.urlencode($rfc_format); $url_param = ''; foreach($params as $param) { $url_param.= '&'.$param; } $calender_id = "calender_id"; $client_key = "client_key"; $url = "https://www.googleapis.com/calendar/v3/calendars/".$calender_id."/events?key=".$client_key."&singleEvents=true".$url_param; $list_events = wp_remote_post($url, ...
<?php
//In function.php
/*----------------------------------------------------------------------------*
* Register custom post types
*----------------------------------------------------------------------------*/
add_action( 'init', 'fusion_register_post_types' );
function fusion_register_post_types() {
global $smof_data;
$permalinks = get_option( 'avada_permalinks' );
register_post_type(
'resources',
array(
'labels' => array(
'name' => _x( 'Resources', 'Post Type General Name', 'fusion-core' ),
'singular_name' => _x( 'Resources', 'Post Type Singular Name', 'fusion-core' ),
),
'public' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => $smof_data['resources_slug']
),
'supports' => array( 'title', 'editor', 'author', 'excerpt', 'thumbnail', 'comments'),
'can_export' => true,
)
);
/*
register_taxonomy('iam_an', 'resources',
array(
'hierarchical' => true,
'label' => __('I am a(n)', 'fusion-core' ),
'query_var' => true,
'rewrite' => array(
'slug' => empty( $permalinks['resources_iam_an_base'] ) ? _x( 'iam_an', 'slug', 'fusion-core' ) : $permalinks['resources_iam_base'],
'with_front' => false
),
)
);*/
register_taxonomy('looking_for', 'resources',
array(
'hierarchical' => true,
'label' => __( 'Looking For', 'fusion-core' ),
'query_var' => true,
'rewrite' => array(
'slug' => empty( $permalinks['portfolio_looking_for_base'] ) ? _x( 'looking_for', 'slug', 'fusion-core' ) : $permalinks['portfolio_looking_for_base'],
'with_front' => false
),
)
);
register_taxonomy('about', 'resources',
array(
'hierarchical' => true,
'label' => __( 'About', 'fusion-core' ),
'query_var' => true,
'show_admin_column' => true,
'rewrite' => array(
'slug' => empty( $permalinks['resources_about_base'] ) ? _x( 'about', 'slug', 'fusion-core' ) : $permalinks['resources_about_base'],
'with_front' => false
),
)
);
register_taxonomy('age_group', 'resources',
array(
'hierarchical' => true,
'label' => __( 'For (Age group)', 'fusion-core' ),
'query_var' => true,
'rewrite' => array(
'slug' => empty( $permalinks['resources_age_group'] ) ? _x( 'age_group', 'slug', 'fusion-core' ) : $permalinks['resources_age_group'],
'with_front' => false
),
)
);
register_taxonomy('resources_tags', 'resources',
array(
'hierarchical' => false,
'label' => __( 'Tags', 'fusion-core' ),
'query_var' => true,
'show_admin_column' => true,
'rewrite' => array(
'slug' => empty( $permalinks['resources_tags_base'] ) ? _x( 'resources_tags', 'slug', 'fusion-core' ) : $permalinks['resources_tags_base'],
'with_front' => false
),
)
);
if( function_exists('qtrans_getLanguage') ) {
add_action('age_group_add_form', 'qtrans_modifyTermFormFor');
add_action('age_group_edit_form', 'qtrans_modifyTermFormFor');
add_action('portfolio_skills_add_form', 'qtrans_modifyTermFormFor');
add_action('portfolio_skills_edit_form', 'qtrans_modifyTermFormFor');
add_action('portfolio_tags_add_form', 'qtrans_modifyTermFormFor');
add_action('portfolio_tags_edit_form', 'qtrans_modifyTermFormFor');
add_action('faq_category_edit_form', 'qtrans_modifyTermFormFor');
}
}
function template_chooser($template)
{
global $wp_query;
$post_type = get_query_var('post_type');
if( $wp_query->is_search && $post_type == 'resources' )
{
return locate_template('archive-resources.php'); // redirect to archive-search.php
}
return $template;
}
add_filter('template_include', 'template_chooser');
function wpsites_change_comment_form_submit_label($arg) {
$arg['label_submit'] = 'Post Feedback';
$arg['comment_field'] = '<p class="comment-form-comment"><label for="comment">' . _x( 'Your Feedback Is Appreciated', 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>';
$arg['title_reply'] = __('Leave Feedback');
return $arg;
}
add_filter('comment_form_defaults', 'wpsites_change_comment_form_submit_label');
**********************
//archive-resources.php
<?php
/**
* The template for displaying Archive pages
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you'd like to further customize these archive views, you may create a
* new template file for each specific one. For example, Twenty Twelve already
* has tag.php for Tag archives, category.php for Category archives, and
* author.php for Author archives.
*
* @link http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<script>
jQuery( document ).ready(function() {
jQuery(".resourcess_toggle").click(function(){
jQuery(".resourcess_toggle").toggleClass("collaps_arrow");
jQuery(".resources_menu ul").toggleClass("resourcesmenu_collaps");
});
});
</script>
<script>
jQuery( document ).ready(function() {
//var jQuerycs = jQuery('.styled').customSelect();
});
</script>
<div id="primary" class="site-content">
<div id="content" role="main">
<div class="innerpg_section resourcess">
<div class="innerpg_section_header">
<div class="innerpg_logo"><a href="<?php echo home_url(); ?>/?page_id=7718"><img src="<?php echo get_template_directory_uri(); ?>/inc/images/resource_hub_logo.png" alt="resources_logo"></a></div>
<div class="ip_top_full_heading">Curated Resources to help you run a great class using the 7 Mindsets</div>
<div class="multi_filter">
<form action="" method="GET" class="searchandfilter">
<input type="hidden" name="post_type" value="resources">
<div>
<ul>
<li>
<label>Looking For</label>
<div class="selectbox_outer"><div class="custselect">
<select name="looking_for" id="looking_for" class="postform">
<option value="">All Media</option>
<?php
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($looking_for==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li> <label>About</label>
<div class="selectbox_outer"><div class="custselect">
<select name="about" id="about" class="postform">
<option value="">All Mindsets</option>
<?php
$about = $_GET['about'];
$taxonomy = 'about';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($about==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li>
<label>For</label>
<div class="selectbox_outer"><div class="custselect">
<select name="age_group" id="age_group" class="postform">
<option value="">All Ages</option>
<?php
$age_group = $_GET['age_group'];
$taxonomy = 'age_group';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($age_group==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li>
<input class="go_btn" type="submit" value="Go!">
</li>
</ul>
</div>
</form>
<div class="clearfix"></div>
<nav class="resources_menu">
<div class="resourcess_toggle">Resources Menu</div>
<ul>
<?php
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<li class="<?php if($looking_for == $tax_term->slug ){echo "active";} ?>"><a href="<?php echo home_url('?post_type=resources&looking_for=').$tax_term->slug; ?>"><?php echo $tax_term->name; ?></a></li>
<?php
}
?>
</ul>
</nav>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="mid_container">
<div class="search">
<form role="search" method="get" id="searchform"
class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input type="hidden" name="post_type" value="resources">
<label class="srchlabel">Looking for something specific?</label>
<label class="screen-reader-text" for="s"><?php _x( 'Search for:', 'label' ); ?></label>
<div class="srchbox"> <input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" placeholder="Search for..." />
<input type="submit" id="searchsubmit"
value="<?php echo esc_attr_x( 'Go!', 'submit button' ); ?>" /></div>
</form>
</div>
<div class="custome_row">
<!-- <a class="top_link btn_default backto_resource" href="<?php echo home_url("/?page_id=7718"); ?>">< Back To Resources Page</a>
-->
<div class="clear"></div>
</div>
<div class="clearfix"></div>
<div class="breadcrumb">
<?php
$destname = get_term_by('slug',$_GET['about'],'about');
$destnames = get_term_by('slug',$_GET['looking_for'],'looking_for');
?>
<a href="<?php echo home_url('/?page_id=7718') ?>"> Resources</a>
<?php
if($_GET['s']!="")
{
echo " > Search Result For: ".$_GET['s'];
}else{ ?>
<?php if($destname){
if($destnames){
?>
> <a href="<?php echo home_url('?post_type=resources&about=').$_GET['about']; ?>"><?php echo $destname->name; ?></a>
<?php }else{ echo " > ".$destname->name; } }?>
<?php if($destnames){ ?>
> <?php echo $destnames->name; ?>
<?php } ?>
<?php } ?>
</div>
<?php
$count = array();
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
if($_GET['about']!="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => -1,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']!="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => -1,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => -1,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => -1,
's' => $_GET['s'],
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}
array_push($count,$member_group_query->post_count);
$max = max($count);
}
?>
<?php
$tpage = floor($max/10)+1;
if($tpage == $_GET['page'] || $tpage ==1)
{
?>
<style>
#qmt-next-page{display:none; }
</style>
<?php
}
if($_GET['page']==1 && $tpage !=1)
{
?>
<style>
#qmt-prev-page{display:none; }
</style>
<?php
}
if($_GET['page']=="")
{
$page = 2;
}else{
$page = intval($_GET['page'])+1;
}
$ppage = intval($_GET['page'])-1;
?>
<div class="eh-pagination">
<?php if($_GET['page']!="")
{ ?>
<div id="qmt-prev-page"> <!-- currently using CSS to make available only on output page -->
<form method="get" action="<?php echo home_url('/'); ?>">
<input name="post_type" value="resources" type="hidden">
<input name="looking_for" value="<?php echo $_GET['looking_for']; ?>" type="hidden">
<input name="about" value="<?php echo $_GET['about']; ?>" type="hidden">
<input name="age_group" value="<?php echo $_GET['age_group']; ?>" type="hidden">
<input name="s" value="<?php echo $_GET['s']; ?>" type="hidden">
<input name="page" value="<?php echo $ppage; ?>" type="hidden">
<input value="Previous Page" type="submit" class="prevpage">
</form>
</div>
<?php } ?>
<div id="qmt-next-page"> <!-- currently using CSS to make available only on output page -->
<form method="get" action="<?php echo home_url('/'); ?>">
<input name="post_type" value="resources" type="hidden">
<input name="looking_for" value="<?php echo $_GET['looking_for']; ?>" type="hidden">
<input name="about" value="<?php echo $_GET['about']; ?>" type="hidden">
<input name="s" value="<?php echo $_GET['s']; ?>" type="hidden">
<input name="age_group" value="<?php echo $_GET['age_group']; ?>" type="hidden">
<input name="page" value="<?php echo $page; ?>" type="hidden">
<input value="Next Page" type="submit" class="nextpage">
</form>
</div> <!-- #qmt-next-page -->
</div>
<?php if ( have_posts() ) : ?>
<div id="easyPaginate">
<ul id="itemContainer" class="resourcess_categories_section">
<?php
$count = array();
if($_GET['looking_for']=="" ){
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<style>
.<?php echo $tax_term->slug ?>{ display: none ;}
</style>
<h2 class="innerpg_title <?php echo $tax_term->slug ?>"><a href="<?php echo home_url('?post_type=resources&looking_for=').$tax_term->slug; ?>"><?php echo $tax_term->name ?></a></h2>
<?php
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
if($_GET['about']!="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']!="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}
if ( $member_group_query->have_posts() ) : while ( $member_group_query->have_posts() ) : $member_group_query->the_post();
$img = get_field( "thumbnail_image" );
if($img=="")
$img = home_url()."/wp-content/uploads/2016/11/no-image-icon-23.jpg";
?>
<style>
.<?php echo $tax_term->slug ?>{ display: block ;}
</style>
<li><div class="resourcess_catgorybox"><a href="<?php the_permalink(); ?>"><div class="resourcess_catgoryboximg"><img src="<?php echo $img; ?>" alt="" ></div> <span class="resourcess_catgoryname"><?php echo wp_trim_words( get_the_title(), 5, '...' ); ?></span></a></div></li>
<?php
endwhile; endif;
$member_group_query = null;
wp_reset_postdata();
}
}else{
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
if($tax_term->slug == $_GET['looking_for']){
?>
<style>
.<?php echo $tax_term->slug ?>{ display: none ;}
</style>
<h2 class="innerpg_title <?php echo $tax_term->slug ?>"><a href="<?php echo home_url('?post_type=resources&looking_for=').$tax_term->slug; ?>"><?php echo $tax_term->name ?></a></h2>
<?php
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$_GET['about']. " " . $_GET['age_group'];
if($_GET['about']!="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']!="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}
$maxx = $member_group_query->post_count;
if($maxx<10){
?>
<style>
#qmt-next-page{display:none; }
</style>
<?php
}
if ( $member_group_query->have_posts() ) : while ( $member_group_query->have_posts() ) : $member_group_query->the_post();
$img = get_field( "thumbnail_image" );
if($img=="")
$img = home_url()."/wp-content/uploads/2016/11/no-image-icon-23.jpg";
?>
<style>
.<?php echo $tax_term->slug ?>{ display: block ;}
</style>
<li><div class="resourcess_catgorybox"><a href="<?php the_permalink(); ?>"><div class="resourcess_catgoryboximg"><img src="<?php echo $img; ?>" alt="" ></div> <span class="resourcess_catgoryname"><?php echo wp_trim_words( get_the_title(), 5, '...' ); ?></span></a></div></li>
<?php
endwhile;
endif;
$member_group_query = null;
wp_reset_postdata();
}else{
}
}
}
?>
<div class="clear"></div>
</ul>
<?php else : ?>
<h2>Nothing found here!</h2>
<style>
#qmt-next-page{display:none; }
</style>
<?php //get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</div>
</div>
</div><!-- #content -->
</section><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
//single-resources.php
<?php
/**
* The Template for displaying all single posts
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<script>
jQuery( document ).ready(function() {
jQuery(".resourcess_toggle").click(function(){
jQuery(".resourcess_toggle").toggleClass("collaps_arrow");
jQuery(".resources_menu ul").toggleClass("resourcesmenu_collaps");
});
});
</script>
<script>
jQuery( document ).ready(function() {
var jQuerycs = jQuery('.styled').customSelect();
});
</script>
<div id="primary" class="site-content">
<div id="content" role="main">
<div class="innerpg_section resourcess">
<div class="innerpg_section_header">
<div class="innerpg_logo"><a href="<?php echo home_url(); ?>/?page_id=7718"><img src="<?php echo get_template_directory_uri(); ?>/inc/images/resource_hub_logo.png" alt="resources_logo" alt="resources_logo"></a></div>
<div class="ip_top_full_heading">Curated resources to help you run a great class using the 7 Mindsets</div>
<div class="multi_filter">
<form action="" method="GET" class="searchandfilter">
<input type="hidden" name="post_type" value="resources">
<div>
<ul>
<li>
<label>Looking For</label>
<div class="selectbox_outer"><div class="custselect">
<select name="looking_for" id="looking_for" class="postform">
<option value="">All Media</option>
<?php
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($looking_for==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li> <label>About</label>
<div class="selectbox_outer"><div class="custselect">
<select name="about" id="about" class="postform">
<option value="">All Mindsets</option>
<?php
$about = $_GET['about'];
$taxonomy = 'about';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($about==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li>
<label>For</label>
<div class="selectbox_outer"><div class="custselect">
<select name="age_group" id="age_group" class="postform">
<option value="">All Ages</option>
<?php
$age_group = $_GET['age_group'];
$taxonomy = 'age_group';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($age_group==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li>
<input class="go_btn" type="submit" value="Go!">
</li>
</ul>
</div>
</form>
<div class="clearfix"></div>
<nav class="resources_menu">
<div class="resourcess_toggle">Resources Menu</div>
<ul>
<?php
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<li><a href="<?php echo home_url('?post_type=resources&looking_for=').$tax_term->slug; ?>"><?php echo $tax_term->name; ?></a></li>
<?php
}
?>
</ul>
</nav>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="mid_container">
<div class="search">
<form role="search" method="get" id="searchform"
class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input type="hidden" name="post_type" value="resources">
<label class="srchlabel">Looking for something specific ?</label>
<label class="screen-reader-text" for="s"><?php _x( 'Search for:', 'label' ); ?></label>
<div class="srchbox"> <input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" placeholder="Search for..." />
<input type="submit" id="searchsubmit"
value="<?php echo esc_attr_x( 'Go!', 'submit button' ); ?>" /></div>
</form>
</div>
<div class="clearfix"></div>
<div class="custome_row">
<!-- <a class="top_link btn_default backto_resource" href="<?php echo home_url("/?page_id=7718"); ?>">< Back To Resources Page</a>-->
<?php while ( have_posts() ) : the_post();
$term_list = wp_get_post_terms($post->ID, 'about', array("fields" => "all"));
?>
<div class="clear"></div>
</div>
<div class="breadcrumb">
<?php
$we =1;
foreach($term_list as $term_lis){
if( $we ==1 ){
?>
<a href="<?php echo home_url('/?page_id=7718') ?>"> Resources</a> > <a href="<?php echo home_url('?post_type=resources&about=').$term_lis->slug; ?>"><?php echo $term_lis->name; ?></a> > <?php the_title(); ?>
<?php
}
$we++;
}
?>
</div>
<header class="entry-header">
<?php if ( is_single() ) : ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php else : ?>
<h1 class="entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
</h1>
<?php endif; ?>
<div class="single_content">
<?php if ( ! post_password_required() && ! is_attachment() ) : ?>
<div class="blog_full"><img src="<?php echo the_post_thumbnail_url( 'full' ); ?>" >
</div>
<?php endif; ?>
<div class="content_blog_small">
<?php // echo get_the_excerpt() ?>
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?>
</div>
<div class="content_blog content_blog_big">
</div>
</div>
<?php endwhile; // end of the loop.
wp_reset_query(); ?>
<?php comments_template( '', true ); ?>
<h2 class="innerpg_title col-4 center-col eh-output-resource-title">Similar Items</h2>
<div class="related">
<ul class="resourcess_categories_section">
<?php
$term_list = wp_get_post_terms($post->ID, 'looking_for', array("fields" => "all"));
foreach($term_list as $term_single) {
$slug1 = $term_single->slug; //do something here
}
$term_list = wp_get_post_terms($post->ID, 'age_group', array("fields" => "all"));
foreach($term_list as $term_single) {
$slug2 = $term_single->slug; //do something here
}
$term_list = wp_get_post_terms($post->ID, 'about', array("fields" => "all"));
foreach($term_list as $term_single) {
$slug = $term_single->slug; //do something here
$term_id = $term_single->term_id;
}
?>
<?php
if($slug1!="" && $slug2!=""){
$myposts = get_posts(array(
'showposts' => -1,
'post_type' => 'resources',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'looking_for',
'field' => 'slug',
'terms' => $slug1,
),
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $slug2,
),
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => array($slug))
))
);
}elseif($slug1!="" && $slug2==""){
$myposts = get_posts(array(
'showposts' => -1,
'post_type' => 'resources',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'looking_for',
'field' => 'slug',
'terms' => $slug1,
),
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => array($slug))
))
);
}elseif($slug1=="" && $slug2!=""){
$myposts = get_posts(array(
'showposts' => -1,
'post_type' => 'resources',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $slug2,
),
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => array($slug))
))
);
}elseif($slug1=="" && $slug2==""){
$myposts = get_posts(array(
'showposts' => -1,
'post_type' => 'resources',
'tax_query' => array(
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => array($slug))
))
);
}
$sfsdf= 0;
foreach ($myposts as $mypost) {
if($post->ID !=$mypost->ID){
if( $sfsdf<5){
$src = wp_get_attachment_image_src( get_post_thumbnail_id($mypost->ID), 'thumbnail_size' );
$url = $src[0];
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($mypost->ID,'medium', true);
$url = get_field( "thumbnail_image" ,$mypost->ID);
if($url=="")
$url = home_url()."/wp-content/uploads/2016/11/no-image-icon-23.jpg";
?>
<li><div class="resourcess_catgorybox"><a href="<?php echo $mypost->guid ?>"><div class="resourcess_catgoryboximg"><img src="<?php echo $url; ?>" alt="<?php echo $tedt = $mypost->post_title ?>"></div> <span class="resourcess_catgoryname"><?php echo limit_text($mypost->post_title, 5); //echo $mypost->post_title ?></span></a></div></li>
<?php
$sfsdf++;
}
}
}
if($tedt==''){
echo "<h2>None</h2>";
}
?>
</ul>
</div>
</div>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
//In function.php
/*----------------------------------------------------------------------------*
* Register custom post types
*----------------------------------------------------------------------------*/
add_action( 'init', 'fusion_register_post_types' );
function fusion_register_post_types() {
global $smof_data;
$permalinks = get_option( 'avada_permalinks' );
register_post_type(
'resources',
array(
'labels' => array(
'name' => _x( 'Resources', 'Post Type General Name', 'fusion-core' ),
'singular_name' => _x( 'Resources', 'Post Type Singular Name', 'fusion-core' ),
),
'public' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => $smof_data['resources_slug']
),
'supports' => array( 'title', 'editor', 'author', 'excerpt', 'thumbnail', 'comments'),
'can_export' => true,
)
);
/*
register_taxonomy('iam_an', 'resources',
array(
'hierarchical' => true,
'label' => __('I am a(n)', 'fusion-core' ),
'query_var' => true,
'rewrite' => array(
'slug' => empty( $permalinks['resources_iam_an_base'] ) ? _x( 'iam_an', 'slug', 'fusion-core' ) : $permalinks['resources_iam_base'],
'with_front' => false
),
)
);*/
register_taxonomy('looking_for', 'resources',
array(
'hierarchical' => true,
'label' => __( 'Looking For', 'fusion-core' ),
'query_var' => true,
'rewrite' => array(
'slug' => empty( $permalinks['portfolio_looking_for_base'] ) ? _x( 'looking_for', 'slug', 'fusion-core' ) : $permalinks['portfolio_looking_for_base'],
'with_front' => false
),
)
);
register_taxonomy('about', 'resources',
array(
'hierarchical' => true,
'label' => __( 'About', 'fusion-core' ),
'query_var' => true,
'show_admin_column' => true,
'rewrite' => array(
'slug' => empty( $permalinks['resources_about_base'] ) ? _x( 'about', 'slug', 'fusion-core' ) : $permalinks['resources_about_base'],
'with_front' => false
),
)
);
register_taxonomy('age_group', 'resources',
array(
'hierarchical' => true,
'label' => __( 'For (Age group)', 'fusion-core' ),
'query_var' => true,
'rewrite' => array(
'slug' => empty( $permalinks['resources_age_group'] ) ? _x( 'age_group', 'slug', 'fusion-core' ) : $permalinks['resources_age_group'],
'with_front' => false
),
)
);
register_taxonomy('resources_tags', 'resources',
array(
'hierarchical' => false,
'label' => __( 'Tags', 'fusion-core' ),
'query_var' => true,
'show_admin_column' => true,
'rewrite' => array(
'slug' => empty( $permalinks['resources_tags_base'] ) ? _x( 'resources_tags', 'slug', 'fusion-core' ) : $permalinks['resources_tags_base'],
'with_front' => false
),
)
);
if( function_exists('qtrans_getLanguage') ) {
add_action('age_group_add_form', 'qtrans_modifyTermFormFor');
add_action('age_group_edit_form', 'qtrans_modifyTermFormFor');
add_action('portfolio_skills_add_form', 'qtrans_modifyTermFormFor');
add_action('portfolio_skills_edit_form', 'qtrans_modifyTermFormFor');
add_action('portfolio_tags_add_form', 'qtrans_modifyTermFormFor');
add_action('portfolio_tags_edit_form', 'qtrans_modifyTermFormFor');
add_action('faq_category_edit_form', 'qtrans_modifyTermFormFor');
}
}
function template_chooser($template)
{
global $wp_query;
$post_type = get_query_var('post_type');
if( $wp_query->is_search && $post_type == 'resources' )
{
return locate_template('archive-resources.php'); // redirect to archive-search.php
}
return $template;
}
add_filter('template_include', 'template_chooser');
function wpsites_change_comment_form_submit_label($arg) {
$arg['label_submit'] = 'Post Feedback';
$arg['comment_field'] = '<p class="comment-form-comment"><label for="comment">' . _x( 'Your Feedback Is Appreciated', 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>';
$arg['title_reply'] = __('Leave Feedback');
return $arg;
}
add_filter('comment_form_defaults', 'wpsites_change_comment_form_submit_label');
**********************
//archive-resources.php
<?php
/**
* The template for displaying Archive pages
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you'd like to further customize these archive views, you may create a
* new template file for each specific one. For example, Twenty Twelve already
* has tag.php for Tag archives, category.php for Category archives, and
* author.php for Author archives.
*
* @link http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<script>
jQuery( document ).ready(function() {
jQuery(".resourcess_toggle").click(function(){
jQuery(".resourcess_toggle").toggleClass("collaps_arrow");
jQuery(".resources_menu ul").toggleClass("resourcesmenu_collaps");
});
});
</script>
<script>
jQuery( document ).ready(function() {
//var jQuerycs = jQuery('.styled').customSelect();
});
</script>
<div id="primary" class="site-content">
<div id="content" role="main">
<div class="innerpg_section resourcess">
<div class="innerpg_section_header">
<div class="innerpg_logo"><a href="<?php echo home_url(); ?>/?page_id=7718"><img src="<?php echo get_template_directory_uri(); ?>/inc/images/resource_hub_logo.png" alt="resources_logo"></a></div>
<div class="ip_top_full_heading">Curated Resources to help you run a great class using the 7 Mindsets</div>
<div class="multi_filter">
<form action="" method="GET" class="searchandfilter">
<input type="hidden" name="post_type" value="resources">
<div>
<ul>
<li>
<label>Looking For</label>
<div class="selectbox_outer"><div class="custselect">
<select name="looking_for" id="looking_for" class="postform">
<option value="">All Media</option>
<?php
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($looking_for==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li> <label>About</label>
<div class="selectbox_outer"><div class="custselect">
<select name="about" id="about" class="postform">
<option value="">All Mindsets</option>
<?php
$about = $_GET['about'];
$taxonomy = 'about';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($about==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li>
<label>For</label>
<div class="selectbox_outer"><div class="custselect">
<select name="age_group" id="age_group" class="postform">
<option value="">All Ages</option>
<?php
$age_group = $_GET['age_group'];
$taxonomy = 'age_group';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($age_group==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li>
<input class="go_btn" type="submit" value="Go!">
</li>
</ul>
</div>
</form>
<div class="clearfix"></div>
<nav class="resources_menu">
<div class="resourcess_toggle">Resources Menu</div>
<ul>
<?php
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<li class="<?php if($looking_for == $tax_term->slug ){echo "active";} ?>"><a href="<?php echo home_url('?post_type=resources&looking_for=').$tax_term->slug; ?>"><?php echo $tax_term->name; ?></a></li>
<?php
}
?>
</ul>
</nav>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="mid_container">
<div class="search">
<form role="search" method="get" id="searchform"
class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input type="hidden" name="post_type" value="resources">
<label class="srchlabel">Looking for something specific?</label>
<label class="screen-reader-text" for="s"><?php _x( 'Search for:', 'label' ); ?></label>
<div class="srchbox"> <input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" placeholder="Search for..." />
<input type="submit" id="searchsubmit"
value="<?php echo esc_attr_x( 'Go!', 'submit button' ); ?>" /></div>
</form>
</div>
<div class="custome_row">
<!-- <a class="top_link btn_default backto_resource" href="<?php echo home_url("/?page_id=7718"); ?>">< Back To Resources Page</a>
-->
<div class="clear"></div>
</div>
<div class="clearfix"></div>
<div class="breadcrumb">
<?php
$destname = get_term_by('slug',$_GET['about'],'about');
$destnames = get_term_by('slug',$_GET['looking_for'],'looking_for');
?>
<a href="<?php echo home_url('/?page_id=7718') ?>"> Resources</a>
<?php
if($_GET['s']!="")
{
echo " > Search Result For: ".$_GET['s'];
}else{ ?>
<?php if($destname){
if($destnames){
?>
> <a href="<?php echo home_url('?post_type=resources&about=').$_GET['about']; ?>"><?php echo $destname->name; ?></a>
<?php }else{ echo " > ".$destname->name; } }?>
<?php if($destnames){ ?>
> <?php echo $destnames->name; ?>
<?php } ?>
<?php } ?>
</div>
<?php
$count = array();
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
if($_GET['about']!="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => -1,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']!="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => -1,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => -1,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => -1,
's' => $_GET['s'],
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}
array_push($count,$member_group_query->post_count);
$max = max($count);
}
?>
<?php
$tpage = floor($max/10)+1;
if($tpage == $_GET['page'] || $tpage ==1)
{
?>
<style>
#qmt-next-page{display:none; }
</style>
<?php
}
if($_GET['page']==1 && $tpage !=1)
{
?>
<style>
#qmt-prev-page{display:none; }
</style>
<?php
}
if($_GET['page']=="")
{
$page = 2;
}else{
$page = intval($_GET['page'])+1;
}
$ppage = intval($_GET['page'])-1;
?>
<div class="eh-pagination">
<?php if($_GET['page']!="")
{ ?>
<div id="qmt-prev-page"> <!-- currently using CSS to make available only on output page -->
<form method="get" action="<?php echo home_url('/'); ?>">
<input name="post_type" value="resources" type="hidden">
<input name="looking_for" value="<?php echo $_GET['looking_for']; ?>" type="hidden">
<input name="about" value="<?php echo $_GET['about']; ?>" type="hidden">
<input name="age_group" value="<?php echo $_GET['age_group']; ?>" type="hidden">
<input name="s" value="<?php echo $_GET['s']; ?>" type="hidden">
<input name="page" value="<?php echo $ppage; ?>" type="hidden">
<input value="Previous Page" type="submit" class="prevpage">
</form>
</div>
<?php } ?>
<div id="qmt-next-page"> <!-- currently using CSS to make available only on output page -->
<form method="get" action="<?php echo home_url('/'); ?>">
<input name="post_type" value="resources" type="hidden">
<input name="looking_for" value="<?php echo $_GET['looking_for']; ?>" type="hidden">
<input name="about" value="<?php echo $_GET['about']; ?>" type="hidden">
<input name="s" value="<?php echo $_GET['s']; ?>" type="hidden">
<input name="age_group" value="<?php echo $_GET['age_group']; ?>" type="hidden">
<input name="page" value="<?php echo $page; ?>" type="hidden">
<input value="Next Page" type="submit" class="nextpage">
</form>
</div> <!-- #qmt-next-page -->
</div>
<?php if ( have_posts() ) : ?>
<div id="easyPaginate">
<ul id="itemContainer" class="resourcess_categories_section">
<?php
$count = array();
if($_GET['looking_for']=="" ){
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<style>
.<?php echo $tax_term->slug ?>{ display: none ;}
</style>
<h2 class="innerpg_title <?php echo $tax_term->slug ?>"><a href="<?php echo home_url('?post_type=resources&looking_for=').$tax_term->slug; ?>"><?php echo $tax_term->name ?></a></h2>
<?php
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
if($_GET['about']!="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']!="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}
if ( $member_group_query->have_posts() ) : while ( $member_group_query->have_posts() ) : $member_group_query->the_post();
$img = get_field( "thumbnail_image" );
if($img=="")
$img = home_url()."/wp-content/uploads/2016/11/no-image-icon-23.jpg";
?>
<style>
.<?php echo $tax_term->slug ?>{ display: block ;}
</style>
<li><div class="resourcess_catgorybox"><a href="<?php the_permalink(); ?>"><div class="resourcess_catgoryboximg"><img src="<?php echo $img; ?>" alt="" ></div> <span class="resourcess_catgoryname"><?php echo wp_trim_words( get_the_title(), 5, '...' ); ?></span></a></div></li>
<?php
endwhile; endif;
$member_group_query = null;
wp_reset_postdata();
}
}else{
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
if($tax_term->slug == $_GET['looking_for']){
?>
<style>
.<?php echo $tax_term->slug ?>{ display: none ;}
</style>
<h2 class="innerpg_title <?php echo $tax_term->slug ?>"><a href="<?php echo home_url('?post_type=resources&looking_for=').$tax_term->slug; ?>"><?php echo $tax_term->name ?></a></h2>
<?php
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$_GET['about']. " " . $_GET['age_group'];
if($_GET['about']!="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']!="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => $_GET['about'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']!=""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $_GET['age_group'],
),
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}elseif($_GET['about']=="" && $_GET['age_group']==""){
$member_group_query = new WP_Query( array(
'post_type' => 'resources',
'paged' => $paged,
'posts_per_page' => 10,
's' => $_GET['s'],
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $tax_term->slug,
)
)
) );
}
$maxx = $member_group_query->post_count;
if($maxx<10){
?>
<style>
#qmt-next-page{display:none; }
</style>
<?php
}
if ( $member_group_query->have_posts() ) : while ( $member_group_query->have_posts() ) : $member_group_query->the_post();
$img = get_field( "thumbnail_image" );
if($img=="")
$img = home_url()."/wp-content/uploads/2016/11/no-image-icon-23.jpg";
?>
<style>
.<?php echo $tax_term->slug ?>{ display: block ;}
</style>
<li><div class="resourcess_catgorybox"><a href="<?php the_permalink(); ?>"><div class="resourcess_catgoryboximg"><img src="<?php echo $img; ?>" alt="" ></div> <span class="resourcess_catgoryname"><?php echo wp_trim_words( get_the_title(), 5, '...' ); ?></span></a></div></li>
<?php
endwhile;
endif;
$member_group_query = null;
wp_reset_postdata();
}else{
}
}
}
?>
<div class="clear"></div>
</ul>
<?php else : ?>
<h2>Nothing found here!</h2>
<style>
#qmt-next-page{display:none; }
</style>
<?php //get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</div>
</div>
</div><!-- #content -->
</section><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
//single-resources.php
<?php
/**
* The Template for displaying all single posts
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<script>
jQuery( document ).ready(function() {
jQuery(".resourcess_toggle").click(function(){
jQuery(".resourcess_toggle").toggleClass("collaps_arrow");
jQuery(".resources_menu ul").toggleClass("resourcesmenu_collaps");
});
});
</script>
<script>
jQuery( document ).ready(function() {
var jQuerycs = jQuery('.styled').customSelect();
});
</script>
<div id="primary" class="site-content">
<div id="content" role="main">
<div class="innerpg_section resourcess">
<div class="innerpg_section_header">
<div class="innerpg_logo"><a href="<?php echo home_url(); ?>/?page_id=7718"><img src="<?php echo get_template_directory_uri(); ?>/inc/images/resource_hub_logo.png" alt="resources_logo" alt="resources_logo"></a></div>
<div class="ip_top_full_heading">Curated resources to help you run a great class using the 7 Mindsets</div>
<div class="multi_filter">
<form action="" method="GET" class="searchandfilter">
<input type="hidden" name="post_type" value="resources">
<div>
<ul>
<li>
<label>Looking For</label>
<div class="selectbox_outer"><div class="custselect">
<select name="looking_for" id="looking_for" class="postform">
<option value="">All Media</option>
<?php
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($looking_for==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li> <label>About</label>
<div class="selectbox_outer"><div class="custselect">
<select name="about" id="about" class="postform">
<option value="">All Mindsets</option>
<?php
$about = $_GET['about'];
$taxonomy = 'about';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($about==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li>
<label>For</label>
<div class="selectbox_outer"><div class="custselect">
<select name="age_group" id="age_group" class="postform">
<option value="">All Ages</option>
<?php
$age_group = $_GET['age_group'];
$taxonomy = 'age_group';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<option value="<?php echo $tax_term->slug; ?>" <?php if($age_group==$tax_term->slug){ echo 'selected="selected"';} ?> ><?php echo $tax_term->name; ?></option>
<?php
}
?>
</select>
<div class="select__arrow"></div>
</div></div>
</li>
<li>
<input class="go_btn" type="submit" value="Go!">
</li>
</ul>
</div>
</form>
<div class="clearfix"></div>
<nav class="resources_menu">
<div class="resourcess_toggle">Resources Menu</div>
<ul>
<?php
$looking_for = $_GET['looking_for'];
$taxonomy = 'looking_for';
$tax_terms = get_terms($taxonomy, array('hide_empty' => false));
foreach($tax_terms as $tax_term){
?>
<li><a href="<?php echo home_url('?post_type=resources&looking_for=').$tax_term->slug; ?>"><?php echo $tax_term->name; ?></a></li>
<?php
}
?>
</ul>
</nav>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="mid_container">
<div class="search">
<form role="search" method="get" id="searchform"
class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input type="hidden" name="post_type" value="resources">
<label class="srchlabel">Looking for something specific ?</label>
<label class="screen-reader-text" for="s"><?php _x( 'Search for:', 'label' ); ?></label>
<div class="srchbox"> <input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" placeholder="Search for..." />
<input type="submit" id="searchsubmit"
value="<?php echo esc_attr_x( 'Go!', 'submit button' ); ?>" /></div>
</form>
</div>
<div class="clearfix"></div>
<div class="custome_row">
<!-- <a class="top_link btn_default backto_resource" href="<?php echo home_url("/?page_id=7718"); ?>">< Back To Resources Page</a>-->
<?php while ( have_posts() ) : the_post();
$term_list = wp_get_post_terms($post->ID, 'about', array("fields" => "all"));
?>
<div class="clear"></div>
</div>
<div class="breadcrumb">
<?php
$we =1;
foreach($term_list as $term_lis){
if( $we ==1 ){
?>
<a href="<?php echo home_url('/?page_id=7718') ?>"> Resources</a> > <a href="<?php echo home_url('?post_type=resources&about=').$term_lis->slug; ?>"><?php echo $term_lis->name; ?></a> > <?php the_title(); ?>
<?php
}
$we++;
}
?>
</div>
<header class="entry-header">
<?php if ( is_single() ) : ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php else : ?>
<h1 class="entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
</h1>
<?php endif; ?>
<div class="single_content">
<?php if ( ! post_password_required() && ! is_attachment() ) : ?>
<div class="blog_full"><img src="<?php echo the_post_thumbnail_url( 'full' ); ?>" >
</div>
<?php endif; ?>
<div class="content_blog_small">
<?php // echo get_the_excerpt() ?>
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?>
</div>
<div class="content_blog content_blog_big">
</div>
</div>
<?php endwhile; // end of the loop.
wp_reset_query(); ?>
<?php comments_template( '', true ); ?>
<h2 class="innerpg_title col-4 center-col eh-output-resource-title">Similar Items</h2>
<div class="related">
<ul class="resourcess_categories_section">
<?php
$term_list = wp_get_post_terms($post->ID, 'looking_for', array("fields" => "all"));
foreach($term_list as $term_single) {
$slug1 = $term_single->slug; //do something here
}
$term_list = wp_get_post_terms($post->ID, 'age_group', array("fields" => "all"));
foreach($term_list as $term_single) {
$slug2 = $term_single->slug; //do something here
}
$term_list = wp_get_post_terms($post->ID, 'about', array("fields" => "all"));
foreach($term_list as $term_single) {
$slug = $term_single->slug; //do something here
$term_id = $term_single->term_id;
}
?>
<?php
if($slug1!="" && $slug2!=""){
$myposts = get_posts(array(
'showposts' => -1,
'post_type' => 'resources',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'looking_for',
'field' => 'slug',
'terms' => $slug1,
),
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $slug2,
),
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => array($slug))
))
);
}elseif($slug1!="" && $slug2==""){
$myposts = get_posts(array(
'showposts' => -1,
'post_type' => 'resources',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'looking_for',
'field' => 'slug',
'terms' => $slug1,
),
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => array($slug))
))
);
}elseif($slug1=="" && $slug2!=""){
$myposts = get_posts(array(
'showposts' => -1,
'post_type' => 'resources',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'age_group',
'field' => 'slug',
'terms' => $slug2,
),
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => array($slug))
))
);
}elseif($slug1=="" && $slug2==""){
$myposts = get_posts(array(
'showposts' => -1,
'post_type' => 'resources',
'tax_query' => array(
array(
'taxonomy' => 'about',
'field' => 'slug',
'terms' => array($slug))
))
);
}
$sfsdf= 0;
foreach ($myposts as $mypost) {
if($post->ID !=$mypost->ID){
if( $sfsdf<5){
$src = wp_get_attachment_image_src( get_post_thumbnail_id($mypost->ID), 'thumbnail_size' );
$url = $src[0];
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($mypost->ID,'medium', true);
$url = get_field( "thumbnail_image" ,$mypost->ID);
if($url=="")
$url = home_url()."/wp-content/uploads/2016/11/no-image-icon-23.jpg";
?>
<li><div class="resourcess_catgorybox"><a href="<?php echo $mypost->guid ?>"><div class="resourcess_catgoryboximg"><img src="<?php echo $url; ?>" alt="<?php echo $tedt = $mypost->post_title ?>"></div> <span class="resourcess_catgoryname"><?php echo limit_text($mypost->post_title, 5); //echo $mypost->post_title ?></span></a></div></li>
<?php
$sfsdf++;
}
}
}
if($tedt==''){
echo "<h2>None</h2>";
}
?>
</ul>
</div>
</div>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Comments
Post a Comment