Making $ globally accessible with jQuery.noConflict()
You don’t need $ = jQuery.noConflict(); Just wrap any functions outside document.ready() within: (function($){ // use $ here safely })(jQuery);
You don’t need $ = jQuery.noConflict(); Just wrap any functions outside document.ready() within: (function($){ // use $ here safely })(jQuery);
Admin menu & submenu separators After going over it and extending the core API to allow main menu separators in custom positions, I did a quick run through core menu files, dumped the hell out of everything’s that in there and found a solution that allows to use the core API also for custom submenu … Read more
Okay, I’ve re-written the function so that it does the following: checks that your array values are set before using them. You can’t always be sure they’ll be there. if the image is empty, it returns with an error message. Not sure if this is what you want, but you can just remove it. first … Read more
A recommended approach for using get_template_part would be for including bits of code that would otherwise be repeated frequently in all your templates. Like if you had conditionals defined within your loop that you wanted to include in archive.php, search.php, single.php etc. It also allows child themes to override that file and include additional more … Read more
Have a look in the source: http://core.trac.wordpress.org/browser/trunk/wp-includes/class-wp-customize-control.php Basic control types: text checkbox radio select dropdown-pages Also some advanced control types (as-described by Otto): WP_Customize_Color_Control – extends the built in WP_Customize_Control class. It adds the color wheel jazz to places where color selection is needed. WP_Customize_Upload_Control – This gives you an upload box, for allowing file … Read more
Just use global $product then use get_attribute() method of that product object, like below- $size = $product->get_attribute( ‘pa_size’ ); And you can also get that by below code- global $product; $size = array_shift( wc_get_product_terms( $product->id, ‘pa_size’, array( ‘fields’ => ‘names’ ) ) ); Rememeber you need to use must the global $product.
If you want to display comments and the comment form on posts but not on pages, you need to split up the logic in your template file to call comments_template() depending on the type of the item displayed (post or page). There are two ways to do this: either you keep one template file for … Read more
For custom post types with custom taxonomy you can make a template for that taxonomy. Your custom taxonomy template would be named taxonomy-{taxonomy}.php. For example, if your taxonomy was called “cooking-categories” you would name your file taxonomy-cooking-categories.php. More information on template files for special taxonomy archives can be found in the codex here: http://codex.wordpress.org/Template_Hierarchy#Custom_Taxonomies_display
No, you cannot include PHP files in a theme the way you indicated. To see why, all we have to do is exercise some common sense and basic critical thinking: You would be doing a remote request to a remote server include cannot do this If by some miracle it worked, you would have a … Read more
1) You can use the template search.php and searchform.php as your starting points. Creating a Search Page Codex 2) As far as the custom query goes, you can use pre_get_posts hook to test if you’re on a search page, then you get $_GET your values, edit your query accordingly. Action Reference – pre_get_posts There are … Read more