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 1 year, 3 months 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

    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&#8217;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() &amp;&amp; ! is_tag() &amp;&amp; ! is_tax() )
    		return;
    
    	if ( get_query_var( &#8216;paged&#8217; ) &gt;= 2 )
    		return;
    
    	$term = is_tax() ? get_term_by( &#8216;slug&#8217;, get_query_var( &#8216;term&#8217; ), get_query_var( &#8216;taxonomy&#8217; ) ) : $wp_query-&gt;get_queried_object();
    
    	if ( ! $term || ! isset( $term-&gt;meta ) )
    		return;
    
    	$headline = $intro_text = &#8221;;
    
    	if ( $term-&gt;meta[&#8216;headline&#8217;] )
    		$headline = sprintf( &#8216;&lt;h1 class=&quot;archive-title&quot;&gt;%s&lt;/h1&gt;&#8217;, strip_tags( $term-&gt;meta[&#8216;headline&#8217;] ) );
    	if ( $term-&gt;meta[&#8216;intro_text&#8217;] )
    		$intro_text = apply_filters( &#8216;genesis_term_intro_text_output&#8217;, $term-&gt;meta[&#8216;intro_text&#8217;] );
    
    	if ( $headline || $intro_text )
    		printf( &#8216;&lt;div class=&quot;archive-description taxonomy-description&quot;&gt;%s&lt;/div&gt;&#8217;, $headline . $intro_text );
    
    }
    

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

You must be logged in to reply to this topic.