I have customers in one new custom post type. And in my posts is created one metabox with all customers (select option). Only need compare, what option select user and show all post by this customer with one shortcode.

Example: [news by="newcustomer"]



First get all data using

 $all_posts = get_posts( array( 'meta_key' => 'user_name_key' ,'meta_value'=>'your selected name from widget') );                                                                  
 foreach($all_posts as $post ){
      //add data whatever you want to display on website widget

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.