Show all images attached to posts as a gallery page?

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 }

Using URL variables on a custom WP_Query

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

AJAX Post from same domain to a wordpress page

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