• Resolved PaulaO

    (@holyroller)


    I have a site that is more CMS than blog. Almost everything is in pages vs posts. The date isn’t important there and I can easily just remove that line which I will.

    But for another site where posts and pages are fairly equal, how can I remove a date from just a specific page or all pages? For example, on the About or Contact page, a date is just weird and makes the site feel unattended.

    Is there a plugin for this? My theme, one I did myself based on the WP Classic years ago, doesn’t have a page.php.

Viewing 9 replies - 1 through 9 (of 9 total)
  • if you don’t want it displaying on any pages you can do this

    <?php if (!is_page()) { ?>
    ---- date displaying code ------
    <?php } ?>

    If you don’t want it only on About or Contact

    <?php
      $display_dt = true;
    if (is_page('about') || is_page('contact')) {
      $display_dt = false;
    }?>
    
    <?php if ($display_dt == true) {   // conditionally display date ?>
    ---- date displaying code ------
    <?php } ?>

    Thread Starter PaulaO

    (@holyroller)

    Cool beans! Both worked.

    Question:

    Let’s say I want to block the date on a third page. The code for that line would look like this?

    if (is_page('about') || is_page('contact') || is_page('subscribe')) {

    I basically need a space, followed by || then the is_page(‘*’) and I can just keep listing pages, right? Waste of time and energy to do it but I’m curious about how it would be written out.

    yes, your suggested code is correct.

    When you get up to 6 or 8 it makes sense to do it a different way, either use a custom template for those pages that doesn’t have the date code on it in the first place, and assign that page template to those pages.

    Or, create a function outside of the template that lists the pages to exclude. Then the template just says something like
    <h3><?php if (display_dt) {>< date display code > <?php } ?></h3>

    Thread Starter PaulaO

    (@holyroller)

    Again, thanks!

    newiebee here, what page do you add the code to? Or do you create it’s own file?

    celebritywax

    (@celebritywax)

    What page do you add the code too?

    celebritywax

    (@celebritywax)

    i dont want the following on any pages i created

    “Posted: June 11th, 2009 | Author: admin | Filed under: Uncategorized | Modify: Edit This | Comments Off”

    how do i delete this

    turkeyjerky214

    (@turkeyjerky214)

    I’ve been trying to add this code to different pages, and I can’t seem to find which page or where to add it to get it to work.

    holyroller or stvwif, could you let us know which page and where in that page to add the code?

    Thanks!

    aagrpahics, turkeyjerky214…

    I added the suggested code:

    `<?php if (!is_page()) { ?>
    —- date displaying code ——
    <?php } ?>`

    to the index.php file.

    To do this you will need an FTP client (like Filezilla) so that you can access the index.php file.

    Once you get the FTP client, then I open in an HTML editor. I simply pasted the above code before the first div id and it seems to work.

    Note: I’m pretty green myself, so it any other gurus come along and tell us otherwise, then I immediatley bow to their superior knowledge.

    JVB

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Delete Date from Pages’ is closed to new replies.