This topic has 18 replies, 2 voices, and was last updated 7 years, 5 months ago ago by Max Mullins
Hello, how can I add static block right below the menu (and above product info) on single product pages. As I understand I’d have to modify the page template, but exactly how? Please advise. Thank you!
Hello @fabregas
Please note that this is custom modifications and lays beyond the scope of our theme basic support.
You may create child theme in wp-contents/themes/woo_child which comes with theme download package. Then copy and modify wp-content/themes/woocommerce/single-product.php after line 16 before woocommerce content and add additional widgetised sidebar area like it described in widgetised sidebar.
Add following code:
<?php dynamic_sidebar( 'yourcustomsidebar' ); ?>
then open fuctons.php of the chid theme and add next code to it as it decribed in article above:
/ See the __() WordPress function for valid values for $text_domain.
register_sidebar( array(
'id' => 'yourcustomsidebar',
'name' => __( 'Top Menu', $text_domain ),
'description' => __( 'This sidebar is located above the age logo.', $text_domain ),
) );
Then you will get new sidebar are which can be filled by static block.
Regards,
Max Mullins
Hey!
Thank you! Did you mean content/themes/woopress/woocommerce/single-product.php? There’s no woocommerce under the themes. I’ve sent you the files I modified via wetransfer. Would you mind looking whether everything is correct. Thanks in advance! 🙂
1) Yes the pathes to the files are fine
2) Few minor chages i will suggest for sidebar additionally. The code in first file can be placed 1 or 2 lines higher the woocomerce plugin start rendering products: http://prntscr.com/f9p7nj.
3)The second file should contain double “//” before // See the __() WordPress function for valid values for $text_domain. or this line ca be removed completely and should like http://prntscr.com/f9p9tk
Regards,
Maks Mullins
Hi Maks, I can see the custom sidebar under modules: https://prnt.sc/f9tjvq, but it doesn’t appear on single product pages. Any ideas? I really appreciate your help. I could give you access to my site. Maybe this is the fastest way to solve this?
@fabregas
Please provide us with temporary ftp to your site in private content.
Regards,
Max Mullins
Hello,
Thank you, I’ve sent you the details. The site is not published at this stage.
Hello @fabregas
Please check you site now.
Regards,
Max Mullins
Hello, for some reason it broke the front page layout generated by Woocommerce + Visual Composer. I’ve created a temporary user for you so you can log in and check it out. And there’s no static block on single product pages. The changes you made affected the front page only.
Hello @fabregas.
I have changed file to content-single-product whuch coressponds single product page but were no luck to login on your site with credentials you mentioned. Please clear your browser cache and check again.
Regards,
Max Mullins
Clearing cache didn’t help, the front page is still broken and there’s no block on single product pages. Please see the screenshot below (it should be a grid with pictures and everything not a row).
I’ve updated the password, would you please try again. Thanks for your help.
Hello, @fabregas.
We have added code both in child and parent theme.
Please see appearance->widgets->customsidebar area and fill it with static block or else. See this link for example:
link
I saw also that a lot of links in shop are shortened and many product links are not working. Please disable all third pary plugins one by one as it seems that one of them is causing the issue. We have also updated woocommerce to the latest verson as it is fully compatible with our theme.
You may also use default widget area below description.
Regards,
Max Mullins
Hello, The sidebar is now visible, thank you. But, there’s another problem. I’m using a third party plugin for variables and it doesn’t work anymore, after the WooCommerce update. For many third party plugins, it takes time to get compatible with WooCommerce. Could you please switch it back to the previous version, I suspect plugins don’t work because of the update. This was also the case when 3.0 came out. The problem with products was caused by Yoast SEO, it’s disabled now.
Hello @fabregas.
Ok. We have reinstalled the previous version.
Regards,
Max Mullins
Is it possible that the additional sidebar or changes you made broke the layout on single product pages? Variations/product gallery don’t work and there’s a horizontal line, which wasn’t there before.
The changes we made is only sidebar adding. Please provide us with desired layout screnshot to make changes. You may discard them via deleting woocommerce file in child theme.
Regards,
Max Mullins
The sidebar is okay, at the moment the problem is that none of the buttons/links/variations/galleries work on single product pages. All the clickable objects are broken. Obviously something happened and I don’t know what exactly. On May 18th everything worked flawlessly. I may have to roll back to previous version of the site, but I wouldn’t want to lose the custom sidebar you added. Or is there any other option?
UPDATE: Also, I just deactivated the variations plugin and they still don’t work, which makes me think the template itself is broken.
UPDATE1: I rolled back to version I had on 18th of May and everything worked fine. Then I copied/pasted the files, which where modified to add the custom sidebar and it broke the single product template again. So I guess, it happens because of the modifications on single product template?
Hello @fabregas,
Sorry , my bad. The problem were caused by woocommerce files incompitable with your wopress theme version. Please reenable child theme and check again. Please add the static block in the sidebar position “sidebar on single product page” you mentioned in previous creenshot. The method for creation custom sidebar areas is still avalible though i have removed its code for better sitespeed performance.
Regards,
Max Mullins
Tagged: best, block, persuasive, position, selling, static, themes, woocommerce
You must be logged in to reply to this topic.Log in/Sign up