Passing a varible from jQuery to PHP

First, don’t use query_posts. Second… I think this can be done with AJAX but is there a more simple method and give me a clean URL? PHP runs on the server. Items are “clicked” on the client machine. The only way to pass that “clicked” value back to PHP is via AJAX. Within a WordPress … Read more

WordPress /page/2 not working

Don’t use query_posts, ever. The first 6 queries can be condensed to a single WP_Query: $args = array( ‘cat’ => 3598, ‘posts_per_page’ => 6 ); $featured = new WP_Query( $args ); if( $featured->have_posts() ){ $featured->the_post(); ?> your markup for the first post <?php $featured->the_post(); ?> your markup for the second post <?php $featured->the_post(); // etc.. … Read more

Query a WordPress page by its title (which has a parent page)

You are almost there—but please, use WP_Query. $args = array( ‘pagename’ => ‘features’, ‘post_parent’ => PARENT-PAGE-ID-HERE, ); $query = new WP_Query($args); if ($query->have_posts()) : $query->the_post(); // … wp_reset_postdata(); endif; // EDIT: If you don’t want to or cannot use the parent page’s ID, you can access it by its title, for instance like so: ‘post_parent’ … Read more

Display an author’s posts on his own author page

You can simply use the default author.php page to do this. If you don’t have one, make a copy of index.php and rename it author.php Now, use pre_get_posts to include your custom post type in the author pages. This code goes in functions.php function cpt_on_author_page( $query ) { if ( !is_admin() && $query->is_author() && $query->is_main_query() … Read more