Site logo

Archived topic

GP Hooks per page.

3 replies · Started by Michel on August 18, 2015

Viewing posts 1–4 of 4

The built-in hooks and the dashboard settings page for assigning hooks is very neat and handy. It would be cool if hooks could be assigned per page (in additional to global). I'm not sure if that would be too much for the WP Dashboard setup, or perhaps there's a way to assign shortcode/php per page through the current settings page that I don't know about.

Hi Michel,

You can actually use the WordPress conditionals found here: https://codex.wordpress.org/Conditional_Tags

For example, if you wanted to target the front page:

<?php if ( is_front_page() ) : ?>
      Stuff in here will only show on the front page
<?php endif; ?>

Or a specific page with an ID of 10:

<?php if ( is_page( 10 ) ) : ?>
      This will show up on page ID 10
<?php endif; ?>

Just be sure to check "Execute PHP" if you're using PHP within the hooks :)

Geez, that was easy. Thanks.

No problem :) Glad I could help

This archived topic is closed to new replies.