Wordpress Snippets

Show Shortcode Without Processing

[print] [shortcodes] [in] [posts] [without] [hindrance]! This is useful if you need to print shortcodes in tutorials or instruction manuals for WordPress plugins. It allow you to output live shortcodes that would normally be processed and the output rendered into… more

Basic WordPress Contact Form

A very basic contact form in a shortcode. No-frills! If you are looking for a standard contact form for your website, this could be for you. All it collects is the persons name, email and their message. There’s also an… more

Setup prettyPhoto Lightbox on WordPress or Genesis Child Theme

Have your images open in a beautiful light box! I wanted to add a lightbox into a site I’m building and I’m really trying to keep the site as lightweight as possible. I also needed this lightbox to be free… more

Clean Up WordPress Comments

Remove the ‘HTML tags’ message from WordPress’s commenting system. This function allows you to change the ‘Leave a Reply’ title on the WordPress comments. It also removes the message about which HTML tags the commenter can use. The Code


Send Debug Messages to a File

Send values of variables to a debug file with a simple function call. When developing a plugin or function, its often useful to be able to read variables at critical points in your code. Or, to log important events over… more

Reduce Large Numbers to Human Readable Formats

A function to make large numbers easier to read or take up less space Sometimes it’s useful to make large numbers more ‘human’ or smaller so they fit in a table. With this function, you can reduce numbers to thousands… more

Get the Current Page URL

This function simply returns the URL of the current page. The URL is returned with its protocol and TCP port number. I’ve added a shortcode just incase you need to return it within your page or post content. The Code

Usage In… more

Add Animated Scroll to Internal Links

All internal links that start with a ‘#’ will use jQuery to smoothly scroll to the relevant page position. Just paste this into your functions.php file and it should just work. If you have any problems, make sure jQuery is… more

Fix Google Structured Data > hentry Errors

Do you have lots of Missing: author, Missing: entry-title or Missing: updated errors in Google’s WebMaster Tools? Add this code to your functions.php and it should fix most of them. Read the ‘Set Up’ at the bottom of the article as there is… more

Redirect a WordPress Page Between Dates

Allows you to redirect a certain page or post on your WordPress blog to another location, depending on the date. You set the start and end dates, The post_id of the page you want redirecting and the URL where you… more

Related Posts Shortcode for WordPress

Display related posts in a definable amount of columns. This function will add a shortcode that returns lists of related posts. The posts are formatted in a table like manner. You can send attributes to control the number of results,… more

Add Social Links to WordPress

This function will enable you to insert social links into your templates very easily! You can use this simple function to add links you your social networking pages. It features clean Font Awesome icons. I’ve include a few of the… more

Add Favicon Metadata to WordPress

It’s easy to add meta-data to the <head> section of your WordPress site. This will insert any code or metadata into the <head> of your site. In this example, I’m adding favicons of various sizes and formats. The Code


Add Font Awesome to your WordPress Theme

Font Awesome is a fabulous set of vector icons that you are free to use on your own website. To do this, all you have to do is load the stylesheet. You don’t even have to host it yourself, it… more

Make Widgets Execute Shortcodes

Shortcodes added into text widgets are not processed by default in WordPress. There are many plugins available to add this functionality, but why bother? Just add this single line of code in your functions.php! The Code


Auto Insert Adsense Google Adverts into Posts

Adsense advertisements where you want them.. Merged with your content! This is a follow-on from the Insert Responsive Adsense Advert post. You MUST have followed that article to set up the Adsense shortcode first! Once you have both functions set… more

Responsive Google Adsense Advert Shortcode for WordPress

This shortcode allows you to insert responsive Adsense advertisements anywhere you choose to in your posts or pages. There are plenty of options to adjust the type and style of the advert. Plus there’s the option to auto-insert the advert… more

Show Links / Blogroll Shortcode

Show your links anywhere with this shortcode. If you wish to show your WordPress links (also known as the blogroll) in a page or post, this will create a shortcode to print a list of links. Set Up Change LINKCATEGORY… more

Add Google Analytics to WordPress

Quick and easy way to add Google Analytics to your blog If you want to add Google Analytics to track your website visitors, this little bit of code will do it for you. This function will also work with any other… more

Website © 2018 Mokum Music. Read Privacy Policy

This site uses cookies. Find out more about this site’s cookies.