Action Hook Reference

Much like the WordPress hooks we all know and love, Prodigy comes with hooks-a-plenty as well. And though the hook names are quite descriptive, you might need a little more detail.

First of all, please be aware that Prodigy takes proper advantage of all the recommended theme hooks, so all plugins that use these hooks should be compatible with Prodigy.

Also, Prodigy defines all its hooks in the /lib/hooks.php file, so you can always look there to see what hooks are and are not available, if this document is ever slightly out of date.

Internal Action Hooks

These hooks will probably be of no use to you, but they do exist. If you are an advanced user, you may be able to take advantage of these in some way.

prodigy_init
This is the first hook in the framework to execute. It’s not a display hook, so don’t hook any echo functions to it.

prodigy_framework_init
This hook builds the template structure by doing things like calling the header.php and footer.php files, and executing other structural hooks. You should never need to hook anything to this action.

Document Head Hooks

All of these hooks display in the <head> … </head> section of the HTML document.

prodigy_title
This hook is what outputs the document title (sometimes referred to as the <title> tag). The framework uses some basic logic to determine the best title for the document, but will allow for the use of plugins such as All-in-One SEO and Headspace2 for title generation, if they are active.

prodigy_meta
This hook should be used to insert any META tags into the document head.

prodigy_styles
This hook should be used to insert the stylesheet calls for the document.

prodigy_head
This hook should be used to insert anything else that you need to insert into the document head. prodigy_head executes just before wp_head.

Structural Hooks

prodigy_before
This hook executes immediately after the opening <body> tag in the HTML output.

prodigy_after
This hook executes immediately before the closing </body> tag in the HTML output.

prodigy_before_header
This hook executes before the header.

prodigy_header
This hook generates the content of the header (Title and Tagline, by default).

prodigy_after_header
This hook executes after the header.

prodigy_before_footer
This hook executes before the footer.

prodigy_footer
This hook generates the content of the footer (Site name, copyright notice, and credits, by default).

prodigy_after_footer
This hook executes after the footer.

prodigy_before_content
This hook executes right after the prodigy_after_header hook. By default, it will also execute before the loop.

prodigy_after_content
This hook executes just before the prodigy_before_footer hook. By default, it will also execute after the loop.

Loop Hooks

These action hooks will execute in various locations throughout the default loop. By using these hooks, you can essentially make the loop behave however you want.

prodigy_loop
This hook actually executes the loop, and various loop hooks below. By using the loop_logic filter, you can actually create your own loops to replace the default loop, if necessary. For most users, this won’t be necessary or desirable.

prodigy_before_loop
This hook will execute just before the loop starts.

prodigy_after_loop
This hook will execute just after the loop ends.

prodigy_after_endwhile
This hook executes after the endwhile tag in the loop. By default, it is used to display things like the previous/next page navigation.

prodigy_loop_else
This hook executes after the else tag in the loop. By default, it is used to display a “not found” notice, since it only executes if the loop returns no post results.

Post Hooks

These hooks execute at various times within the the loop, when a post is returned. They are used for things like displaying the post title, post meta, comments, etc.

prodigy_before_post
This hook executes before each post that the loop returns.

prodigy_after_post
This hook executes after each post that the loop returns.

prodigy_before_post_title
This hook executes before the title of each post that the loop returns.

prodigy_post_title
This hook, by default, outputs the title of each post that the loop returns. The title structure can be seen in /lib/structure/elements.php. By unhooking the prodigy_post_title_logic function from this action hook, you can create your own title generation function to create any title structure you want (or none at all).

prodigy_after_post_title
This hook executes after the title of each post that the loop returns.

prodigy_before_post_content
This hook executes before the content of each post that the loop returns.

the_content
Not a Prodigy Hook! But WordPress does provide a filter on this function’s output. I just wanted to mention this in case anyone was wondering why there was no prodigy_post_content action hook.

prodigy_after_post_content
This hook executes after the content of each post that the loop returns.

Comment Hooks

FWIW, I want to add a lot more action hooks to the comments template, and abstract some of the output into the Prodigy engine. For now, these are the hooks that fire when the comments template is displayed.

prodigy_before_comments
This hook executes before the comments output. By default, it is used to open a div with an ID of “comments” before the comments block.

prodigy_after_comments
This hook executes after the comments output. By default, it is used to close a div with an ID of “comments” after the comments block.

prodigy_before_respond
This hook executes before the comment form logic. By default, it is used to open a div with an ID of “respond” before all the comment form logic.

prodigy_after_respond
This hook executes after the comment form logic. By default, it is used to close a div with an ID of “respond” after the comment form logic.

prodigy_before_comments_form
This hook executes before the actual comment form.

prodigy_after_comments_form
This hook executes after the actual comment form.