Pagination not working on homepage

This is my working pagination query. I’ve updated it to use the parameters in your question: <?php if ( get_query_var(‘paged’) ) { $paged = get_query_var(‘paged’); } else if ( get_query_var(‘page’) ) { $paged = get_query_var(‘page’); } else { $paged = 1; } $args = array( ‘post_type’ => array(‘post’, ‘music’, ‘videos’), ‘post_status’ => ‘publish’, ‘posts_per_page’ => … Read more

Query Custom Post Type and sort by year

You don’t need to create a page template to list the project post type, just go to /project/ and you’ll have a full date ordered listing. The template powering that page will be determined as follows: archive-project.php archive.php index.php So create an archive-project.php in your theme. Using this you can specify to list only the … Read more

Generating custom URL before post is published

I think the post needs to be inserted first. This is a sample function that updates the post slug after it’s been inserted. // Update post slug $my_post[‘ID’] = $pid; $my_post_name=”post_name” . “-” . $pid; $my_post[‘post_name’] .= $my_post_name; // Update the post into the database wp_update_post( $my_post ) It’s combining the post_name with post ID … Read more

loop through custom post-type with two meta_keys

You’ll need to use meta_query along with meta_(key|value|compare) to interact with two different keys and get the order you want. <?php $q = new WP_Query(array( ‘post_type’ => ‘my_project’, ‘nopaging’ => true, // same as posts_per_page => 1, ‘order’ => $order, ‘orderby’ => ‘is_featured_position’, // your position key here ‘meta_key’ => ‘is_featured_position’, // also here, see … Read more