Motivation

If you have previously written PHP code with WordPress, you have likely come across actions and filters.  If not, be sure to read up on it first – this is a powerful concept and definitely worth learning.  This document highlights some of these hooks that you might want to consider as you delve deeper into development.

Brand new with BluePrint-Q

BluePrint-Q takes advantage of this hook system by using and extending much of what WordPress has to offer.  Here are some of the hooks that we invented for use in the BluePrint-Q theme.

Framing

These are all actions that have no arguments.  They are simply used to hook in for display purposes and this is primarily how BluePrint-Q constructs the frame.

  • action_bpq_alert (0)
    • Called above anything else.  This typically places an alert at the top of each page.
  • action_bpq_header (0)
    • Includes the top bar, masthead, navigation bar, and highlight area components – in that order, from top-to-bottom.
  • action_bpq_footer (0)
    • Includes the pedestal and bottom bar – in that order, from top-to-bottom.

Loop

These are all actions that are responsible for constructing the display of the main content (inside the frame).  We refer to it as ‘loop’ because a lot of these are referred to in close proximity to the main WordPress loop.

  • action_bpq_loop_before (1)
    • Called before the loop is run.  The single argument contains a string indicating ‘before’ or ‘after’ – useful for applying styling classes.  Also used to setup the grid system between the left sidebars and the main content.
  • action_bpq_loop_after (1)
    • Called after the loop is run.  The single argument contains a string indicating ‘before’ or ‘after’ – useful for applying styling classes.  Also used to setup the grid system between the right sidebars and the main content.

Posts

Contains a number of actions and filters that affect the display of posts.  For a lot of these filters, you could return an empty string to omit the undesired data (or you could use the Content section in the Customizer).

  • action_bpq_article_before (0)
    • Called just before a post is displayed.
  • action_bpq_article_after (0)
    • Called just after a post is displayed.
  • filter_bpq_post_meta_author (1)
    • Change the value of the author associated with a post.
  • filter_bpq_post_meta_categories (1)
    • Change the value of the categories associated with a post.
  • filter_bpq_post_meta_comments (1)
    • Change the value of the ‘comments’ link associated with a post.  Typically contains the number of comments, if there are any.
  • filter_bpq_post_meta_date (1)
    • Change the value of the date associated with a post.
  • filter_bpq_post_meta_edit (1)
    • Change the value of the ‘edit’ link associated with a post.  Typically appears when an administrator/author is viewing.
  • filter_bpq_post_meta_tags (1)
    • Change the value of the tags associated with a post.
  • filter_bpq_post_pagination_loop (1)
    • Currently unused.
  • filter_bpq_post_pagination_nextpage (1)
    • Currently unused.
  • filter_bpq_post_read_more (1)
    • Change the value of the ‘read more’ link associated with a post.  Typically appears on archive pages.

Navigation

Alter menus before they are displayed.

  • filter_bpq_change_main_menu (1)
    • Called just before the menu that you have applied to the Navigation bar is displayed.  You might want to use this filter to prepend or append markup.
  • filter_bpq_change_top_menu (1)
    • Deprecated.  Use widgets instead.
  • filter_bpq_change_bottom_menu (1)
    • Deprecated.  Use widgets instead.

Highlight

The highlight area is the area typically just above the main content and just below the navigation bar.  It can display a slider, a page title, or even search results.

  • filter_bpq_highlight_text (1)
    • Change the value of the primary text.
  • filter_bpq_highlight_subtext (1)
    • In cases where there is small text after the primary text, change the value of the secondary text.

Even more hooks?!

BluePrint-Q extends a whole bunch of the hooks that WordPress provides as well as the hooks introduced by other plugins.  We make it easy for you to figure out what we are supporting because we have placed every meaningful hook into a distinct folder.  Then, we grouped those hooks into distinct files, grouped them even further within each of those files, added a bunch of comments, and wrapped all of that in a blueberry pancake?!

At this point, you are probably in your IDE.  Go to the ‘bpq’ theme folder and open any of the files under ‘hooks’.