WordPress.org

Support

Support » How-To and Troubleshooting » Override global post id with page template.

Override global post id with page template.

  • I have a custom page template and I will assign it to a page.

    I need to, for the whole page template, hard code a specific page id. So even if I assign the template to page 1 I would like page 1 to be treated like page 2, because page 2 will the the hard coded ID in the template. Then when any loops or sidebars using Widget Logic, etc are loaded in that page they are passed along page 2 as the ID.

    I tried doing this at the top of my file global $post; $post->ID=2; but when the loop happens it still loads as ID 1.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Override global post id with page template.’ is closed to new replies.
Skip to toolbar