leighmaher
Forum Replies Created
-
That’s great. Thanks Sasa. I’ll wait till it updates. Thanks for your efforts in getting this highlighted and fixed.
Sounds great. Thanks.
No problem. Just as a quick example: we have these 3 urls, all with identical content.
https://www.shanore.com/shop/
https://www.shanore.com/shop/?wmc-currency=EUR
https://www.shanore.com/shop/?wmc-currency=USDIf you look inside the head tag of the source code for each one it shows this canonical tag:
<link rel="canonical" href="https://www.shanore.com/shop/" />So, the idea is that Google looks at all 3 urls and instead of assuming there’s 3 different pages duplicating content, they understand that first one is the master url and the others are effectively ignored.
So, it’s our understanding that if canonicals are properly in place that it makes the nofollow link redundant.
Here’s a good post about it:
https://www.semrush.com/blog/canonical-url-guide/- This reply was modified 5 years ago by leighmaher.
Thanks Michael. I’ll subscribe to that.
Hi,
Thanks for the information about the shortcode. I had missed that. That should work well for us.
Regarding the nofollow link: I’m not an SEO expert, but our SEO person is telling me that this doesn’t avoid creating duplicate urls. There will be a separte url for each currency but with the use of the canonical tag, all the pages will be consolidated into a single url (the one without any parameters). And apparantely using nofollow on links is no longer recommended as it can prevent bots from crawling the pages of the site that you want the them to crawl and index. I think this is why it was flagged as a potential SEO issue. Hope that helps.
Thanks again.
This is great. Thanks for this Sasa.
Hi again, I have another suggestion for the choose currency links. It would be good to have an option to place this widget anywhere on the page e.g. a snippet for the header that displays text links. Something like this: Choose currency: USD | EUR.
We find the widge fixed to the side causes uses for UX:
– It can get in the way of items the user needs to click or see
– When you accidentally rollover it, it activates, and when this happens on mobile, it’s difficult to get the window to close againThanks. I’ll do that in the meantime.
Can I ask: was there a specific reason why you kept those links as nofollow?
Thanks Sasa. I understand what you mean now, and I’ve fixed those, and actually that satisfied SEMRush. However, I’d still like to know whether Yoast normally shows prev/next on the shop page or if that issue is specific to me.
Thanks again for engaging with me on this.
Thanks for the quick reply, Sasa. Nice spot on the language tag. That’s fixed now.
I’ve updated Yoast but prev/next still not showing. On our staging site we’ve also tested using the default wordpress theme and disabling all other plugins, but it still doesn’t show.
I’m not sure what the issue is with the duplicate title though. I don’t see any issues with our title, and what is it a duplicate of?
Hi, thanks so much for your reply. The first option worked and is a way cleaner solution. Not sure how I missed the get_price_html() function when I was researching this. Thanks again.
Hi,
Thanks for replying.
It’s a custom WP_Query. Currently getting the price from this line (and looping through that for products with variant pricing):
$prices = get_post_meta( get_the_ID(), ‘_price’ );Here’s the full code:
add_shortcode (‘woo_featured_products’, ‘woo_featured_products’ );
/**
* Create WooCommerce Featured Image Loop Slider
*/
function woo_featured_products() {
ob_start();?>
<div class=”slick-container-home-page”>
<ul class=”slick-arrows-home-page”>
<li class=”slick-prev-custom”><span>Previous</span></i>
<li class=”slick-next-custom”><span>Next</span></i><div class=”home-featured-products”>
<?php
$args = array(
‘post_type’ => array(‘product’, ‘product_variation’),
‘posts_per_page’ => 12,
‘post_parent’ => array(0, 1000),
‘tax_query’ => array(
array(
‘taxonomy’ => ‘product_visibility’,
‘field’ => ‘name’,
‘terms’ => ‘featured’,),
),
);$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();$product_thumbnail = get_the_post_thumbnail (get_the_ID(), ‘small’);
// if you leave “true” paramenter in, it will not access price variants
// $price = get_post_meta( get_the_ID(), ‘_price’, true );// access the prices including variant price array
$prices = get_post_meta( get_the_ID(), ‘_price’ );// $product_data = get_post_meta( get_the_ID() );
// var_dump($product_data);?>
<div>
“><?php echo $product_thumbnail; ?>
<div class=”featured-prodcuts-name-price”>
<h4><?php the_title(); ?></h4>
<?php// We need to keep track of what variable price we are on
$i = 0;
$len = count($prices); // allows us to pinpoint the last variant when we loop through variable prices
foreach ($prices as $price) {
// var_dump($price);
if ($i == 0) {
echo wc_price($price); // echo’s out the first price for variants and only price for simple products
} else if ($i == $len – 1) {
echo ‘ – ‘ . wc_price($price); // this echo’s out the last variant price (highest price) allowing us to display the range of prices for a product
}
$i++;
}?>
</div>
</div><?php endwhile;
} else {
echo __( ‘No products found’ );
}
wp_reset_postdata();
?>
</div>
</div><?php
return ob_get_clean();
}I’ve tried wp all import, but there doesn’t seem to a be a custom field to hook into.
Ok. I’m not using the caching plugin now. So, this is not a factor anymore. The only thing I’m changing is activating and deactivating the Mail Chimp plugin.
Hi Julian, if I activate it, it will only show prices in my base currency ($), no matter the location. If I deactivate it, the correct currency shows in all locations.