In GenesisWP Facebook group a user asked:
I have been googling for a couple of days and checked the forums, but no help that I could find. I have a question. Is it possible to add a shortcode to make the Archive Intro Text appear only on the first page of the category archive?
Title and Description (if set) for category, tag or taxonomy term archives in Genesis appear on all the paginated pages by default.
The function that displays these is genesis_do_taxonomy_title_description
and it is hooked to genesis_before_loop
. We can go one level up (hook as late as you can) in the actions hierarchy to genesis_before_content
, do a check for paginated pages and remove the taxonomy title and description on them so it appears only on the first page.
Before:
After:
Add the following in child theme’s functions.php
:
add_action( 'genesis_before_content', 'sk_taxonomy_title_description' );
/**
* Remove Taxonomy Title and Description on paginated pages.
*/
function sk_taxonomy_title_description() {
global $wp_query;
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
// if we are on the first page of pagination, abort.
if ( 1 == $paged ) {
return;
}
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
}
Reference: genesis/lib/structure/archive.php
Wonderful and just what I could do with Sridhar! It’s annoying to have it show on archive page two. I’ll be implementing this on my sites asap. Thanks!
Finally the answer. I saw 50 pages without the answer and finally found you and works in the first try. Thank you so much!!!
Thank you so very much! You have no idea how much I appreciate you posting this. THANK YOU!!!