How to Find Page ID

I was working with Nexus theme from Elegant Themes for a project. It was a need to show content of a specific page in the home page itself. To achieve this, a little theme modification was required. Adding following PHP code in proper theme file can do the trick.

Display specific post content where ID is 96

<?php query_posts(‘p=96’); if(have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endif; ?>

Display specific page content where ID is 96

<?php query_posts(‘page_id=96’); if(have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endif; ?>

Now the question arises – how to find ID of a page / post?


You need plugin Admin Columns.


Method 1:

Open the page / post is open in editing mode, If it is already published, click Save Draft to change Publish status to Draft (Image 1). Place the mouse pointer on Permalink and watch the browser status bar. Information in the status bar will show the page / post (Image 2).

Method 2:

We shall use Admin Columns plugin. Install the plugin from WordPress plugin repository in your WordPress setup and activate it. Visit Settings -> Admin Columns in WordPress Dashboard (Image 3). Select Page or Post from drop down area. By default, there are four options already defined – Title, Author, Comment & Date. Add a new entry by clicking + Add Column big blue button below the list. Find out ID in Type drop down area and click Update button in Store settings area. Check the page / post list and you will find a new column named ID appeared in the list (Image 4).

Reference Images: