New answers tagged

2

We can make use of the page_template filter to achieve this. All we need to do is to make sure that confirmation is the first word in the page page title add_filter( 'page_template', function ( $template ) { // Get the current page object $post = get_queried_object(); /** * Get the first instance of confirmation, if it is not 0, bail ...


0

$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; if (strpos($url,'confirmation') == true) { include(locate_template('page-confirmation.php')); } I managed to come up with this solution, not very elegant though as this code needs to be put into default page.php, I would prefer a filter of some sort that does this dynamically.


0

the last $file takes priority over the previous That's because you assign the new value to the $file variable at every line. The only way I see you can do it by using the array: <?php // define directory list $directories = array( 'home', 'pages', 'blog', 'single-posts', 'products', 'templates', 'products' ); // run ...


0

It turns out the Wordpress permalink structure works perfectly well for custom types, e.g. example.com/recipes/lunch/sandwich/. This works exactly as expected if you set 'hierarchical' => true. What I was originally trying to do was unnecessarily difficult to execute, and requires properly setting up a custom permalink structure to avoid 404 errors. I ...


0

Create a blank page and name it panel then go to your created signup template and select parent page panel. Its just below Publish->Page Attributes. /*Add noindex to this page (Add to functions.php)*/ function add_noindex_tags(){ # Add noindex to page. if( is_page('panel') ) echo '<meta name="robots" content="noindex,nofollow">'; } ...


0

I wrote this as a comment, but should have put it here. The problem was that my templates were in a folder in my theme called "templates" I found this out by doing: wp post meta list post_name="post-name" and is showed that it is in the folder templates. Then I changed the above code to wp post create --post_type=page ...


0

there is no need to handle the pagination like this: $paged = get_query_var( 'paged', 1 ); Just put this after the loop: get_the_posts_pagination( 'mid_size' => 1, 'prev_text' => '&nbsp;', 'next_text' => '&nbsp;', 'screen_reader_text' => 'A' ) like this: if( have_posts() ){ ...


0

Custom Archive Page What you're describing is a custom archive page. https://www.google.com/search?q=custom+archive+page https://codex.wordpress.org/Creating_an_Archive_Index Child Theme Forget widgetised areas. They're not necessary based on what you described. Simply fork (copy and manipulate) your archives template page by using using a child theme ...



Top 50 recent answers are included