Black Friday sale! Get up to 25% off GP Premium! Learn more ➝

Home Forums Support Hooks

  • This topic has 3 replies, 3 voices, and was last updated 9 years ago by Tom.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #47394
    David Seibel

    I’m pretty new to all this….

    I added a video using hooks but just want to show it on the homepage. I put it in the content container and it (obviously) show up on all pages. My homepage is not a static page. I can see doing this on other pages if it is possible.

    Since I’m just getting my feet wet with html, the more detail the better!


    Lead Developer
    Lead Developer

    Hi David,

    To add things to specific pages, we’ll need to use some PHP.

    If your homepage is a blog, then we can do this:

    <?php if ( is_home() ) : ?>
          Your hook contents in here that should only show up on your blog
    <?php endif; ?>

    Then make sure you check the “Execute PHP” checkbox, and you should be good to go 🙂

    Let me know if you need more detail.

    Dave Seibel


    Thanks. That worked. Can I assume that to do this in any other page I can just replace the is_home() with is_pagename()?

    Thanks again,


    Lead Developer
    Lead Developer

    Almost, each page has what’s called a “slug”.

    For example, the “slug” of the knowledgebase on this site is “knowledgebase”, which is the name after the .com.

    So if I want to target something on that page, I would do this:

    <?php if ( is_page( 'knowledgebase' ) ) : ?>
          This will show up on the knowledgebase
    <?php endif; ?>

    Another example:

    <?php if ( is_page( 'addons' ) ) : ?>
          This will show up on the addons page
    <?php endif; ?>

    You can learn more about the WordPress conditionals here:

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.