[Resolved] Show Date on all Pages (Except Home Page)

Home Forums Support [Resolved] Show Date on all Pages (Except Home Page)

Home Forums Support Show Date on all Pages (Except Home Page)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1526022
    beetle

    Hi,

    I used the code provided here: https://generatepress.com/forums/topic/show-last-modified-date-to-pagesposts/#post-240919 in order to add the modified date to pages and it works great however, it includes the date on the home page.

    Can you please assist me with excluding the home page.

    Also, I don’t really just want to ‘hide’ it from the homepage as I have an image that sits directly under the navigation and I think just hiding the date meta will result in a gap between the image and the navigation menu.

    Thanks in advance!

    #1526129
    Elvin
    Staff
    Customer Support

    Hi,

    You can change the code a bit to add !is_front_page() condition.

    add_action( 'generate_after_entry_header', 'tu_page_post_meta' );
    function tu_page_post_meta()
    { if ( !is_front_page() ) :
    	if ( 'page' == get_post_type() ) : ?>
           
    		<div class="entry-meta">
    			<?php generate_posted_on(); ?>
    		</div><!-- .entry-meta -->
    	<?php endif;
    endif;
    }

    A wise man once said:
    "Have you cleared your cache?"

    #1526132
    beetle

    It works perfectly. Thanks very much!

    #1526135
    Elvin
    Staff
    Customer Support

    Nice one.

    No problem. 🙂

    A wise man once said:
    "Have you cleared your cache?"

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.