How do i add custom post types to this query?
showposts is replaced with posts_per_page (see Pagination Parameters). Also orderby value is invalid (see Order & Orderby Parameters). $queryObject = new Wp_Query( ‘posts_per_page=1&cat=23’ );
showposts is replaced with posts_per_page (see Pagination Parameters). Also orderby value is invalid (see Order & Orderby Parameters). $queryObject = new Wp_Query( ‘posts_per_page=1&cat=23’ );
Go to Settings->Permalinks Add this to Custom Structure: /%postname%/ Update WordPress generates .htaccess-files for this. Just go to your root and activate the show invisable files on your computer. Here is the htaccess for the structure: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d … Read more
Try WP_Query() instead of query_posts() $args = array( ‘posts_per_page’ => 10, ‘meta_key’ => ‘t_count’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ ); // The Query $the_query = new WP_Query( $args ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); echo ‘<li>’ . get_the_title() . ‘</li>’; endwhile; // Restore original Query & Post Data wp_reset_query(); wp_reset_postdata(); … Read more
what you could do is: 1. get the list of all posts currently on the page 2. grab all the IDs of the posts 3. do the following query: SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = ‘product_brand’ AND post_id IN (3,9,10,15) ORDER BY meta_value; where 3,9,10,15 are post ids that you’ve collected.
I doubt you’re going to find a function that created the exact output you’re using, so you’re probably looking at two nested called to get_terms(). I usually avoid most other taxonomy-related plugins in favor of get terms. Most of the other functions are wrappers for this one. Here’s some psuedo-code for what I’d do: <?php … Read more
function wpse81499_move_postcustom_to_top() { if( ‘post’ != get_current_screen()->id ) return; ?> <script> jQuery(document).ready(function(){ jQuery(‘#postcustom’).prependTo(‘#titlediv’); }); </script> <?php } add_action( ‘admin_footer’, ‘wpse81499_move_postcustom_to_top’ );
I decided to use the NextGEN Gallery instead of the default gallery, there is a few extra steps, but it’s not too bad. Thanks, Josh
actually I managed to solve this differently (and more elegantly). However, even this new approach had me banging my head against the wall for way too many hours as my option table didn’t get updated properly, when doing a bulk delete of more than one category. Turns out I made two – glaring mistakes . … Read more
function looks fine, $single = true might be causing your problem, replace it with true
Take a look at the arguments you’re passing to get_comments() and compare them to the documentation on the WordPress Codex. Your example – $args = array( ‘include’ => $postids, ‘meta_query’ => array( array( ‘key’ => ‘viewed_status’, ‘value’ => ‘unseen’ ) ), ‘count’ => true ); The codex example – $defaults = array( ‘author_email’ => ”, … Read more