Site logo

Archived topic

update date on page, how to remove on contact

3 replies · Started by Atefan on January 24, 2021

Viewing posts 1–4 of 4

Hello,

i ask once to get the update date on a page and it worked with this php

/**
 * Page date to page 
 */
add_action( 'generate_after_entry_header', 'tu_page_meta' );
function tu_page_meta() {
    if ( is_singular( 'page' ) ) : ?>
        <div class="entry-meta">
            <?php generate_posted_on(); ?>
        </div><!-- .entry-meta -->
    <?php endif;
}

but i would like to remove this update date on contact and about page, how to do that?

Thanks

Hi there,

this line:

if ( is_singular( 'page' ) ) : ?>

becomes:

if ( is_singular( 'page' ) && !is_page( array( 'contact', 'about' ) ) ) : ?>

In the array ie. array( 'contact', 'about' ) make sure those page slugs match your pages.

Works, Thanks a lot!

You're welcome

This archived topic is closed to new replies.