Tag Info

Hot answers tagged

3

The last line tells WP to run this function on the pre_get_posts hook. That hook is the ideal place to modify the main query that will be run in order to build the page. In this case, exclude_featured_tag() checks whether WP is loading the home page, and whether it's about to call the main query for the page (as opposed to any other secondary queries being ...


2

The get_template_part('content', get_post_format()); line includes content from one of the other files in your theme based on the post type, the file name will be something like content-page.php (or content.php if the format is not found). If you print out what get_post_format() returns, you will be able to tell which content file to look into. Once you ...


2

Ultimately it's about maintainability and readability. Functions.php is good for adding just that - functions. Small snippets of code that modify or add to the theme. When you start getting into classes or building some kind of framework, you need to start separating your concerns whether that be moving them into a plugin or simply including your class files ...


2

Your actual question is basically when to run a custom query and when to make use of the main query. Lets break it down in three parts PART ONE When to run a custom query (This is not a definitive list) To create custom content sliders To create a featured content area in a page On page.php templates if you need to display posts If you require custom ...


1

I'm not sure if this question is still relevant or not (so I'm posting for future reference for people), but there is a way to define a css file for the TinyMCE editor in your plugin by using the mce_css filter. For a quick example, I'll take an excerpt from the WordPress documentation: function plugin_mce_css( $mce_css ) { if ( ! empty( $mce_css ) ) ...


1

A custom template for one specific category should be named category-slug.php where "slug" is the WP slug for the category. WordPress will automatically use this file to display the archive for that one category. You could also name it using the ID of the category. If your category is "legacy-posts", then your template file should be named ...


1

Yes. wp.customize( 'header_textcolor' )(): ( function( $ ) { //Update site background color... wp.customize( 'background_color', function( value ) { value.bind( function( newval ) { $('body').css('background-color', newval ); var text_colour = wp.customize( 'header_textcolor' )(); // ... now do something ...



Only top voted, non community-wiki answers of a minimum length are eligible