WP get post terms help
-
Please can someone tell me what’s wrong with my code below? The dropdown works but the results are blank?
<?php
/**
* Genesis Framework.
*
* WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
* Please do all modifications in the form of a child theme.
*
* @package GenesisTemplates
* @author StudioPress
* @license GPL-2.0+
* @link http://my.studiopress.com/themes/genesis/
*///* Template Name: News
/* ————————————- */
//* Isotope
/* ————————————- */wp_enqueue_script(‘isotope’, get_stylesheet_directory_uri() . ‘/js/jquery.isotope.min.js’, array(‘jquery’), ‘1.5.25’, true);
wp_enqueue_script(‘isotope_init’, get_stylesheet_directory_uri() . ‘/js/isotope_init.js’, array(‘isotope’), ”, true);remove_action( ‘genesis_entry_header’, ‘genesis_do_post_title’ );
include(“includes/banner-title.php”);
function news_build() { ?>
<section id=”our-work-container”>
<div class=”section”>
<div class=””>
<div class=”wrap slide-bottom”>
<div class=”one-half first”>
<h3 class=”black-font”><span>PIQUED </span>YOUR INTEREST</h3><select class=”dropdown filter-select” >
<option value=””>FILTER BY CATEGORY</option>
<?php
$taxonomies = get_terms( array(
‘taxonomy’ => ‘category’,
‘hide_empty’ => true,
// ‘orderby’ => ‘name’
) );
foreach( $taxonomies as $taxonomy ) { ?>
<option value=”.<?php echo $taxonomy->slug; ?>”><?php echo $taxonomy->name; ?></option>
<?php } ?>
<option value=”.project”>All posts</option>
</select></div>
<div class=”one-half project-nav”>
</div>
</div>
</div>
</div><div class=”wrap slide-bottom”>
<div class=”all-projects”>
<?php
$args = array(
‘post_type’=> ‘post’,
‘orderby’ => ‘ID’,
‘post_status’ => ‘publish’,
‘order’ => ‘DESC’,
‘posts_per_page’ => 6
);
$result = new WP_Query( $args );
if ( $result-> have_posts() ) : ?>
<?php while ( $result->have_posts() ) : $result->the_post(); ?><div class=”project
<?php
$get_cats = wp_get_post_terms( $post->ID, ‘category’);
foreach( $get_cats as $get_cat ) {
echo $get_cat->slug . ‘ ‘;
} ?>
“>“>
<?php the_post_thumbnail(‘news’); ?>
<h4><?php the_title(); ?></h4>
<p><?php the_excerpt(); ?></p>
“>Read More</div>
<?php endwhile; ?>
<?php endif; wp_reset_postdata(); ?></div>
</div>
</section><?php }
add_action( ‘genesis_before_footer’, ‘news_build’, 1);genesis();
-
Hey there! Can you check in with support for your theme? It looks like you can find that here:
Also, this is pretty important, regardless of what theme you start with:
* WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
* Please do all modifications in the form of a child theme.I’d offer the same advice. If you edit your theme directly, you’ll lose your changes with every update. I hope this helps!
- The topic ‘WP get post terms help’ is closed to new replies.