Hi there,
I have created a CPT product_categories and I try to hook the query ,
The hook works just fine, <?php do_action( ‘generate_before_main_content’ ); ?>
My issue is that the PHP inside does not work. ( I have enabled the php in the hook )
My code
<?php
$terms = wp_get_post_terms( $post->ID, 'product_category');
foreach ( $terms as $term ) {
$term_link = get_term_link( $term );
echo '<div class="product-category"> <a class="solo-category" href="' . $term_link . '">' . $term->name . '</a></div>' . ' ';
}
?>
Take notice , if paste this code inside the custom template it works just fine but with Elements will show nothing.