What’s the purpose of $wp_did_header?
It’s a global variable that can be checked by user functions and filters to see whether or not WordPress has already sent headers. It’s just there to help.
It’s a global variable that can be checked by user functions and filters to see whether or not WordPress has already sent headers. It’s just there to help.
WordPress uses a Template Hierarchy to determine which template file to load based on the current context: This diagram is a visual representation of \wp-includes\template-loader.php, that contains the context-based template-selection logic. As to your specific questions: For example, suppose I have two posts by the same author. How do I make WP use the author.php … Read more
You need to look how page templates are saved against a page in the wp_postmeta table. Each page is linked to the specific template it uses and this is saved under the meta key _wp_page_template. You can go and have a look at your own install how you db structure looks like and how page … Read more
So my question is, should I assume that this is a theme-based functionality, where some themes provide support for files with the template-{slug}.php naming? Correct. Or do all WordPress applications allow for such files? If so, where can I find instructions on how to use template-{slug}.php files? Or is there another way these days to … Read more
This question leans towards getting some subjective answers, as I think it’s a matter of personal preference. The built-in editor works just as well as any other text editor. That goes for any of your theme files, not just header.php. The benefit of using an external editor (like Notepad++ and using FileZilla to FTP your … Read more
If you’re using static pages, try using is_page() for your conditionals. Let’s assume your static pages have slugs, “customers”, “vendors”, and “services”: <?php if ( is_page( ‘customers’ ) : get_sidebar(‘customer’); elseif ( is_page( ‘vendors’ ) ) : get_sidebar(‘vendors’); elseif ( is_page( ‘services’ ) ) : get_sidebar(‘services’); else : get_sidebar(); endif; ?> But I agree with … Read more
You can use template_include filter hook add_filter(‘template_include’,’my_custom_search_template’); function my_custom_search_template($template){ global $wp_query; if (!$wp_query->is_search) return $template; return dirname( __FILE__ ) . ‘/my_search_template.php’; } /*UPDATE: there was a missing “;” after $template*/
You can pass a string for has_archive. That string will be used as archive URL. So in your registration code use: ‘has_archive’ => ‘jobs’ From the register_post_type() declaration in WordPress core: if ( $args->has_archive ) { $archive_slug = $args->has_archive === true ? $args->rewrite[‘slug’] : $args->has_archive; if ( $args->rewrite[‘with_front’] ) $archive_slug = substr( $wp_rewrite->front, 1 ) … Read more
Do you have: A category somecategory defined? Posts categorized with somecategory? Some default else: content in the Loop in category.php? I suspect the URL is returning a 404, and WordPress is simply serving up the root URL, because it has no content to serve up from category.php. EDIT You don’t need to do anything special … Read more
That looks like a http://para.llel.us/support/ theme. You might start there for docs—for instance, they probably have a custom ‘Theme Options’ page in the admin. Short of that, and presuming you’re ok with setting it in code (which may negate any future settings in the admin), you’ll first need to find out where $blog_query is being … Read more