Happy Halloween! Get 20% off GP Premium with the discount code: HALLOWEEN20

[Support request] Category description is showing twice in 2.3

Home Forums Support Category description is showing twice in 2.3

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #918121
    Jagdish

    Just dowloaded 2.3 and found in live preview that category description is showing twice on category pages. Didn’t activated though.

    #918582
    David
    Staff
    Customer Support

    Hi there,

    thats odd – do you have any functions or plugins that change the way the description is displayed?

    #918603
    Jagdish

    Thanks David.

    Using this in snippets.
    https://generatepress.com/forums/topic/remove-category-page-description-from-category-subpages/

    And let me add that description on subpages is appearing once only.

    #918716
    Tom
    Lead Developer
    Lead Developer

    Which snippet exactly? There seems to be a couple in that topic.

    Let me know 🙂

    #918723
    Jagdish

    This one

    if ( ! function_exists( ‘generate_archive_title’ ) ) :
    /**
    * Build the archive title
    *
    * @since 1.3.24
    */
    add_action( ‘generate_archive_title’,’generate_archive_title’ );
    function generate_archive_title()
    {
    ?>
    <header class=”page-header<?php if ( is_author() ) echo ‘ clearfix’;?>”>
    <?php do_action( ‘generate_before_archive_title’ ); ?>
    <h1 class=”page-title”>
    <?php
    if ( is_category() ) :
    single_cat_title();

    elseif ( is_tag() ) :
    single_tag_title();

    elseif ( is_author() ) :
    /* Queue the first post, that way we know
    * what author we’re dealing with (if that is the case).
    */
    the_post();
    echo get_avatar( get_the_author_meta( ‘ID’ ), 75 );
    printf( ‘<span class=”vcard”>’ . get_the_author() . ‘</span>’ );
    /* Since we called the_post() above, we need to
    * rewind the loop back to the beginning that way
    * we can run the loop properly, in full.
    */
    rewind_posts();

    elseif ( is_day() ) :
    printf( __( ‘Day: %s’, ‘generatepress’ ), ‘<span>’ . get_the_date() . ‘</span>’ );

    elseif ( is_month() ) :
    printf( __( ‘Month: %s’, ‘generatepress’ ), ‘<span>’ . get_the_date( ‘F Y’ ) . ‘</span>’ );

    elseif ( is_year() ) :
    printf( __( ‘Year: %s’, ‘generatepress’ ), ‘<span>’ . get_the_date( ‘Y’ ) . ‘</span>’ );

    elseif ( is_tax( ‘post_format’, ‘post-format-aside’ ) ) :
    _e( ‘Asides’, ‘generatepress’ );

    elseif ( is_tax( ‘post_format’, ‘post-format-image’ ) ) :
    _e( ‘Images’, ‘generatepress’);

    elseif ( is_tax( ‘post_format’, ‘post-format-video’ ) ) :
    _e( ‘Videos’, ‘generatepress’ );

    elseif ( is_tax( ‘post_format’, ‘post-format-quote’ ) ) :
    _e( ‘Quotes’, ‘generatepress’ );

    elseif ( is_tax( ‘post_format’, ‘post-format-link’ ) ) :
    _e( ‘Links’, ‘generatepress’ );

    else :
    _e( ‘Archives’, ‘generatepress’ );

    endif;
    ?>
    </h1>
    <?php do_action( ‘generate_after_archive_title’ ); ?>
    <?php
    // Show an optional term description.
    $term_description = term_description();
    $page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    if ( ! empty( $term_description ) && $page == 1 ) :
    printf( ‘

    %s

    ‘, $term_description );
    endif;

    if ( get_the_author_meta(‘description’) && is_author() ) : // If a user has filled out their decscription show a bio on their entries
    echo ‘

    ‘ . get_the_author_meta(‘description’) . ‘

    ‘;
    endif;
    ?>
    <?php do_action( ‘generate_after_archive_description’ ); ?>
    </header><!– .page-header –>
    <?php
    }
    endif;

    #918728
    Tom
    Lead Developer
    Lead Developer

    Yea, in 2.3 we’ve hooked the description into the archive title area. This allows us to move it around more freely.

    What exactly is that function accomplishing for you?

    #918730
    Jagdish

    This will remove description on category subpages.

    #918745
    Tom
    Lead Developer
    Lead Developer

    This is where 2.3 makes things easier.

    You can remove that function and do this instead:

    add_action( 'wp', function() {
        if ( is_paged() ) {
            remove_action( 'generate_after_archive_title', 'generate_do_archive_description' );
        }
    } );
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.