• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Hook reference with args

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Hook reference with args

This topic is: not resolved
  • This topic has 4 replies, 2 voices, and was last updated 13 years ago by lwoods.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • June 12, 2013 at 11:30 am #45503
    lwoods
    Participant

    What am I missing?  The Filter Reference in the Tutorials spells out the argument requirements but the Hook Reference does not.  Do I have to dig through the code to find what the requirements are for the hooks?
    Thanks

    June 12, 2013 at 11:53 am #45507
    David Chu
    Participant

    Hi,
    That's because there are any standard argument requirements for hooks. To me, a hook an area that developers have kindly provided for me to stick stuff into somewhere in the theme. That's an over-simplification, but is one way to look at it. So you set up a function that will do something "inside" that hook, and it could be just about anything.

    Here's an example. The first thing may be useful, using the "genesis_before_loop" hook to pop the Featured Image above Post or Page content. And then just do demonstrate that this isn't strict, I put something asinine right after that. 🙂

    add_action('genesis_before_loop', 'dc_put_in_featured');
    function dc_put_in_featured() {
        if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
          the_post_thumbnail();
        }
        echo "Here's My Wonderful Sales Catchphrase!";
    }
    

    Dave


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

    June 12, 2013 at 12:08 pm #45511
    lwoods
    Participant

    Duh!  Of course (I am just learning---obviously)!
    Thanks for responding so quickly and clarifying.

    Larry

    June 12, 2013 at 12:19 pm #45518
    David Chu
    Participant

    Larry,
    That's not a bad question at all - I didn't know how they worked at first. Just the fact that you want to use them puts you way ahead of many Genesis users, and you'll benefit for it.

    I always like seeing example code, and then I'm on my way. I enjoy using this little beauty for knowing where the hooks are. And no, it's not Genesis 2 (soon to arrive), but understanding that will give you a leg up.

    Brian's code will give many examples of hook in use, including some Genesis 2 stuff. WordPress has loads of standard hooks, too, and if you get that far, reading those in their documentation can be very helpful.

    Have fun with the system! Dave


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

    June 12, 2013 at 12:40 pm #45521
    lwoods
    Participant

    Thanks for the "little beauty."  I am using the "Genesis Visual Hooks" plugin and that helps a lot.  And, I have already used some of Brian's code in order to clean up some post meta.

    Thanks, again.

    Larry

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble