Query recent posts by author
Query recent posts by author
Query recent posts by author
Output during saving You can not print something during the data is saved. If you use die( var_dump( $your_var ) ); it will print the values, but also stops the script. The reason is, first the data will be parsed. Then you will be redirected back to profile.php. So everything you print while parsing the … Read more
Post thumbnail size for custom field only
Custom fields are not intended as grouping mechanism, they are suited for data that can have wildly different values that are not group like. For example product weight would be a good candidate since it can wildly vary and typically there is no interest in grouping like “show me all products that weight 200g”. For … Read more
I think something like this you would be best writing yourself. Take a look at: http://www.catalysthomes.co.uk/homes-for-sale/ Properties are loaded into a CPT and I have my own custom search in the sidebar. Of that search its searching a number of things such as taxonomies, custom fields and ordering by date price etc. So how do … Read more
How to allow user to add to, but not edit, a post?
Complex WP_Query Using Post Date And Post Meta
If i understand the question correctly, you want that whenever a user adds a new post, all his/her previous posts should be deleted. I wonder why would you do that!! 🙂 But anyway, you can use this code. add_action(‘save_post’, ‘delete_prev_posts_by_user’, 10, 2 ); function delete_prev_posts_by_user( $post_id, $post ){ if( ‘publish’ == $post->post_status ){ $the_special_category_id = … Read more
Here’s a piece of code similar to what I have used to fix the problem once imported the data: <?php define(‘MY_METABOX_ID’, ‘my_metabox_id’); define(‘MY_METABOX_PREFIX’, ‘my_metabox_prefix_’); define(‘MY_CUSTOM_POST_TYPE’, ‘my_custom_post_type’); // Include WordPress define(‘WP_USE_THEMES’, false); define(‘WP_DEBUG’, 1); require_once(‘../wp-load.php’); // extract all MY_CUSTOM_POST_TYPE posts $q = new WP_Query(‘post_type=” . MY_CUSTOM_POST_TYPE . “&nopaging=true’); // for each post while($q->have_posts()) { $q->next_post(); $p … Read more
Our solution to this was to use Formidable Pro and the following setup. //************************************************** // Generate the contest form //************************************************** // Determin if radio or not add_filter(‘frm_field_type’, ‘change_my_field_type’, 10, 2); function change_my_field_type($type, $field){ global $post; if($field->id == 8){ if (get_post_meta($post->ID, ‘_cmeta_contest_q1_type’, true) !== ‘field’) { $type=”radio”; //change field to radio on multi-answer questions } else … Read more