Hook: WordPress hooks

35 posts

Three techniques to alter the query in WordPress

Howdy WP developer! In this snippet, I will describe three different techniques to alter the WordPress default query with an example showing how to add a secondary page to the front page in the Customizr theme Those are quite advanced WordPress programming techniques, so before diving into it make sure you […]

Enable Dashicons in WordPress Frontend

To use Dashicons (the default set used in the WP backend) we need to enable them also for the front-end of our WordPress site, because by default WP allows Dashicons only for the back-end or for registered admins. Paste this code into your functions.php file /********************************************************/ // Adding Dashicons in […]

How to change the “Leave a comment” text in WordPress ?

This text can be altered with a WordPress filter hook comment_form_defaults In the following code, simply replace Custom leave a comment by your own text :   add_filter(‘comment_form_defaults’, ‘set_my_comment_title’, 20); function set_my_comment_title( $defaults ){ $defaults[‘title_reply’] = __(‘Custom leave a comment’, ‘customizr-child’); return $defaults; }

Change the word HOME in the breadcrumb trail

Updated February 24, 2016: Added the option to output either some text or a Font Awesome icon. In case you want to change the default word “Home” in the breadcrumb trail, to something different, this snippet will allow to change it. To use standard characters: just paste this function into […]

Make Featured Pages titles linkable

If you want your featured pages titles be a link to the featured pages, this snippet is what you need. You do not need to copy both versions, choose the one you like best!   1) Javascript version Compatible with FPU plugin, FP plugin, Customizr, Customizr-Pro add_action(‘wp_footer’, ‘fp_titles_linkizr’, 200); function […]

Embedding a YouTube or Vimeo video in your slider

Updated August 2015: Added an option to automatically loop youtube videos (default true) and code updated to work with Customizr-Pro 1.2+ and Customizr 3.4+ Updated April 2015: Added an option to prevent the related videos showing (youtube). Updated March 2015: Added unmute on hover. This snippet works also with Customizr-Pro […]

Restrict the post navigation to the same category

WordPress offers built-in functions to display the previous and next post link.   next_post_link( $format, $link, $in_same_term = false, $excluded_terms = ”, $taxonomy = ‘category’ ); previous_post_link( $format, $link, $in_same_term = false, $excluded_terms = ”, $taxonomy = ‘category’ ); As you can see there’s a boolean parameter named ‘in_same_term’. This […]

Removing the title links in post lists

The Customizr theme displays by default your post titles as links pointing to the single post. Here’s a simple way (using some javascript) to remove those links if you ever need to. Paste the following code in your functions.php : add_action(‘wp_head’ , ‘remove_post_list_title_links’); function remove_post_list_title_links() { ?> <script id=”remove-links-in-title” type=”text/javascript”> […]