Archive Title on all Category archive pages

Community Forums Forums General Discussion Archive Title on all Category archive pages

This topic is: not resolved

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  braddalton 6 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #66723

    sceilig
    Participant

    When adding a category in WordPress, you can set what the Archive Title and Description should be.
    Genesis does display both of these, but only on the first page for a Category archive.

    e.g. it shows the Archive Title with this url
    http://domainname.com/category/news
    but it doesn’t show the Archive Title on page 2,3,4 etc
    http://domainname.com/category/news/page/2

    I have confirmed that TwentyTwelve does display the Archive Title and Description on all pages of a Category.

    Is there a workaround for this in Genesis?

    #66784

    braddalton
    Participant
    Post count: 7473

    Thats the way its coded in the Genesis core:

    add_filter( 'genesis_term_intro_text_output', 'wpautop' );
    add_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
    /**
     * Add custom headline and / or description to category / tag / taxonomy archive pages.
     *
     * If the page is not a category, tag or taxonomy term archive, or we're not on the first page, or there's no term, or
     * no term meta set, then nothing extra is displayed.
     *
     * If there's a title to display, it is marked up as a level 1 heading.
     *
     * If there's a description to display, it runs through <code>wpautop()</code> before being added to a div.
     *
     * @since 1.3.0
     *
     * @global WP_Query $wp_query Query object.
     *
     * @return null Return early if not the correct archive page, not page one, or no term meta is set.
     */
    function genesis_do_taxonomy_title_description() {
    
    	global $wp_query;
    
    	if ( ! is_category() &#038;& ! is_tag() &#038;& ! is_tax() )
    		return;
    
    	if ( get_query_var( 'paged' ) >= 2 )
    		return;
    
    	$term = is_tax() ? get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ) : $wp_query->get_queried_object();
    
    	if ( ! $term || ! isset( $term->meta ) )
    		return;
    
    	$headline = $intro_text = '';
    
    	if ( $term->meta['headline'] )
    		$headline = sprintf( '<h1 class="archive-title">%s</h1>', strip_tags( $term->meta['headline'] ) );
    	if ( $term->meta['intro_text'] )
    		$intro_text = apply_filters( 'genesis_term_intro_text_output', $term->meta['intro_text'] );
    
    	if ( $headline || $intro_text )
    		printf( '<div class="archive-description taxonomy-description">%s</div>', $headline . $intro_text );
    
    }
    

    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.