map_meta_cap woes
In the end I found this plugin that did the job in two seconds. http://wordpress.org/plugins/map-cap/ . I’m still curious to know how its done but I suppose I can always study the plugin.
In the end I found this plugin that did the job in two seconds. http://wordpress.org/plugins/map-cap/ . I’m still curious to know how its done but I suppose I can always study the plugin.
Go in your header.php and add the following snippet where you want your tag to appear: <?php if( ‘your-post-type’ === get_post_type() ){ print ‘<META NAME=”ROBOTS” CONTENT=”NOINDEX, NOFOLLOW”>’; } ?> get_post_type() will return the current post type.
@Milo Thanks, the pre_get-posts seems to work perfectly. I was missing that before, thought my choices were between wp_query and query_posts. The below should ONLY alter the query on the “rg_blog” custom post type archive, right? function blog_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_post_type_archive(‘rg_blog’)) { $query->set(‘post_type’, ‘post’); } } } add_action(‘pre_get_posts’,’blog_filter’);
Any suggestions on how to get the title of the first custom post type of ‘property’ with the term ‘Locked’ in the taxonomy ‘status’? $args = array( ‘post_type’ => ‘property’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘status’, ‘field’ => ‘slug’, ‘terms’ => ‘locked’ ) ) ); $your_query = new WP_Query( $args ); while ( $your_query->have_posts() … Read more
I worked it out myself.. The query I was looking goes like this: SELECT * FROM $wpdb->posts, $wpdb->term_relationships, $wpdb->term_taxonomy, $wpdb->terms WHERE ($wpdb->terms.name LIKE ‘%$s%’ OR $wpdb->terms.slug LIKE ‘%$s%’ OR $wpdb->posts.post_content LIKE ‘%$s%’ OR $wpdb->posts.post_title LIKE ‘%$s%’) AND $wpdb->posts.ID = $wpdb->term_relationships.object_id AND $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id AND $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id AND $wpdb->posts.post_status=”publish” AND $wpdb->posts.post_type=”products” ORDER BY $wpdb->posts.post_date … Read more
Custom post types support comments by default. I’m not sure how you registered your post type since you didn’t include the full source but the codex has good examples on how to do that. If the metabox is showing in your custom post type and you are trying to hide it you could click on … Read more
I know the community prefers coded answers rather than a plug-in alternative. Especially since alot of frontend dedicated plug-ins are bloated or fail to accomplish most users desires. But I would recommend a combination of Gravity forms, which is well supported and documented, this will give you or your client easily manageable front facing forms … Read more
First, you have to store your dates in a form that sorts properly mathematically. Unix timestamps will do that. The only human-like calendar format that does it is YYYY-MM-DD. You have your dates saved backwards. Assuming you store as YYYY-MM-DD, then this should work: $args = array( ‘meta_query’ => array( array( ‘meta_key’ => ‘ows_schedule_field-date’, ‘meta_value’ … Read more
It’s a matter of keeping a running total. Because I’m not 100% clear on the question, below I am providing the changes / pseudo-code for what you want to do: <?php if ( is_user_logged_in() ): global $current_user; get_currentuserinfo(); // ADDED: Initialize the total variable to prevent warnings $grandtotal = 0; $author_query = array(‘posts_per_page’ => ‘-1′,’author’ … Read more
I would recommend against updating both custom post types in this way. Ultimately, you would be storing the same information in the database in two different ways. Instead, pick one to be the master of this information. For example, let’s pick the vendor type. For each vendor, you could store (as post metadata) the product … Read more