Support » Themes and Templates » How to hide date and time on pages only (not posts)

  • Resolved nickposs


    I’d like the pages on my website to appear more like regular static pages — so I’d like to hide the time and date stamp on them (the “posted by” and “comments are closed,” too–but one thing at a time). I’m using the Panaroma theme and in the page.php file it says:

    <div class=”authormeta”>

    <?php _e(‘By’,’panorama’); ?> <?php the_author_posts_link(); ?>, <?php the_date($ap_dateTimeFormat); ?></div>

    Is there anyway to edit this so that it knows to only show the time/date on posts and not static pages?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Unless you are using a static page with a query_posts on some pages, to display posts on a static page, the page.php file is used only when displaying static pages. Therefore you can delete the lines of code you included in your post.

    Just to be safe, save a copy of the file the way it is now before you delete those lines.

    Well, I tried editing the page.php, but it didn’t make any difference for the static pages. For example, I tried removing the author meta: `<div class=”authormeta”><?php _e(‘By’,’panorama’); ?>
    <?php the_author_posts_link(); ?>,<?php the_date($ap_dateTimeFormat); ?> </div>`

    But the posts still show “Posted by” and the date. My guess is that it is not even using the page.php to generate it and I’m not sure how to select that as the template. Going through the codex, it looks like it was easy to select a template for each new plate, but I can’t find any updated info on how to do it in 2.7.

    Okay, a breakthrough. I finally figured out that I needed to be editing the php files in the Panorama theme directory. I had been editing the ones in root. Already, the above mentioned deletion had the desired effect. I’ll keep trying.

    So, editing the page.php in the template directory has the desired effect. I would still really like to be able to select the template while editing the post or page, though. It seems like this was available in earlier WordPress versions. Am I simply ignoring this option somewhere. I have created a couple of test .php templates to see if that triggers the menu, but no luck.

    With Pages you can specify the Template at the time of writing the Page.

    On the other hand, the WordPress Template Hierarchy controls what Template is used to display Posts. But you can use a plugin to assign Templates to specific posts:

    Pages#Page Templates

    I understand, but there is no drop box for Template in the page editor. Digging around the forum, I found it suggested that you should switch themes and try again. Still, I don’t see the menu. My only choices are Parent and Order. When I go into the Appearances–>Editor, all of the custom templates show up and can be edited. I just can’t find a way to select them when I’m within the page editor. (Hope that makes sense.)

    Just what I was looking for. Thanks for pointing me in the right direction. (Not sure why that didn’t turn up in all of my searches.)

    To hide the author info (written by) on the pages (pages only – not post) open the page.php and delete this line:
    <?php _e(‘By’,’panorama’); ?> <?php the_author_posts_link(); ?>,
    Save your changes, and you are done.

    is’nt it any plugin to hid author/date – for those of us that don’t master coding and “the holly codes”?

    I have iNove theme. I found no lines in my page.php file that resembled the lines Nickposs above suggested deleting.
    Anyone have suggestions how to make dates not show up in static pages of iNove theme?

    I’m with Smile2life. This is such a basic tweak, to not show dates in static pages, rather than a plugin, I think it should be something I can set within dashboard or /wpadmin for my site. But apparently not . . .? Why all this messing around for such a simple change that I’d think a lot of people might prefer? But more importantly for me, how can I make this change in my theme?

    Thanks in advance.



    Forum Moderator

    what about line 8 in page.php of iNove theme?
    <span class="date"><?php the_modified_time(__('F jS, Y', 'inove')); ?></span>

    Thanks, alchymyth. That did work. Now I’m trying to figure out how to remove the “comments are closed” line from each static page, and on right sidebar, the Blogroll, Categories, Archives and Meta links, none of which I want. HOPEFULLY, unlike the date, those are removable from the dashboard or /wp-admin.

    To get rid of the comments, I tried deleting from the inove page.php file the following. That did not work, it just broke the site.
    “<?php if ($comments || comments_open()) : ?>
    <span class=”addcomment”><?php _e(‘Leave a comment’, ‘inove’); ?></span>
    <span class=”comments”><?php _e(‘Go to comments’, ‘inove’); ?></span>”

    Thanks again.

    Ooops, well, my SITE looks OK aside from the issues I named above. But now when I go to the pages section of /wp-admin for my site, I get this message.

    Parse error: syntax error, unexpected ‘<‘ in /home/content/33/4675533/html/test/wp-admin/edit-pages.php on line 349

    And I can’t see anything about the pages. I did not edit any file called edit-pages.php, just the page.php file in the theme.
    Any clues as to what I need to do to get the problem fixed? I guess I should start a new thread. . .

    Gosh, what should be a simple change is getting ridiculously time consuming.

    In reference to the INOVE theme – I just figured out how to remove the date and time from my comments section.

    I believe this is also the file you need to edit if you want to remove it from all pages too.

    Look in the functions.php file and comment out line 502 and delete line 503 (make a backup first).

    <?php printf( __(‘%1$s at %2$s’, ‘inove’), get_comment_time(__(‘F jS, Y’, ‘inove’)), get_comment_time(__(‘H:i’, ‘inove’)) ); ?>
    | “><?php printf(‘#%1$s’, ++$commentcount); ?>

    Your file may be slightly different but for me it was line 502/503::

    I just removed that and I was golden!

    Hope this helps someone!

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘How to hide date and time on pages only (not posts)’ is closed to new replies.