- This topic has 7 replies, 3 voices, and was last updated 4 years, 10 months ago by Tom.
-
AuthorPosts
-
June 2, 2019 at 8:26 pm #918121Jagdish
Just dowloaded 2.3 and found in live preview that category description is showing twice on category pages. Didn’t activated though.
June 3, 2019 at 7:03 am #918582DavidStaffCustomer SupportHi there,
thats odd – do you have any functions or plugins that change the way the description is displayed?
June 3, 2019 at 7:37 am #918603JagdishThanks 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.
June 3, 2019 at 9:13 am #918716TomLead DeveloperLead DeveloperWhich snippet exactly? There seems to be a couple in that topic.
Let me know 🙂
June 3, 2019 at 9:19 am #918723JagdishThis 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;June 3, 2019 at 9:21 am #918728TomLead DeveloperLead DeveloperYea, 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?
June 3, 2019 at 9:24 am #918730JagdishThis will remove description on category subpages.
June 3, 2019 at 9:39 am #918745TomLead DeveloperLead DeveloperThis 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' ); } } );
-
AuthorPosts
- You must be logged in to reply to this topic.