Gravity Forms Custom Templates [closed]

You can change a bunch in one hit with the gform_address_types filter, like this: /** * customise the Address field labels * @param array $addressTypes * @return array */ add_filter(‘gform_address_types’, function ($addressTypes) { $addressTypes[‘international’][‘zip_label’] = ‘Postcode’; $addressTypes[‘international’][‘state_label’] = ‘State’; return $addressTypes; });

A special single page templates for posts under a category and all its child category

You can do that with single_template filter. First you will need to check if a post belongs to a top level category. So here is the function. // custom single template for specific category function wpse_custom_category_single_template( $single_template ) { global $post; // get all categories of current post $categories = get_the_category( $post->ID ); $top_categories = … Read more

How do you check if a WordPress template file exist?

So I would add to the Answer the following: function foo_function() { $located = locate_template( ‘home.php’ ); if ( !empty( $located ) ) { // ‘home.php’ found in Theme, do something } } add_action(‘init’, ‘foo_function’); // remember to change both of the parameters above, first one for where you want the // action to happen … Read more

WP frontend output of custom textarea fields not respecting line breaks. In admin it’s OK

Explode your $options value by “/n” ( new line ), then do a echo in foreach: $options = get_option(‘my_custom_plugin_options’); $textarea = $options[‘my_custom_plugin_options_textarea’]; $lines = explode(“\n”, $textarea); foreach( $lines as $line ){ echo $line; } UPDATE #1 For reference, it’s possible to store this function in functions.php to use later in template files. function the_textarea_value( $textarea … Read more

Loading partial templates with AJAX/PJAX

If you’re concerned about the performance I would recommend using the WordPress API instead of trying to load markup using ajax. If you look at wp-includes/template-loader.php you can see how WordPress itself figures out which template to use. You could in theory just load that file, but you might have problems with template_redirect. require_once( ABSPATH … Read more