list child page items (1 level with meta keys)

See: https://stackoverflow.com/questions/1045439/wordpress-retrieving-post-children See: https://stackoverflow.com/questions/2572173/wordpress-showing-custom-data-from-child-pages-pagination See: https://stackoverflow.com/questions/3488628/wordpress-list-pages-with-children See: https://stackoverflow.com/questions/3780148/getting-wordpress-wp-list-pages-to-list-only-relevant-children-hard-as-hell See: https://stackoverflow.com/questions/1160047/wordpress-list-multi-level-parent-pages-when-on-a-3rd-level-child-page depth (integer) This parameter controls how many levels in the hierarchy of pages are to be included in the list generated by wp_list_pages. The default value is 0 (display all pages, including all sub-pages). 0 (default) Displays pages at any depth and arranges them hierarchically … Read more

quey posts from different categories with taxonomy

As Bloch commented, 3.1 provides a way to easily accomplish this. Here’s a terrific article describing exactly how to execute advanced taxonomy queries. Here’s the plugin to run the 3.1 beta. Here is some slightly modified code from an example in the advanced taxonomy queries article: $adcatquery = wp_parse_args( $query_string ); $adcatquery[‘tax_query’] = array( array( … Read more

query order by category

This should limit the posts pulled in the new WP_Query instance to the currently selected category or the first category of the current post. global $wp_query; $sidebar_query_vars = array(‘orderby’ => ‘rand’, ‘showposts’ => 12); if(is_category()) { $sidebar_query_vars[‘cat’] = $wp_query->get_queried_object()->term_id; } elseif (is_single()) { $categories = (get_the_terms($wp_query->get_queried_object_id(), ‘category’)); if(is_array($categories)) { $first_cat = array_shift($categories); $sidebar_query_vars[‘cat’] = $first_cat->term_id; … Read more

Modify WordPress SQL Query to pull from within a category

You need to make sure that the $currentcat variable is set before this query runs. This should be the id of the category you want to pull top posts from. $sql = “SELECT count(mr.post_ID) AS totHits, p.ID, p.post_title FROM $wpdb->posts p JOIN {$wpdb->prefix}kf_most_read mr ON mr.post_ID = p.ID JOIN {$wpdb->prefix}term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE … Read more

Show a Category X’s custom post type on Category X archive page?

I’d suggest adding something like this to the top of the theme file or wherever you want this content to appear in the archive, category or whatever.. // Check if it’s a category or taxonomy archive if( is_category() || is_tax() ) { // Grab the queried data, slug, tax, etc.. $queried = $wp_query->get_queried_object(); // Check … Read more

How to select posts from multiple categories and metavalues?

Since version 3.1 WP got much enhanced querying of custom fields. If I got the code right your query should be something like this: query_posts(array( ‘category__and’ => array(1,2,3), ‘meta_query’ => array( array( ‘key’ => ‘length’, ‘value’ => array($min_length, $max_length), ‘compare’ => ‘BETWEEN’, ‘type’ => ‘NUMERIC’, ), ), )); See: Function Reference/WP Query > Custom Field … Read more

sort posts by alphabetic plugin suggestion

Don’t know about a plugin but you can do that easily with query_posts() paste this two functions in your theme’s functions.php file function display_sort_links(){ ?> <div class=”sort_links”> <ul> <li><a href=”https://wordpress.stackexchange.com/questions/20830/?P_O=az”>A – Z</a></li> <li><a href=”?P_O=za”>Z – A</a></li> </ul> </div> <?php } function display_posts_numbers(){ ?> <div class=”number_links”> <ul> <li><a href=”?P_P=20″>20</a></li> <li><a href=”?P_P=40″>40</a></li> <li><a href=”?P_P=60″>60</a></li> <li><a href=”?P_P=-1″>All</a></li> </ul> … Read more

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