send page ID’s to another template
send page ID’s to another template
send page ID’s to another template
You want to use get_page_templates function. See codex : https://developer.wordpress.org/reference/functions/get_page_templates/ get_page_templates(null, ‘your_post_type’);
Set page title in WordPress with PHP
wp_logout() not working after form submission
In my personal experience, WP template hierarchy has worked without problems – so no major bug here. However, it may still be, that your page-$id.php is not used. This is usually the case, when the link could be multiple things. Archives for example have priority over regular pages. Best is to check the CSS classes … Read more
Okay, so after some more tinkering, I found another solution. This one works with or without the loop. So adding it in the template file or your single.php is fine, in the <head> of the HTML. <?php $tags = get_the_tags($post->ID); ?> <?php foreach($tags as $tag) : ?> <meta property=”article:tag” content=”<?php print_r($tag->name);?>” /> <?php endforeach; ?> … Read more
I had a similar problem, and posted the question here Using Includes in Templates in Document Head . And I figured out the solution is to use get_template_part(). From my answer (which I checkmarked as correct; the other answer didn’t work): The key is to use the get_template_part in your Template at the beginning (after … Read more
Have WordPress (which creates the web server responses) respond with a redirect (via a call to wp_redirect()). Put as the first thing in header.php global $post; if( needs_replacement( $post ) ) { $from_url = create_url( $post ); wp_redirect( $from_url ); exit(0); } require_once( get_template_directory() . ‘/page.php’ ); ?> (Note that you have to this first … Read more
You are getting a ‘page not found’ because it is exactly that, not found. What you can do is create a page, for instance, called ‘locations’ then set it up like this example.com/locations/the-hamptons => index.php?page_id=[id_of_locations]&filter=the-hamptons
You can override the hierarchy and load a specific page template via the page_template filter. The fastest way is to identify the parent page by ID: function wpd_page_template_filter( $template ){ $page = get_queried_object(); if( 42 == $page->post_parent ){ // en page has ID of 42 $template = locate_template( ‘page-en.php’ ); } return $template; } add_filter( … Read more