Light-weight, fast, simple and powerful!
Translations of this page?:


The id() function returns the database ID of the current page. This code:

<?php echo $this->id(); ?>

will return a number, e.g. “1” for the root page (“Home page”) created at install time.

Note that for Archive pages, (e.g., the %B %Y archive monthly archive page created during installation), the id() result will be the same no matter which month (in this example) is being displayed, since each one is the same “page”.

Finding the ID of a page

To discover the ID of any page (“68” in the examples below), either (a) hover over the title in the Pages index, and the page id and slug will be displayed in a tooltip:

Tooltip displays page ID and slug

or (b) click the “Settings” tab when editing the page:


See also

The following functions also make use of the id value of a page:

functions/id.txt · Last modified: 2012-02-15 23:50 by David
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 / design by yello studio / Wolf CMS Inside