This topic has 7 replies, 2 voices, and was last updated 9 years, 6 months ago ago by Eva Kemp
Hi,
I am nearing completion of development for a client using the Woopress theme, and I have noticed a performance issue when displaying related products on a single product page.
I have narrowed it down to the etheme_create_slider function in theme-functions.php and more specifically, the following while loop:
while ($multislides->have_posts()) : $multislides->the_post();
$_i++;
if(class_exists(‘Woocommerce’)) {
global $product;
if (!$product->is_visible()) continue;
echo ‘<div class=”slide-item product-slide ‘.$slider_type.’-slide”>’;
woocommerce_get_template_part( ‘content’, ‘product-slider’ );
echo ‘</div><!– slide-item –>’;
}
endwhile;
I have put some timing debugging code at the beginning and of the function – and its taking 8 seconds in some cases to execute the function – see private content for live example.
Many thanks
Hello,
Sorry, but your query is unclear.
Could you please clarify with more details what you’re trying to achieve?
Thank you.
Regards,
Eva Kemp.
Hi,
There appears to be a problem with the theme when viewing a product- the related products section is taking a very long time (e.g. approx 8 seconds) to be displayed.
If you view the link I supplied in the private section, you will see this behaviour. I have also echo’d time-stamps before and after the code that generates the related products to demonstrate that its that code causing the problem and the time it is taking.
Many thanks
Hello,
You can speed up the site following the suggestions from these articles:
http://codex.wordpress.org/WordPress_Optimization
http://techtage.com/speeding-up-wordpress-sites/
http://www.sparringmind.com/speed-up-wordpress/
Thank you.
Regards,
Eva Kemp.
Hi,
I’m not sure you understand. Its not the general wordpress site performance – its a specific a piece of code in the woopress theme.
When I disable ‘display related products’ in the theme options, the site’s performance is fine. When I enable that feature its takes about 8 seconds for that code to generate and display the related products – that shouldn’t be the case.
Please advise.
Thanks
Hi,
I have managed to alleviate the problem by reducing the number of items that it attempts to display in the slider by adding the following filter function:
add_filter (‘woocommerce_related_products_args’, ‘rev_related_products_args’,1);
function rev_related_products_args ($args) {
$args[‘posts_per_page’] = 8;
return $args;
}
Without it, it defaults the posts_per_page to (in my case) 50 – which results in terrible performance as it creates the slider.
David
Hello,
We ‘re glad you managed to resolve the issue.
If there are any questions feel free to contact us.
Regards,
Eva Kemp.
Tagged: issue, performance, related products, themes, woocommerce, wordpress
The issue related to '‘Related products performance issue’' has been successfully resolved, and the topic is now closed for further responses