WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just got this "fresh" task this morning.

I have a website that using the following syntax

$thenews = get_page_by_title(date("Y"));

But in the website it's displaying not the latest news.

What other parameter should I include in this syntax?

To be honest I just start explore WordPress this morning but quite familiar with PHP

Another problem is I only have the CMS module from vendor,

I have no source file to play along.

Thank you


share|improve this question

You can get the source of WordPress at http://wordpress.org for playing along.

I think at the root of your question is a misunderstanding in how WordPress works. Pages should not show the latest blog posts by default (which is what you are calling using the code sample above). By default the latest blog posts should show on the homepage of the site.

If you have changed your reading settings (Settings/Reading) to show some page on the front of the site then you also need to set a page as the 'Blog' page, then the latest blog posts will show there.

I think that to get complete answers to your question you're going to have to refine it to it's smallest bit and ask again.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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