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


1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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