“post-name” Renders Using page.php, but “post-name-2” renders with single.php
Without having access to your admin, I’d have to assume you have a page with the slug “claudia-lucero” – in addition to your post.
Without having access to your admin, I’d have to assume you have a page with the slug “claudia-lucero” – in addition to your post.
Create page template with this code : $args = array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1 ); $query = new WP_Query( $args); if($query->have_posts()){ //check if found any attachment while($query->have_posts()){ //loop $query->the_post(); //you can add your code here } }else{ // if found NO posts }
Custom Page Templates for a complex application – code must sit in a plugin and not the Theme
WordPress doesn’t handle this logic qutomatically so you will have do do it manually. What you need to do is: Read the url parameter with get_query_var( ‘category_name’ ); injects it in your custom WP_Query: $custom_query_args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘post_format’, ‘field’ => ‘slug’, ‘terms’ => … Read more
is_page_template wont allow me to enqueue scripts
First, WordPress has a built-in way to handle AJAX requests, you should read this page and use that method instead. The issue with your method is that you’re POSTing the name var. name is a WordPress query var, and is causing WordPress to query for a page with slug John. Always prefix your vars with … Read more
I found where problem was – i can’t set other year. All i needed to do is to rename year parameter to something else – for example my_year.
To determine the best filter to use, you have to determine what those pages are. Is is_page() true? Use the page_template filter. Is is_post_type_archive() true? Use the archive_template filter. All of the query type-specific template filters are listed here. You can also use the generic template_include, which fires for all types. Within any of these … Read more
I recommend bookmarking this Image from Wordpres Codex Template Hierarchy As you can see on it Blogs page uses home.php as template while front page is using front-page.php.
Do you want to add this template via a plugin or using the theme? If you want to use the theme you need several things: The PHP file which will be responsible for the page. The file itself can be named in two ways: page-{slug}.php or page-{id}.php. Here is an explanation what each one of … Read more