Title: ehsanmn's Replies | WordPress.org

---

# ehsanmn

  [  ](https://wordpress.org/support/users/ehsanmn/)

 *   [Profile](https://wordpress.org/support/users/ehsanmn/)
 *   [Topics Started](https://wordpress.org/support/users/ehsanmn/topics/)
 *   [Replies Created](https://wordpress.org/support/users/ehsanmn/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/ehsanmn/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/ehsanmn/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/ehsanmn/engagements/)
 *   [Favorites](https://wordpress.org/support/users/ehsanmn/favorites/)

 Search replies:

## Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Easy Table of Contents] in taxonomy pages links not scroll correctly](https://wordpress.org/support/topic/in-taxonomy-pages-links-not-scroll-correctly/)
 *  Thread Starter [ehsanmn](https://wordpress.org/support/users/ehsanmn/)
 * (@ehsanmn)
 * [6 months, 3 weeks ago](https://wordpress.org/support/topic/in-taxonomy-pages-links-not-scroll-correctly/#post-18757126)
 * It Solved
 * thanks you for this good plugin and best support
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Easy Table of Contents] show toc in custom taxonomy page](https://wordpress.org/support/topic/show-toc-in-custom-taxonomy-page/)
 *  Thread Starter [ehsanmn](https://wordpress.org/support/users/ehsanmn/)
 * (@ehsanmn)
 * [7 months, 2 weeks ago](https://wordpress.org/support/topic/show-toc-in-custom-taxonomy-page/#post-18722374)
 * this is my page link :
 * [https://pipex-co.com/product-cat/%d9%84%d9%88%d9%84%d9%87-%d9%be%da%a9%d8%b3-%d9%87%d9%88%d8%b4%d9%85%d9%86%d8%af/](https://pipex-co.com/product-cat/%d9%84%d9%88%d9%84%d9%87-%d9%be%da%a9%d8%b3-%d9%87%d9%88%d8%b4%d9%85%d9%86%d8%af/)
 * I Think its solved in last update of plugin, before that I add shortcode to this
   page and didnt worked, but now I add this shortcode and it worked.
 * thanks a lot
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Popular Posts] get the LEAST popular posts from specific category (or except category)](https://wordpress.org/support/topic/get-the-least-popular-posts-from-specific-category-or-except-category/)
 *  Thread Starter [ehsanmn](https://wordpress.org/support/users/ehsanmn/)
 * (@ehsanmn)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/get-the-least-popular-posts-from-specific-category-or-except-category/#post-17881439)
 * thanks for good support
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Popular Posts] exclude attachments from](https://wordpress.org/support/topic/exclude-attachments-from/)
 *  Thread Starter [ehsanmn](https://wordpress.org/support/users/ehsanmn/)
 * (@ehsanmn)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/exclude-attachments-from/#post-17697404)
 * this is my code :
 *     ```wp-block-code
                           <?php
                               $amir_query = array (
                                   'range' => 'custom',
                                   'time_quantity' => 1,
                                   'time_unit' => 'hour',
                                   'order_by' => 'views',
                                   'post_type' => 'attachment',
                                   'limit' => 3,
                                   'pid' => '4346',
                                   'thumbnail_width' => 75,
                                   'thumbnail_height' => 75,
                                   'stats_views' => 1,
                                   'post_html' => '
                                       <div class="post"><figure class="post-thumb"><a href="{url}">{custom_thumb}</a></figure><div class="post_title"><h5><a href="{url}">{title}</a></h5></div></div>
                                   ',
                                   );
                                   if (function_exists('wpp_get_mostpopular'))
                                   wpp_get_mostpopular($amir_query);
                           ?>
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Popular Posts] exclude attachments from](https://wordpress.org/support/topic/exclude-attachments-from/)
 *  Thread Starter [ehsanmn](https://wordpress.org/support/users/ehsanmn/)
 * (@ehsanmn)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/exclude-attachments-from/#post-17685873)
 * I tested that with Both the parent post ID and attachment ID, but its not working.
 * I think because **pid** is for post_type=posts and does not work for attachments.
 * for showing attachments with **wpp_get_mostpopular** I added a snippet code to
   functions.php to show items that have inherit post_status (like attachments)
 * `function wp8762_include_inherit_status( $where, $options ) {
   return $where ."
   OR p.post_status = 'inherit'";}add_filter( 'wpp_query_where', 'wp8762_include_inherit_status',
   10, 2 );
 * I think need a snippet code like this to add **pid** parameter for attachment
   IDs too.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ajax Load More – Infinite Scroll, Load More, & Lazy Load] listing attachments of a category?](https://wordpress.org/support/topic/listing-attachments-of-a-category/)
 *  Thread Starter [ehsanmn](https://wordpress.org/support/users/ehsanmn/)
 * (@ehsanmn)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/listing-attachments-of-a-category/#post-17524193)
 * I solved it by using : [https://connekthq.com/plugins/ajax-load-more/docs/filter-hooks/#alm_query_args](https://connekthq.com/plugins/ajax-load-more/docs/filter-hooks/#alm_query_args)
 * Thanks for good support
    -  This reply was modified 2 years, 3 months ago by [ehsanmn](https://wordpress.org/support/users/ehsanmn/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ajax Load More – Infinite Scroll, Load More, & Lazy Load] listing attachments of a category?](https://wordpress.org/support/topic/listing-attachments-of-a-category/)
 *  Thread Starter [ehsanmn](https://wordpress.org/support/users/ehsanmn/)
 * (@ehsanmn)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/listing-attachments-of-a-category/#post-17523550)
 * I used ‘post_parent_in’ and its not working. And of course I tried a few other
   solutions, none of them worked!
 * I think it may not be possible to do this with alm
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ajax Load More – Infinite Scroll, Load More, & Lazy Load] listing attachments of a category?](https://wordpress.org/support/topic/listing-attachments-of-a-category/)
 *  Thread Starter [ehsanmn](https://wordpress.org/support/users/ehsanmn/)
 * (@ehsanmn)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/listing-attachments-of-a-category/#post-17519298)
 * this is a working WP Query, this code first get all post IDs of a category, then
   show attachments of that posts.
 *     ```wp-block-code
       <?php 
       // get all posts of a certain category
       $query = new WP_Query( 
           array( 
               'cat' => 42,
               'posts_per_page' => -1,
               'fields' => 'ids'
           ));
       // get all attachments of posts form previous query and show them
       $image_query = new WP_Query( 
           array( 
               'post_type' => 'attachment',
               'post_status' => 'inherit',
               'post_parent__in' => $query->posts,
               'posts_per_page' => 10,
           ));
       if( $image_query->have_posts() ){
       while( $image_query->have_posts() ) {
       $image_query->the_post();?>
       	<?php $imgurl =  wp_get_attachment_image($image->ID, 'thumbnail');
       	 echo '<a style="display:inline-block;" href="';
       	 echo get_permalink();
       	 echo '">';
       	 echo $imgurl;
       	 echo '</a>';?>
       <?php } } ?>
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ajax Load More – Infinite Scroll, Load More, & Lazy Load] listing attachments of a category?](https://wordpress.org/support/topic/listing-attachments-of-a-category/)
 *  Thread Starter [ehsanmn](https://wordpress.org/support/users/ehsanmn/)
 * (@ehsanmn)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/listing-attachments-of-a-category/#post-17519282)
 * thanks but it doesn’t help.
 * below shortcode show attachments of a specific post, is there a way to add multiple
   ids to this code?
 * for example “post_parent:50,51,52” instead of “post_parent:50”, if Found a solution
   for this probably my problem will solved.
 *     ```wp-block-code
       [ajax_load_more post_type="attachment" custom_args="post_parent:50" post_status="inherit" preloaded="true"]
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ajax Load More – Infinite Scroll, Load More, & Lazy Load] listing attachments of a category?](https://wordpress.org/support/topic/listing-attachments-of-a-category/)
 *  Thread Starter [ehsanmn](https://wordpress.org/support/users/ehsanmn/)
 * (@ehsanmn)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/listing-attachments-of-a-category/#post-17519133)
 * Of course, I followed a path, but I did not reach the result, first I get all
   post IDs of a category with this code :
 *     ```wp-block-code
       <?php 
       $cat_posts = get_posts(array(
           'category' => 42,
           'numberposts' => -1
       ));
       $parent_ids = array_map('get_post_ids', $cat_posts);
       function get_post_ids($post_obj) {
           return isset($post_obj->ID) ? $post_obj->ID : false;
       }
   
       ?>
       ```
   
 * and then I add $parent_ids to shortcode, but its not work!
 *     ```wp-block-code
       <?php echo do_shortcode('[ajax_load_more posts_per_page="12" post_type="attachment" custom_args="post_parent:'.$parent_ids.'" post_status="inherit"]'); ?>
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Popular Posts] how change posts_status from published to any](https://wordpress.org/support/topic/how-change-2/)
 *  Thread Starter [ehsanmn](https://wordpress.org/support/users/ehsanmn/)
 * (@ehsanmn)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/how-change-2/#post-15888476)
 * Thank you, problem solved with this code
    -  This reply was modified 3 years, 11 months ago by [ehsanmn](https://wordpress.org/support/users/ehsanmn/).

Viewing 11 replies - 1 through 11 (of 11 total)