• Resolved diversityx

    (@diversityx)


    Greetings

    While I find the following code useful on the blog page, I don’t want it on my tag.php page, as the static pages shouldn’t be date specific.

    <div class="postdate">
       <div class="postday">
            <?php the_time('j') ?></div> <!-- POST DAY -->
       <div class="postmonth">
            <?php the_time('M') ?>
        </div> <!-- POST MONTH -->
     </div> <!-- POST DATE -->

    I would like to add a conditional statement that says “If this is a page (any) instead of a post, show the date block.

    Any suggestions that won’t require me to put in post numbers, page names, etc?

    Thank you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • If you want it only in posts… leave it there in post related templates and remove it from ALL the Pages related templates.
    Why would you need any conditional tags for that?

    Thread Starter diversityx

    (@diversityx)

    In the tags.php. We have titles of posts with dates, and titles of pages without it.

    How does one differentiate a post from a page entry with a conditional?

    Conditional_Tags

    is_page?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    I don’t quite understand the question either… tag.php is not a static Page, it’s the Tag template. So is_page() will return false there anyway.

    Thread Starter diversityx

    (@diversityx)

    The tag is_page doesn’t seem to work in a loop when displaying a list of posts. I had hoped that was my answer.

    Thread Starter diversityx

    (@diversityx)

    On my tag.php page, I have summaries of many posts that relate with the tag. Some are posts, some are pages. I want dates to show on the post summaries, but not on the page summaries. I have to create a conditional that says “if this summary is from a post, show the date… if from a page, don’t show the date”.

    How do you add tags to Pages? I don’t see anything like that in Write Pages subpanel?

    Thread Starter diversityx

    (@diversityx)

    Ahhh… I’m using a plugin called “Simple Tags”. Perhaps this is what is creating this issue.

    I like having tags on my pages. But they definitely need to be displayed differently in their summaries.

    How would you write the logic loop for this, short of doing an array of every individual page. <ugh>

    Thread Starter diversityx

    (@diversityx)

    Ok then, I solved it with a custom field. Very powerful tool!
    ‘ $view = get_post_meta($post->ID, ‘show_date’, $single = true);
    if ($view === no ) { }
    else { ?>
    <div class=”postdate”>
    <div class=”postday”><?php the_time(‘j’) ?></div> <!– POST DAY –>
    <div class=”postmonth”><?php the_time(‘M’) ?></div> <!– POST MONTH –>
    </div> <!– POST DATE –>
    <?php } ?>’

    This will work without having to mess with the code more than once. Thanks for your assistance.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    I have summaries of many posts that relate with the tag. Some are posts, some are pages.

    I don’t know how you’re getting those summaries, but if it’s in a normal Loop, try looking at the contents of $post->post_type.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Conditional to remove date meta from tags page’ is closed to new replies.