Remove Archive Title & Description from Blog Page in Genesis

Genesis adds in an archive title and description at the top of each archive page, depending on which type of archive page you use, there is a way to remove these from the mark up on the page.

genesis-archive-title

Since Genesis 2.2.1 there is a genesis_do_posts_page_heading function which adds Archive and Description markup just before the articles on a blog and archive posts page. The original markup is in /genesis/lib/structure/archive.php

remove-archive-title-decription

 

Below is a snippet of that code which adds the description and title markup, this is repeated to output the archive and description for all the different archive page types. What we need to do is reverse that action by removing it via the child theme.

<?php
///genesis/lib/structure/archive.php
add_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' );
/**
* Add custom headline and description to assigned posts page.
*
* If we're not on a posts page, then nothing extra is displayed.
*
* @since 2.2.1
*
* @uses genesis_a11y() Check if a post type should potentially support an archive setting page.
* @uses genesis_do_post_title() Get list of custom post types which need an archive settings page.
*
* @return null Return early if not on relevant posts page.
*/
function genesis_do_posts_page_heading() {
if ( ! genesis_a11y( 'headings' ) ) {
return;
}
$posts_page = get_option( 'page_for_posts' );
if ( is_null( $posts_page ) ) {
return;
}
if ( ! is_home() || genesis_is_root_page() ) {
return;
}
printf( '<div %s>', genesis_attr( 'posts-page-description' ) );
printf( '<h1 %s>%s</h1>', genesis_attr( 'archive-title' ), get_the_title( $posts_page ) );
echo '</div>';
}

To remove the archive title and archive description blog page markup just remove the action below in your themes function.php file, depending on what type of archive page you are using you’ll need to remove that action from one of the list below…

remove_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' );

To remove from the blog page template use…

remove_action( 'genesis_before_loop', 'genesis_do_blog_template_heading' );

To remove from a date based archive use…

remove_action( 'genesis_before_loop', 'genesis_do_date_archive_title' );

To remove from a custom post type based archive use…

remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' );

To remove from a author based archive use…

remove_action( 'genesis_before_loop', 'genesis_do_author_box_archive', 15 );
remove_action( 'genesis_before_loop', 'genesis_do_author_title_description', 15 );

To remove from a taxonomy based archive including categories and tags use…

remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );

16 Comments

  1. Josh on July 13, 2016 at 12:57 am

    Hi.
    I have this same problem on my site.

    I don’t have any of the code you describe above. Is there another way to get rid of the box?

    Thanks

    • Neil Gowran on July 13, 2016 at 4:25 am

      The initial code is in the Genesis framework itself, I just make reference to it, it’s the code below the remove_actions you add to your functions.php file

      • Josh on July 13, 2016 at 4:55 am

        Ok. So, where, exactly, do I put the code? I didn’t find the add_action code you spoke of in either of the function.php files, (Genesis or Genesis Sample Theme). The “genesis/lib/structure/archive.php” is nowhere to be found either.
        Thanks

        • Neil Gowran on July 13, 2016 at 4:57 am

          The 2 remove_action snippets go in your functions.php file

          • Josh on July 13, 2016 at 5:31 am

            Anywhere at all?
            I added the lines to BOTH function.php files, at the bottom. It didn’t work either time.
            I also tried putting the lines into the simple css plugin I have. Still nothing.



          • Neil Gowran on July 13, 2016 at 5:37 am

            You only add it into the child themes functions.php file, so in your case this is the sample theme, just adding it in at the end is fine – it works I have tested – perhaps this is not the right code for you – what is the URL?



          • Josh on July 13, 2016 at 5:40 am

            Halloweencrossroads.com



          • Neil Gowran on July 13, 2016 at 5:43 am

            what exactly are u trying to remove?



          • Josh on July 13, 2016 at 5:48 am

            The white archive title box. It only shows up when you go to an archived post.



          • Neil Gowran on July 13, 2016 at 5:52 am

            I’m not seeing it – screen grab it & send actual URL



          • Josh on July 13, 2016 at 3:32 pm

            http://halloweencrossroads.com/2016/06/

            Here is one of the posts. It’s the white box just above the post title.
            If you’re not seeing it? Is it only my end then?



          • Neil Gowran on July 13, 2016 at 11:31 pm

            I see now – you have date based archives try this…
            remove_action( 'genesis_before_loop', 'genesis_do_date_archive_title' );

            Pop that into your sample theme functions.php



          • Josh on July 14, 2016 at 1:24 am

            That did the trick. Thanks much.



  2. Greg on May 10, 2016 at 8:07 pm

    Will this not leave your posts page without an H1 tag?

    • Neil Gowran on May 10, 2016 at 11:54 pm

      Yes it would, I don’t see this as an issue though, the main article full pages still have their H1’s set – where they would be set to rank more so than an archive page.

  3. Paal Joachim Romdahl on January 15, 2016 at 6:05 pm

    Thank you!

Leave a Comment





%d bloggers like this: