I have a page name “Blog”, it contains a list of posts.
In Settings->Reading->”Posts page:” I selected “Blog”.
How can I get the id of the Blog from template.
I have a page name “Blog”, it contains a list of posts.
In Settings->Reading->”Posts page:” I selected “Blog”.
How can I get the id of the Blog from template.
You must be logged in to post a comment.
To get the ID of the page selected in Settings->Reading->”Posts page:” try this line of code:
If you got to select “Blog” as the posts page it has to be a page you previously created in the Pages section.
To get the ID of the current page you simply do a $post->ID before you enter the loop of posts in your page template. First you do a
global $post
though. Like this: