ehsanmn
Forum Replies Created
-
Forum: Plugins
In reply to: [Easy Table of Contents] in taxonomy pages links not scroll correctlyIt Solved
thanks you for this good plugin and best support
Forum: Plugins
In reply to: [Easy Table of Contents] show toc in custom taxonomy pagethis is my page link :
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
thanks for good support
Forum: Plugins
In reply to: [WP Popular Posts] exclude attachments fromthis is my 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
In reply to: [WP Popular Posts] exclude attachments fromI 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.
I solved it by using : https://connekthq.com/plugins/ajax-load-more/docs/filter-hooks/#alm_query_args
Thanks for good support
- This reply was modified 2 years, 1 month ago by ehsanmn.
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
this is a working WP Query, this code first get all post IDs of a category, then show attachments of that posts.
<?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 } } ?>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.
[ajax_load_more post_type="attachment" custom_args="post_parent:50" post_status="inherit" preloaded="true"]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 :
<?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!
<?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
In reply to: [WP Popular Posts] how change posts_status from published to anyThank you, problem solved with this code
- This reply was modified 3 years, 9 months ago by ehsanmn.