Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

How to sort WordPress blog posts by Date?

Hi Everyone,

After the recent WordPress update, my blog posts went from being sorted by most recent to alphabetical. This causes all of my newest posts to not appear on the homepage of my website (http://www.protechm.com/).

Does anyone know of a plugin or a PHP script that will make WordPress sort blog posts by publish date?

Thanks!

Andrew Shook
Andrew Shook
31,709 Points

Lee if you feel comfortable doing so, it would be helpful to see the code for your front page template. Since there are dozens of ways to get posts to the home page it would help eliminate a lot of guess work.

1 Answer

Hi Andrew,

Sure, I would happily share that with you. One question, I have this problem on ALL of my pages, every page has its own category, and now they are all alphabetical :(

What file should I share with you, it is a .php?

Thanks!

Andrew Shook
Andrew Shook
31,709 Points

Yeah its a .php file. See if you have a front-page.php. If you do copy it into a comment on here.

I do not see that front-page.php, I actually can't find any .php titled for any of my pages. It looks like my theme has all of the .php files broken into the pieces that make up the pages. I.E. Footer, header, body, etc.

Andrew Shook
Andrew Shook
31,709 Points

Ok then look for something call content-front. If not then post your index.php file

Would that be in my current Themes Folders? (wp-content --> themes --> current theme --> index.php)

Thanks for your help.

Andrew Shook
Andrew Shook
31,709 Points

Yes the index.php file in the theme folder of the currently active theme.

<?php get_header(); ?>

</div>

<?php get_footer(); ?>
Andrew Shook
Andrew Shook
31,709 Points

Ok, two more things. What is the name of your theme, and did you purchase it from a site that sells themes?

Gridz

And yes, purchased from Theme Forest. I should probably ask the developer shouldn't I?

Andrew Shook
Andrew Shook
31,709 Points

yeah, I could help, but I don't think the developer would appericate you post huge chunks of their code for the public to see.

Good point, where is my brain?

Thanks Andrew!