Tag Info

New answers tagged

2

You could use the filter theme_page_templates present since 3.9.0 like so: function my_theme_page_templates( $page_templates, $this, $post ) { $travel_blog_id = 2; $blog_id = get_current_blog_id(); if($blog_id != $travel_blog_id) { if(isset($page_templates['page-travel.php'])) { unset($page_templates['page-travel.php']); ...


1

If you want to toggle the editor "on the fly", you'll need to revert to a pure JavaScript solution, and only ever "visually" hide it (as opposed to removing it server-side): function wpse_189693_hide_on_template_toggle() { $screen = get_current_screen(); if ( $screen && $screen->id === 'page' ) : ?> <script> jQuery( ...


2

The rewrite rule already exists to handle those requests, it's for pagination of a single page post type. You can get the value of the page number with get_query_var('page'). You can render all pages with the same template by creating a page-{page-name}.php template file.


1

Have you tried is_front_page()? It should do what you're looking to do. Unless you've set up front-page.php with the Page Template commented header syntax that identifies the file is a Page Template, I don't think you can use the is_page_template() or get_page_template() functions. As for the category page, if you are loading category-foo.php, then aren't ...


0

For question as stated it would be easiest to retrieve page's slug and pass it as second argument: get_template_part( 'content', get_post_field( 'post_name', get_post() ) ); Note that you would want to have generic content.php for pages that don't have dedicated template (if any).


0

Usually the format you see in themes are content-{$post_format-term}.php or content-{$pagename}.php, but it is not restricted to this formats. The naming convention can also differ to your liking as long as you keep it out of normal template hierarchy and then use get_template_part to call it correctly. These are not self standing templates, they cannot ...


0

I know the feeling. I constantly have this battle between an archive slug and a static page called the same thing. i.e. Portfolio CPT archive and www.yoursite.com/portfolio page with editable content. I have two ways to accomplish this, both fairly hacky (which I hate): Create archive-{portfolio_cpt}.php archive template and include a static page template ...


0

I have had similar mysterious behaviour with CPTs and pretty permalinks. Try to regenerate your permalinks by switching to another structure and back again. Or check out flush_rewrite_rules() in the codex. https://codex.wordpress.org/Function_Reference/flush_rewrite_rules


1

On single custom post types using the single-course.php template I want a different breadcrumb option to happen is_page_template will not work on non-pages. If you're looking to tell if you're on a single custom post type page, you should use is_singular and pass in the custom post type name: if (function_exists('yoast_breadcrumb') && ...


1

You need to include is_page() in your if statement : <?php if ( function_exists('yoast_breadcrumb') && is_page() && !is_page_template( 'single-course.php' ) ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } else { ?> <p id="breadcrumbs"><span xmlns:v="http://rdf.data-vocabulary.org/#"><span ...


0

So, after all, it was a wordpress bug apparently... The problem is I was registering the following year taxonomy: register_taxonomy('year', array('project'), array( 'hierarchical' => true, 'labels' => array('name' => 'Anos', 'singular_name' => 'Ano'), 'show_ui' => true, 'public' => ...



Top 50 recent answers are included