WordPress CMS Inquiry
Why not have a Custom Post Type, “Product”, and then have custom taxonomies: Size Color This method will facilitate viewing (and querying) by any combination of Product, Size, and Color.
Why not have a Custom Post Type, “Product”, and then have custom taxonomies: Size Color This method will facilitate viewing (and querying) by any combination of Product, Size, and Color.
You need to add the following query argument: posts_per_page global $query_string; query_posts( $query_string . ‘&posts_per_page=10’ );
I am not sure about (1) but you will likely need to create your own metabox from scratch and replace native one with it. See add_meta_box() in Codex for starters. (2) to me seems to me as working against the system a bit. There is no point in hierarchy if your post belongs to whole … Read more
You need to use the meta_query parameter of the WP_Class when running a query. Something like this should point you in the right direction. $data = date(“Y-m-d”); $args = array( ‘post_type’ => ‘jogos’, ‘meta_query’ => array( array( ‘key’ => ‘data_de_lancamento’, ‘value’ => $data, ‘compare’ => ‘<=’ ) ), ‘meta_key’ => ‘views’, ‘orderby’ => ‘meta_value’, ‘order’ … Read more
I ran into this issue today. I don’t know if it’s the best way, but here’s how I solved it (with has_archive still set to true, of course): // First we remove WP default feed actions // If we stop here, feeds would be disabled altogether remove_action(‘do_feed_rdf’, ‘do_feed_rdf’, 10, 1); remove_action(‘do_feed_rss’, ‘do_feed_rss’, 10, 1); remove_action(‘do_feed_rss2’, … Read more
Use ‘capability_type’ & ‘capabilities’ when you register_post_type().
I had the same Error. It occured because I requested a post-type that didn’t existed. add_filter( ‘pre_get_posts’, ‘my_get_posts’ ); //events don’t exists function my_get_posts( $query ) { $query->set( ‘post_type’, array( ‘post’, ‘page’, ‘events’ ) ); return $query; }
So I dug into the source and discovered that even though the documentation STATES that $object_type is “required”, there’s nothing in the logic that makes this so. $object_type is just added to the properties of the tax object, which presumably is also done when you register the tax while creating the custom post, and also … Read more
Here’s an example that will list all the mobile_review posts that have the term htc_desire_hd in the taxonomy mobile_phone : $tax_query = array( ‘relation’ => ‘AND’ ); $tax_query[] = array( ‘taxonomy’ => ‘mobile_phone’, ‘terms’ => array(‘htc_desire_hd’), ‘field’ => ‘slug’ ); $args = array( ‘post_type’ => ‘mobile_review’, ‘tax_query’ => $tax_query ); $custom_loop = new WP_Query( $args … Read more
Wouldn’t ya know – 10 minutes or less since I asked my question and I’ve discovered the answer. I was attempting to define MY_PLUGIN_TEMPLATES using using plugins_dir_url(), now it looks like this and is working: define( ‘MY_PLUGIN_TEMPLATES’, dirname( __FILE__ ) . ‘/templates’ ); Thanks to mfields for the suggestion of dirname instead of WP_PLUGIN_DIR.