Limit the number of child pages

This is how I solved it: <?php /* Template Name: home */ get_header(); ?> <?php $counter = 1 ?> <div class=”row-fluid”> <?php $args = array( ‘child_of’ => 4, ‘parent’ => 0, ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’ ); $childrens = query_posts(‘showposts=3&post_parent=4&post_type=page&orderby=menu_order&order=DESC’); foreach ( $childrens as $children ) : query_posts(‘showposts=3&post_parent=”.$children->ID.”&post_type=page&orderby=menu_order&order=DESC’); if ( have_posts ) : while … Read more

Getting posts from some categories plus some individual posts

The problem here is that WP_Query requires the posts returned to be both in your lists of post IDs and in one of your categories. The SQL query generated by your code looks something like this: SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND wp_posts.ID IN (8200,3581,38,1562,7613) AND … Read more

Trying to query all posts in category 4

For your issue regarding only returning 20% of your posts, try the following <?php query_posts(‘cat=4&posts_per_page=-1’); ?> Note: By default, 10 posts are returned. -1 will return all posts in the resulting set. http://codex.wordpress.org/Function_Reference/query_posts#All_Posts_in_a_Category — For your question about passing through the Category Name, you can pass through the category_name as parameter, which accepts the category … Read more

Posts being viewed

I would suggest a way to implement this to be in the post template have a call that updates post meta with the current timestamp. Then you can show posts that have been viewed recently by querying meta data for all values within a certain time range ordered by that timestamp.

Query Multiple Custom Post Types & Exclude a Taxonomy Term

You should have a look at the arguments of WP_Query. The following arguments should be what you need. Note that tax_query takes an array of arrays. $args = array( ‘post_type’ => array( ‘post’, ‘videos’, ‘music’ ), ‘tax_query’ => array( array( ‘taxonomy’ => ‘content’, ‘field’ => ‘slug’, ‘terms’ => ‘indy’, ‘operator’ => ‘NOT IN’ ) ) … Read more

Trouble Making WP_Query paged

Pagination in URLs only works for the “main” query. What you’ve created is a secondary query, so WordPress doesn’t “know” about it in such a way that the application would be able to create pagination. If you use a secondary query (like your example) it’s up to you to do the pagination stuff manually. Rather … Read more

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