wp_update_post on specific custom post type
You can stop executing the function if the post is not of a specific post type. You can use get_post_type() for this. if( ‘masters’ != get_post_type( $post_id ) ) return;
You can stop executing the function if the post is not of a specific post type. You can use get_post_type() for this. if( ‘masters’ != get_post_type( $post_id ) ) return;
Suggestion: move the data from the custom table into the wp_posts and wp_postmeta tables, as a custom post type. It will save you a lot of effort, in the long run.
The screenshot looks like a menu, here is how I would do it: Custom Taxonomy Add a new taxonomy for your products e.g. ‘Product Type’ ‘Product Section’ or ‘Product Category’. It’s tempting to assign post categories to that post type but it comes with other issues if you do that, so don’t. You’ll want to … Read more
This is because query_posts replaces the original query with a new one (which includes all the listed post types). For other reasons, you should not use query_posts! For your purposes you can use the pre_get_posts hook. This is fired before the database is queried for posts. The ‘main query’ is that which is determined by … Read more
Here is the actual code I use to resolve the initial need, this was taken for another question/answer an really works, the only thing I like to make is to put each position of the post of the column at the same row of the other term. <?php // for a given post type, return … Read more
As per what I have understood is you have a Custom Post type as event and user role like Secretary. Now if a Secretary logged in , he can only be able to see his own events added, not the other one. So if the above is correct so for that, we will use pre_get_posts … Read more
there was a big talk about that : http://core.trac.wordpress.org/ticket/12702 They ended deciding that a custom field will have to be used…
Replacing all the specific the_content() functions, or the_ID… etc by the getters equivalent seems to fix the problem. Here the solution: <?php $o = array(); $o[ ‘title’ ] = wp_title( ‘|’, false, ‘right’ ); $o[ ‘type’ ] = ‘single-project’; //ob_start(); $article=”<div id=”container” class=”content-area project-content”>”; $article .= ‘<main id=”main” class=”site-main” role=”main”>’; while (have_posts()) : the_post(); $article … Read more
You can try out the created_term hook: /** * Do ‘stuff’ when a term is created in the ‘country’ taxonomy * using info from the referred page * * @param integer $term_id * @param integer $tt_id * @param string $taxonomy * @return void */ function custom_created_term( $term_id, $tt_id, $taxonomy ) { $my_cpt=”packages”; // Edit this … Read more
Don’t run custom queries in the template to modify query parameters. The main query runs before the template is loaded, doing this is a waste of resources and introduces pagination issues, as you have discovered. Remove your custom WP_Query, restore the normal loop, and use pre_get_posts to modify query parameters before the query is run. … Read more