Where is the /blog/ url set from?
Change the filename from tpl-blog.php to page-blog.php, see if that fixes it.
Change the filename from tpl-blog.php to page-blog.php, see if that fixes it.
Use both hooks, and call did_action to find out if the template hook fired or not. https://developer.wordpress.org/reference/functions/did_action/ did_action will return the number of times a hook/action has fired. With this you can return early in the footer action
The locate_template() function is intended to be used to locate/include template files, not functional files. Just use include() and/or require() to include functional files in functions.php.
I think I found it myself. Now I’ve successfully managed to add a /photos endpoint to a permalink URL, such as: http://mywordpressite.com/projects/a-project/photos And then a custom template, photos.php will load and show – with access to the global $post variable. Helpful links: http://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint http://codex.wordpress.org/Template_Hierarchy In my functions.php I added functions for the single_template and query_vars … Read more
Make a copy of press.php and rename it to home.php. The page you selected “Press” to be the designated page for your posts in the dashboard under, Settings > Reading > Posts Page: [Press] …now falls under the control of the template hierarchy as listed by Milo. First WordPress will look for the existence of … Read more
You should try and use the WordPress hierarchy instead of singe-cat-. Make your parent category template using category.php or category-{slug}.php , and then use the technique here, http://codex.wordpress.org/User:MichaelH/MyPlugins. Or for more options try this plugin, http://wordpress.org/extend/plugins/category-template-hierarchy/
You could create a custom post type post_templates. It should not be publicly queryable, and the admin only should be able to create or edit items. In your post editor you could then add a TinyMCE button/dropdown to let the editor select a template. Here is a very basic example plugin illustrating how to work … Read more
Selecting An image from the Media LIbrary on the frontend
The theme is set up so that if a sidebar is inactive, default content will be shown (search form, monthly archives, and meta). For example, the sidebar.php file: <?php /** * The Sidebar containing the main widget areas. * * @package WordPress * @subpackage Fruitful theme * @since Fruitful theme 1.0 */ ?> <div id=”secondary” … Read more
There’s filters for that. Example: add_filter( ‘template_filter’, ‘wpse_102706_filter_callback’, 10, 2 ); function wpse_102706_filter_callback( $defaults, $case ) { $args = wp_parse_args( array( ‘some_key’ => ‘some_modified_value’ ), $defaults ); return $args } Then in your template just add in the defaults: apply_filters( ‘template_filter’, array( ‘some_key’ => ‘default_val’ ), ‘single’ ); More info in Codex about the Plugins … Read more