How to display products sort by Tags for Woocommerce

I have tried to display products by tags on shop page, i found this code and it workes perfectly

            $  args = array(                 'number'     => $  number,                 'orderby'    => 'title',                 'order'      => 'ASC',                 'hide_empty' => $  hide_empty,                 'include'    => $  ids             );             $  product_tags = get_terms( 'product_tag', $  args );             $  count = count($  product_tags);             if ( $  count > 0 ){                 foreach ( $  product_tags as $  product_tag ) {                     echo '<h4>' . $  product_tag->name . '</a></h4>';                     $  args = array(                         'posts_per_page' => -1,                         'tax_query' => array(                             'relation' => 'AND',                             array(                                 'taxonomy' => 'product_tag',                                 'field' => 'slug',                                 // 'terms' => 'white-wines'                                 'terms' => $  product_tag->slug,                                 'product_tag'=> "latest-product"                             )                         ),                         'post_type' => 'product',                         'orderby' => 'title,'                     );                     $  products = new WP_Query( $  args );                     woocommerce_product_loop_start();                     while ( $  products->have_posts() ) {                         $  products->the_post();                         do_action( 'woocommerce_shop_loop' );                         wc_get_template_part( 'content', 'product' );                         ?>                                                      <?php                     }                     woocommerce_product_loop_end();                 }             }          ?> 

But when I tried to filter resaults it wont apply filters, by the way i m using Annasta Filter Plugin


How to display a simulator for shipping rate by size, weight and location on the frontpage?

I would like to know if there is a plugin I can use to display a simulator on the frontpage. In my platform, I just take care of forwarding packages that my clients have already purchased on other platforms that doesn’t deliver to them (outside the us). I need to give my clients a quote (on the frontpage), based on size, weight and address, so they know much they should pay if they use my service. Currently, I use UPS for the delivery. I think the plugin should use an api call so I can get the correct price (negotiated price UPS), add my marge and give the quote. I hope I am understandable.

Thank you very much for your help

Display Custom Fields Meta Box on Category, Tags and CPT

I want to Add Custom Field on All Tags, Category and Custom Post Type (Taxonomy) but with below code get custom field option only on All Category. How to get on All Tags, Categories and CPT Taxonomy as well?

function wecode_category_fields($  taxonomies) {          if (current_filter() == 'category_edit_form_fields') {               $  Pincode = get_term_meta( $  taxonomies->term_id, 'Pincode', true );               ?>                  <tr class="form-field">         <th valign="top" scope="row"><label for="Pincode"><?php _e('Pincode'); ?></label></th>            <td>               <input type="text" size="40" value="<?php echo esc_attr( $  Pincode ) ? esc_attr( $  Pincode ) : ''; ?>"  name="Pincode"><br/>                   <span class="description"><?php _e('Please enter your Pincode'); ?></span>            </td>         </tr>                     <?php } elseif (current_filter() == 'category_add_form_fields') {             ?>              <div class="form-field">                 <label for="Pincode"><?php _e('Pincode'); ?></label>                 <input type="text" size="40" value=""  name="Pincode">                 <p class="description"><?php _e('Please enter your Pincode'); ?></p>             </div>                 <?php         } }          add_action('category_edit_form_fields', 'wecode_category_fields', 10, 2);     add_action('category_add_form_fields', 'wecode_category_fields', 10, 2);           function wecode_save_category_fields($  term_id) {         if ( isset( $  _REQUEST['Pincode'] ) ) {              $  Pincode = $  _REQUEST['Pincode'];                                   update_term_meta( $  term_id, 'Pincode', $  Pincode );            }  }     add_action('edited_category', 'wecode_save_category_fields', 10, 2);     add_action('create_category', 'wecode_save_category_fields', 10, 2);  

Display page and custom post title inside shortcode

I trying to write shortcode to display page title but only got the archive title to work but not custom post type category and single post. Can anyone shed light how to do this? Reason for going this path is Elemenentor theme builder generate too much code for simple page title and subheading inside secondary header that is masked wrap around image. I use the shortcode widget to insert the code and style it.

So far this is what I have written:

// Page Title inside shortcode function page_title_sc( ) {     $  title = ('Page Title');     if ( is_post_type_archive() ) {     $  title = post_type_archive_title( '', false );   }   elseif ( is_page() ) {     $  title = single_post_title();    }     return apply_filters( 'page_title_sc', $  title ); }   add_shortcode( 'page_title', 'page_title_sc' ); 

Get all Gravity Form entry IDs for current user and display the highest value

I have a Gravity Form with a user registration plugin installed, so every time someone completes the form, they are added as a user and the submitted form is assigned an entry ID which is linked to that user. But whenever a user re-submits the form a new entry ID is created – there is a column in the "wp_gf_entry" table called "created_by" which contains the user ID for who submitted the form. So I figured I need to find currently logged in user ID, match it against the "created_by" column then find the highest value entry ID for that user, which I will then need to display in a shortcode.

I have figured out how to find the initial entry ID which is linked to the users meta details and display that inside the shortcode, see below.

  $  user_id = get_current_user_id();   $  key = 'entry_id';   $  single = true;   $  gform = get_user_meta( $  user_id, $  key, $  single );     echo do_shortcode('[gravitypdf id="5ffc7508269e7" entry="' . $  gform . '" text="Download"]'); 

This would work great if the entry ID got updated every time the user re-submits the form, as the entry ID would always stay the same, but a new entry ID gets created for every form submission.


That led me to searching for another solution which would update the same entry every time the user re-submitted the form, but I was at a lose and could only find the following gform_entry_id_pre_save_lead which after testing wouldn’t work for me and a new entry was created each time.

Ideally I would prefer the first solution, just in case the user needs to access an older entry. Although its not essential so all suggestions and possible solutions are welcome.

I’m relatively new to PHP, but feel like the solution Is not far away and feel like the use of the foreach loop and the max() function will help with looping through the array of entry IDs for current user and finding the max value in that array…I just can’t figure out how to get there with code!

Any help would be appreciated.

Display Posts that fit a certain criteria on Category pages

I wish to display posts that fit a certain criteria on a category page. Something like a search filter applied, to several such category pages.

For example, to display all movies by Chris Pratt that grossed over 10 million dollars. Or All movies with Chris Pratt and Zoe Saldana, etc.

How / where would I have to look for a good tutorial on how to do the same?

Would it go into the realms of custom fields with custom taxonomies? Please advise if possible.

Is there WordPress plugin that allow to create alerts in comments and display them in specified page? [closed]

I’m looking for a plugin (free or paid) that allows to add specified field to comment – lets’s say alert field. When user with specified role eg. contributor will select this field new comment will be create with alert.

When an alert is created in a custom post type it will trigger the alert icon – the alert icon will link to the alerts page (alerts will send to all controbutors roles). This page will show all the alerts and comment threads. Here you will be able to view the different alerts, edit, comment, and disable alerts.

Any ideas?

Thanks in advanced!

Display images that are not in the content

The function below returns all the images attached to the post, however, if I delete the image inserted into the content, it still returns in the function, because the media is still as attached to the post.

So, how do I really bring only the images inserted in the content of the post?

<?php  $  args = array(         'post_type'   => 'attachment',         'posts_per_page' => -1,         'post_mime_type' => 'image',         'post_parent' => $  post->ID,     );      $  attachments = get_posts( $  args );      if ( $  attachments ) {          foreach ( $  attachments as $  attachment ) {              echo wp_get_attachment_image( $  attachment->ID, false );             echo '<hr>';             echo '<br>';          }     } ?> 

Create a custom display order in the main menu

I have main menu which displays two types of links: CPT and Subcategory. I create the menu with a custom request: I retrieve the Custom Post Type then the sub-categories of the main category in Alphabetical order :

Category A: - Product a - Product b - sub category a - sub category b ... 

But, my client wants a custom display example:

Category A: sub category a - Product b - Product a - sub category b ... 

I thought about creating a Drag Drop solution … but how to implement it