A snippet to add any content (including HTML, PHP) as a WordPress shortcode for output onto your WordPress site. Simply open up your theme (child theme) functions.php file and add the following function:- Then in your WordPress site’s content editor add the shortcode [anycontent] and your custom content will be outputted using ‘output buffering’. Example Use: Output X Theme Tags …
It’s easy to echo the WordPress title with an H Heading tag/level using the following snippet:- Our example shows the h3 heading tag as WordPress themes typically output post titles with h1 or h2 tags
There are a number of ways to customise / style the WordPress Login, but I find that our approach is the best. 1. Open up your child theme’s (you are using a WordPress child theme right) functions.php file and add the following php function:- 2. Create the CSS Style Sheet ‘style-login.css’ in the directory ‘css’ of your Child theme (if …
Empty paragraphs between <p></p> tags can be a real nuisance in your code (especially WordPress) as they add empty white space. There are a number of jQuery methods to remove empty para tags such as:- But there’s a much simpler way to achieve this with CSS Only Simply add the following CSS to your styles:- Bang the empty paragraphs are gone!
880px x 660px The screenshot should be named screenshot.png, and should be placed in the top level directory. The screenshot should accurately show the theme design and saved in PNG format. The recommended image size is 880px x 660px. The screenshot will only be shown as 387px x 290px, but the over double-sized image allows for high-resolution viewing on HiDPI displays.
Here is a great snippet that automatically creates a menu for your current WordPress Custom Post Type:- Simply drop the code into your custom post archive/template and a menu will be automatically created for you – no need to input your custom post type. Credit to Andy Warren
To enter a WordPress shortcode in a WordPress Template simply use the following php code: – Obviously substitute [shortcode] for your actual shortcode!
Here are a few ways to Query Posts in WordPress as a string and array:- Standard ‘Posts’ NB Above we are Querying WP E-Commerce Products as our Custom ‘Post Type’ Query Pages by menu order
Here is the WordPress Standard Loop for your reference:-
Another quick WordPress snippet. Assuming that you have fancybox linked up to your WordPress install you can add the following to your theme’s functions.php file to open all images that are linked to their full size image with jQuery Fancy Box:-
- Page 1 of 2