Currently Browsing Recent Articles

Custom shortcode with attributes

Posted on 16th September, 2017 118 Comments

Building a custom shortcode is pretty easy. Declare the vars and use ob_get_clean() to output the function. The shortcode should include the title, desc and url for the link. [add_pdf_shortcode title=“the title” desc=“the description” pdf=“”]

Offset posts from random loop

Posted on 16th September, 2017 144 Comments

I recently created a post grid with 3 post loops of random posts, separated by a single meta field content after each iteration. This is where wp_list_pluck came into its own. You use the previous query array to offset the random posts used in the previous loop. to offset the previous posts include the post__not_in…

Adding multiple hidden fields to filter wordpress search

Posted on 4th March, 2017 187 Comments

To add multiple fields you’ll first need to create a small funciton in your functions.php   Then in your searchform.php you can add hidden fields like this. If you want to do this with any other filter, for example categories. Repeat the above and replace post_type with cat.

Adding buttons to wp-admin editor

Posted on 4th March, 2017 1,902 Comments

You can add two types to the editor, the first one below adds a button to the “Text” version of the editor. The second enables and adds the “Format” dropdown to the “Visual” version of the editor. For the text version we’ll need to create the shortcode that’s going to be applied by the button.…