Caldera Forms – Setting up Conditional Logic based on a post’s taxonomy term

I was trying to set up the following using Caldera Forms’ Conditional Group. This log is based on Caldera Forms 1.7.2. In my form, I needed a Select field X that was auto populated with a list of every post of a custom post type. This can be easily achieved by selecting ‘Auto Populate’ and … Read more

Changing ‘Stock Availability’ Text for Product Variations

This documents one method to change the ‘Stock Availability’ text for Woocommerce Product Variations. My requirement was that when a Product Variation was selected by the user on the frontend, in the following instances I wanted to show the corresponding availability text: Available: ‘[number] units available for your purchase.’ instead of the default ‘Available’. Out … Read more

Querying Custom Post Types with Page Navigation on Front Page

I was experimenting with displaying custom post types on the front page of a wordpress site using various methods. I had first tried using get_posts(), but it couldn’t deal with pagination. The next alternative was to use WP_Query(). At first I had tried to implement this in the home.php template, but next_posts_link() returned an error … Read more

Adding Custom Styles Dropdown in WordPress TinyMCE Editor

I have been trying out a WordPress plugin called WP Code Prettify to make code snippets on this website look more presentable. Previously, I was simply using <pre> or <code> tags without any styling and it was difficult to read. Well, WP Code Prettify will automatically style all <pre> or <code> tags specified with the … Read more

Next and previous post link in same custom taxonomy

Until now, if you use next_post_link(‘%link’, ‘%title’, true) or previous_post_link(‘%link’, ‘%title’, true) to get the adjacent post for a custom post type which has a taxonomy assigned to it, it doesn’t work as intended. This is because these two functions are based on get_adjacent_post() which is hardcoded to look to the taxonomy ‘category’. So hard … Read more

get_header_image() returns null

While working on a theme in wordpress 3.4.2, I realised that wordpress function get_header_image() returns null in a ‘mu-plugins’ plugin even though in the theme’s functions.php file I’ve set a ‘default-image’ like this: add_theme_support( ‘custom-header’, array( ‘default-image’ => get_template_directory_uri() . ‘/subdir/default-header-image.jpg’ ) ); In the theme template file header.php, I’ve called get_header_image(), and it returns … Read more

WordPress Tinymce Dialogs

If you are trying to implement tinymce for your theme options page or plugins and the Insert/edit link doesn’t pop up the dialog after the button is clicked, try this: add_action( ‘admin_print_footer_scripts’, ‘wp_tiny_mce_preload_dialogs’, 30 ); add_action( ‘tiny_mce_preload_dialogs’, ‘wp_link_dialog’, 30 ); This worked for me as of version 3.1.3.

Converting HTML entities to characters

I was trying to use WordPress post titles as email subject headers in such a way: $subject = get_the_title(); wp_mail( $to, $subject, $message); However this became a problem when the post title included smart quotes, em-dash, ellipsis and the likes of them. My email subject ended up looking like this: Hey &#8211; This is my Post&#8217;s Title where … Read more