0

I have customized the Twenty Fourteen theme to use the page "news" for my posts page because I have static frontpage.

When you view my news page, comments don't show up, even though they are enabled, and when you go to the specific post, they are. Is there any way to add the comments to the news page, where the posts are supposed to show up in full form?

I also can't get the date of the post to show up in either place and I can't figure out why.

1

Try editing category.php – or category-news.php if you have it – your CSS seems to indicate you've created a "news" category, but you'll hopefully know which files you've edited - and adding:

$withcomments = 1;

// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
    comments_template();
}

between get_template_part('content', get_post_format() ); and the endwhile (in the bit where WordPress loops through each post.)

This will add a comments form after every post on a category page (if you have loads of posts, especially short ones, you may find it much too cluttered, though.)

As for the date, the Twenty Fourteen theme has a function called twentyfourteen_posted_on() (it's in the template-tags.php file) - it prints the date and the author.

As you'll see if you inspect how it works, you can add:

echo esc_html( get_the_date() );

to print the date by itself, and get_the_date() takes a parameter that lets you customise how the date (and/or time) is displayed using the standard PHP date format.

You may also find the Template Hierarchy useful - it explains which template files WordPress loads to display different pages.

  • Thanks William, I read a few threads about get the date, which is in my template-tags folder already. I guess that's why I am confused. If you view source you can even see that it's in the source code (date of post) but isn't showing up. I basically made the news category so that it would show the posts, otherwise uncategorized they were displaying error pages when I tried to view them. I added the comment code you gave me to category.php but it's still not working. Thank you for taking the time to answer though! – leahdesigns Apr 10 '15 at 21:28
  • Looks like the date is missing because you have .entry-header { display: none; } in your CSS - so you would need to get rid of that, restyle the header to fit your design and also remove the duplicate post title. – William Turrell Apr 10 '15 at 21:35
  • Ok, I am really embarrassed now because I actually know css and was looking for entry-date! I am SO relieved and grateful to you William! It's working beautifully. Thank you again so much for your great advice! – leahdesigns Apr 10 '15 at 21:56
  • No problem don't worry about it Leah (I didn't think to look at the HTML source either…) W. – William Turrell Apr 10 '15 at 22:56

protected by Community Jan 21 '16 at 7:05

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.