<?php
defined( 'ABSPATH' ) || exit;
get_header( 'shop' );
do_action( 'woocommerce_before_main_content' );
?>
<header class="woocommerce-products-header">
<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
<h1 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h1>
<?php endif; ?>
<?php
do_action( 'woocommerce_archive_description' );
?>
</header>
<?php
do_action( 'woocommerce_before_shop_loop' );
echo do_shortcode('[products limit="20" columns="4"]');
do_action( 'woocommerce_after_shop_loop' );
do_action( 'woocommerce_after_main_content' );
do_action( 'woocommerce_sidebar' );
get_footer( 'shop' );
The issue now is that it show the same products in the product archives, no matter what category i open. I have searched through the forums but cant find how to show the products from the current category.
Thank you
Have not tryed your plugin yet. But I looking for special feature.
I need to show recent posts only for category (include all childs) of the current post (just its main category). This means list of recent posts will be different for posts from different categories.
I don’t see this in features of your plugin. But looks like I can do this with rpwe_default_query_arguments filter, correct?
Something like this?
add_filter( 'rpwe_default_query_arguments', 'rpwe_change_category' );
function rpwe_change_category( $args ) {
$args['cat'] = $current_cat_id;
return $args;
}
Is arg name correct?
]]>Recent Posts Widget With Thumbnails 7.1.1
Just tested your plugin and very like it at all, but need special function.
I need to show recent posts only for category (include all childs) of the current post (just its main category). This means list of recent posts will be different for posts from different categories.
Can I do this with your plugin without directly editing its code?
I didn’t find this in options. But maybe I can use any hooks for that?
I know about the child_of parameter, and I wonder if it’s possible to use something like “current” as a placeholder.
What I actually need is a way to only show tags of the current category, because it makes more sense for visitors to drill down their selection that way.
Is this already possible, or would it be feasible to implement for future versions?
Regards
]]><?php $category_id = get_cat_ID( 'Category Name' ); ?>
<?php query_posts("cat=$category_id&showposts=1"); ?>
]]>li.current-cat a {
font-weight:bold;
}
but it doesn’t work for a single post.
]]>One thing though, I a using the widget to show current category. However if the widget in showing on a page that belongs to two categories, I would expect to choose the category which is marked as primary.
But it doesn’t do this, it seems to 9randomly) show either of the two categories.
Is there a way to force the primary? (Apart from using exclude categories via ID)
Thanks
https://www.ads-software.com/plugins/list-category-posts/
]]><h2 class="bluebottom"><?php $categories = get_the_category(); foreach($categories as $category) { echo $category->name . ' '; } ?></h2>
<ul>
<?php
global $post;
$category = get_the_category($post->ID);
$category = $category[0]->cat_ID;
$myposts = get_posts(array('numberposts' => 99, 'category__in' => array($category), 'post__not_in' => array($post->ID),'post_status'=>'publish'));
foreach($myposts as $post) :
setup_postdata($post);
?>
<li>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</li>
<?php endforeach; ?>
<?php wp_reset_query(); ?>
</ul>
I would like to write an if statement, where the title does not show if there are not other posts in the current category. Could anyone help me with that?
]]>