Next & Previous (Pagination in this case) Not Appearing

<?php /* Template Name: Portfolio */ ?> <?php get_header(); ?> <div id=”full_container”> <div id=”portfolio_content”> <div id=”portfolio_wrap”> <div id=”content”> <?php $loop = new WP_Query(array(‘post_type’ => ‘portfolio’, ‘posts_per_page’ => 2)); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php $custom = get_post_custom($post->ID); $screenshot_url = $custom[“screenshot_url”][0]; $website_url = $custom[“website_url”][0]; ?> <a href=”https://wordpress.stackexchange.com/questions/30616/<?php the_permalink() ?>”> <span class=”img”> <?php … Read more

Query posts from different categories in multisite

For restricting the categories, maybe the plugin Restrict Categories can help. But it doesn’t have Multisite capabilities. Take a look at the filter list_terms_exclusions that it uses in the cat_filter function. But Role Scoper states that it has “Extensive WP-mu support”. May be worth a try. For the query part, take a look at this … Read more

Page navigation doesn’t show when query category

I found a partial workaround. Since the query object in the index.php is the right one I transferred it using serialize to template of choice, in this case category-video.php. In index.php i put on top <?php $s = serialize($wp_query); file_put_contents(‘query’,$s); ?> and in category-video.php I put <?php $u = file_get_contents(‘query’); $wp_the_query = unserialize($u); ?> It’s … Read more

Get ID of child from child slug, while knowing parent ID

You should use the pagename parameter for WP_Query along with post_parent. Limit your query to one post using posts_per_page. $parent_id = get_the_ID(); $args = array( ‘post_type’ => ‘page’ ‘pagename’ => ‘page-2’, ‘post_parent’ => $parent_id, ‘posts_per_page’ => 1 ); $posts = get_posts( $args ); $child = isset( $posts[0] ) ? $posts[0] : false; if( $child ){ … Read more

How to do a query on custom taxonomies that is uncategorised?

Okay thanks for all the helpful comments. It turns out there is no way to do this using WP_QUERY alone. The best way I can think of is to do it is like so: $taxIds = get_terms($options[‘post-types’][$this->current_post_type->name], array( ‘fields’ => ‘ids’, )); $uncategorisedQuery = new WP_Query( array( ‘post_type’ => $postType, ‘posts_per_page’ => -1, ‘tax_query’ => … Read more

Calculating Bayesian average for custom post type

This is the (updated) code I’m using, which gives results like I’d expect: $args = array( ‘post_type’ => ‘entry’, ‘orderby’ => ‘bayesian_average’, ‘order’ => ‘DESC’, ‘post_status’ => ‘publish’ ); $loop = new WP_Query($args); $number_of_entrants = $loop->post_count; $total_ratings = $total_num_votes = 0; foreach ($loop->posts as $query_post) { $count = $query_post->ratings_count; $average = $query_post->ratings_average; $total_num_votes += $count; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)