Tag Info

Hot answers tagged


Inside the loop you can make use of wp_get_post_terms() to return all the terms associated with the specific post. This object returned holds all the terms with all the properties of the specified terms With that in mind, you can use a foreach loop to get each term, and then check each term's parent. For grandchild terms you will need to do some extra ...


What about setting a static page as a page for posts? Settings -> Reading -> Front Page displays One static page for front (for example Home) and another static page (Blog) for posts.


You can just look at url, load the file and exit. That can be done when WordPress loaded its environment, e.g. on 'init'. add_action('init', function() { $url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH), '/'); if ( $url_path === 'retail' ) { // load the file if exists $load = locate_template('template-retail.php', true); ...


This was driving me nuts, and I finally decided to search for where a page template's value is stored in the database. This gave me my first clue, because I found single-sponsor.php, the name of one of the other template files I'm building. I was confused as to why this could be the case, and looked at the HTML of the actual dropdown menu WordPress ...


"Page not found" means it is not a template problem, rather permalink issue. Try setting your permalink to default and than visit the page!


I have managed to resolve this by adding in a custom rewrite into the functions file: // Add custom rewrite rules to handle things like years in custom post archives function add_rewrite_rules($aRules) { $aNewRules = array( 'news/([0-9]{4})/([0-9]{2})/page/?([0-9]{1,})/?$' => ...


Nope. Unortunatly 1 directory depth is hardcoded as second argument for get_files method in method WP_Theme -> get_page_templates.

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