No Reviews Tab Custom WooCommerce Theme - wordpress

I'm currently working on a custom WooCommerce from a WordPress theme I have built from scratch. So far everything is working perfectly but I have come across an issue that I can't seem to get my head around. When I click on a product I am taken to the single product page, everything works as expected when I scroll down to the tabs section I am seeing the Description tab, but there is no reviews tab. I spent a big chunk of the weekend trying to find a solution to displaying this but I have been unsuccessful.
I have searched the project for the following lines to make sure I haven't disabled the functionality.
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30);
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30);
I am completely stumped now. I have tried Google to find a solution, but I can only find articles and forum posts for pre-existing bought themes. Now I'm left wondering if I have actually missed something. I can display the review stars and it is correctly displaying the number of reviews but when I click on the url to go to the reviews the address bar displays wp-lds-shop/product/happy-ninja/#reviews.
I would really appreciate any help or advice on this.

I have found the following solution, which worked for me.
You have to declare WooCommerce support, otherwise the "Review" tab will not show up.
I followed this link: https://github.com/woocommerce/woocommerce/wiki/Declaring-WooCommerce-support-in-themes and added this code at the bottom of my functions.php
function mytheme_add_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );
I hope this works for you!

Please Check This:
Reviews are enabled in:
How to enable reviews remove Reviews tab

just add to function.php template
add_filter( 'woocommerce_product_tabs', 'yikes_remove_description_tab', 20, 1 );
function yikes_remove_description_tab( $tabs ) {
// Remove the description tab
if ( isset( $tabs['description'] ) ) unset( $tabs['description'] );
return $tabs;
}

Related

Why are my Woocommerce permalinks conflicting with main website pages?

Was wondering if someone could point me in the right direction.
My current Woocommerce Permalink settings are as follows:
SHOP
www.mywebsite.com/shop
SHOP WITH SUB CATEGORY
www.mywebsite.com/seasons/winter
Unfortunately, the above SHOP WITH SUB CATEGORY link also works without the product category - i.e. www.mywebsite.com/winter - for some reason.
Which is annoying as I also have a main page in my website called Winter. (i.e. mywebsite.com/winter).
I have tried various versions of the COMMON, OPTIONAL and PRODUCT permalinks, but no matter what I type, www.mywebsite.com/winter always points to the Woocommerce Shop page and not the normal website page.
Any ideas?
Huge thank you in advance :)
Steven
What happens when you use this? This code stops WordPress from guessing where to go.
function no_redirect_guess_404_permalink( $header ){
global $wp_query;
if( is_404() )
unset( $wp_query->query_vars['name'] );
return $header;
}
add_filter( 'status_header', 'no_redirect_guess_404_permalink' );
Original answer

Do shortcode in WordPress term description work

i want to run Slider Revolution shortcode like this: [rev_slider alias="media-carousel-autoplay7"] in term description, but it is not working and it prints me shortcode in category page. How can I solve this problem?
Try to add this line in functions.php:
add_filter( 'term_description', 'do_shortcode' );
[rev_slider] is probably not a 'shortcode' in WordPress sense.
I encountered this on different plugin, Stream media player. They use the same syntax as shortcodes, but they are actually not.
Try using:
apply_filters( 'the_content',' [rev_slider alias="media-carousel-autoplay7"] ');
instead of do_shortcode, and see if it helps.

WooCommerce Shop page : Customize sorting dropdown to product categories dropdown

I would like to modify the products sorting on the shop page to product categories filter where the user can select the browse the products of categories from there.
I am a rookie in programming. I checked the WooCommerce directory to find the .php file I should work on. I got some clue it is in archive-product.php but I don't see the code which display the sorting dropdown.
Can anyone give me some clue to achieve this ? Or is there any workaround ? Thanks.
I added this in functions.php :
// remove default sorting dropdown
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
// now add the new dropdown
add_action( 'woocommerce_before_shop_loop', 'add_product_category_dropdown' );
function add_product_category_dropdown(){
print '<span class="woocommerce-ordering">'; // So it takes the same position as the default dropdown
the_widget( 'WC_Widget_Product_Categories', 'dropdown=1' );
print '</span>';
}
The reason you wouldn't see the code is that majority of what is generated by Woocommerce is handled by actions and hooks. In easier terms this means Woocommerce creates functions that spits out content and assigns them to different areas of the website.(For more information on Woocommerce actions and hooks, read here - https://docs.woothemes.com/document/introduction-to-hooks-actions-and-filters/ )
I'd recommend using the plugin below. It does exactly what you seem to be asking for and you can avoid having to play in parts you might not be comfortable with yet.
https://wordpress.org/plugins/yith-woocommerce-ajax-navigation/
Most awesome thing is that it's not one of those plugins that force you to get premium to actually get the desired effect.
I just found the solution few days ago. I use the function of WooCommerce product categories widget on the shop page.
This line of code will output the dropdown of product categories:
<?php the_widget( 'WC_Widget_Product_Categories', 'dropdown=1' ); ?>

Avoid displaying the share buttons in the post contained in my home page

I am creating a website using the Candidate theme in wordpress.
There are a number of posts in my website. My home page is set to show the most recent five posts in it.
I have used a plugin named as 'Share This' to show the share buttons for facebook, twitter and google+ just above the contents of my posts. The buttons got displayed above the contents of the posts. Now the problem arose when the buttons got displayed in my home page too where the recent posts along with a short summary is displayed.
This started looking quite mess. I tried a lot to remove these but couldn't.
While researching for this, in some wordpress support forums, i found that the following codes may work
remove_filter( 'get_the_excerpt', 'st_remove_st_add_link', 9 );
remove_filter( 'the_excerpt', 'st_add_widget' );
This did no chage. And I used the following code too
function remove_sharethis() {
if ( ! is_singular( array( 'post', 'page' ) ) ) {
remove_filter('the_content', 'st_add_widget');
remove_filter('the_excerpt', 'st_add_widget');
remove_action('wp_head', 'st_widget_head');
}
}
add_action( 'template_redirect', 'remove_sharethis' );
Is there any way to do so??
I need help desperately.
And even the buttons are not seen completely. They are seen cut-off.
And there is one more problem in this. If I try sharing the posts through facebook share button of this plugin, the contents of the posts donot load at the share screen. Rather it just shows the website's name.
Please help me if there is someone who has better knowledge in this sort of problems and this plugin.
Simple solution, you could use CSS to hide the share buttons from your home page.
Will help if you can share a link to the homepage
The AddThis plugin author responds with specific help to postings here.
HTH

Space Retention from TextArea in Options Framework Plugin for Wordpress

I am using the latest version of Options Framework (which is found here: http://wordpress.org/extend/plugins/options-framework/) on the latest build of Wordpress to build out some theme options/controls. In a text area, I am asking the user for something that is best output via multiple paragraphs. I want to retain the spacing they specify in this textarea.
I output their option in via shortcode and all spacing is lost. I also output it via an echo and all spacing is lost. So it seems the spacing loss is occurring between input and storage.
THanks for any help!
i just tested this locally... the plugin maintains line breaks in the option's textarea, so the problem must be w/ how you are displaying it.
wordpress doesn't save p tags in the database, normally so they won't get saved by Devin's plugin. the function wpautop() is attached to the_content filter and it (sometimes seemingly willy-nilly, but that's a different discussion) determines what should be wrapped in p tags.
what if you
echo wpautop(of_get_option('test'));
something i came up w/ for a similar issue w/ textareas in metaboxes is to create a filter and attach the normal content filters to that... a "duplicate" the_content if you will. i started out straight up using apply_filters('the_content' $my_value) but some plugins hook into that filter and it can get weird.
echo apply_filters('meta_content',of_get_option('test'));
then somewhere in your functions.php
//recreate the default filters on the_content
add_filter( 'meta_content', 'wptexturize' );
add_filter( 'meta_content', 'convert_smilies' );
add_filter( 'meta_content', 'convert_chars' );
add_filter( 'meta_content', 'wpautop' );
add_filter( 'meta_content', 'shortcode_unautop' );
add_filter( 'meta_content', 'prepend_attachment' );

Resources