Add shortcode in Category Page Header
-
Struggling to work out how to run shortcode in/after my category page header. It displays the text of the shortcode rather than running the code. Any help is appreciated.

-
Its ok, found it. For others looking to do the same:
in category-template.php file…
function term_description( $term = 0, $deprecated = null ) { if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) { $term = get_queried_object(); if ( $term ) { $term = $term->term_id; } } $cat = strtolower(get_term_field('name',$term )); $description = get_term_field( 'description', $term ).'<p>' . do_shortcode('[display-posts include_date=true date_format="d-m-y" category="'. $cat.'" no_posts_message="No '.$cat.'s today"]'); return is_wp_error( $description ) ? '' : $description; } -
- The topic ‘Add shortcode in Category Page Header’ is closed to new replies.