I am trying to do the same thing than in here:
How can review be moved below product description in woocommerce?
Only difference is that I want to move description tab. I've tried to change parameters in example below but I didn't managed to handle it.
add_action('woocommerce_after_single_product_summary', create_function( '$args', 'call_user_func(\'comments_template\');'), 14);
Alternatively, I was trying to move tabs to the top so description tab would be full width (I need it because I'm using big tables see: https://chemiq.sk/produkt/test/).
I've tried to do it with css
.woocommerce-tabs .panel {margin-left: 0px}
because I'm not familiar with creating new hooks, however it was not working. No change afterwards on live website at all.
Both of solutions would work.
At the end I managed it with following code:
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 14 );
Related
I have been trying for a while now to remove the image link from a Woocommerce product. I tried snippets, css and plugins. But nothing seems to work, until I came across Vitaly Gritsienko's answer of Jul 5 2017.
Although the code he suggests (see below) for the functions.php file works, the hand icon is still visible. How can I remove the hand icon?
//Removes links
add_filter( 'woocommerce_product_is_visible','product_invisible');
function product_invisible(){
return false;
}
//Remove single page
add_filter( 'woocommerce_register_post_type_product','hide_product_page',12,1);
function hide_product_page($args){
$args["publicly_queryable"]=false;
$args["public"]=false;
return $args;
}
Actually, the simplest way is to edit the theme's woocommerce listing page to remove the link from the templating engine, although it's better to do it via a child theme so as not to interfere with the main theme's updates.
You can read more about child themes here: https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/
I use a product category description in every products category in woocommerce, but i don't know how to show the full description. After a few words it just stops and shows "..."
https://i.stack.imgur.com/BaOx5.jpg
There are 2 general ways I'm aware the text would show ... at the end. Either via code or by CSS text-overflow: ellipsis; If it's using the CSS method, then you got to inspect the element (try right-click on element and choose Inspect, or something similar to that), see which html tag has the style set and then remove it or override it in the stylesheet.
(BTW: If you notice that the full description is there when inspecting the element, then text-overflow CSS is most likely involved.)
Read more here: https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow
If it's not CSS but done by code, then it's necessary to get more details on the code used for this to know how to change it. It can be done either by JavaScript or PHP and might be dependent on the WordPress Theme in use.
A quick solution is to observer the source code for the page. See if the full text is in use anywhere else on the page, and then use JavaScript to rewrite the text in the Description area based on it. Read more http://api.jquery.com/html/
Otherwise, you will have to find out if there are any API Hooks that can intercept the Description area to change the text. (Maybe https://codex.wordpress.org/Function_Reference/category_description or http://hookr.io/actions/woocommerce_archive_description/)
Again it might be dependent on the theme. If you are not getting through, add the Theme name to your question, to try get more help.
Here's an example of how to use woocommerce_archive_description
add_action( 'woocommerce_archive_description', 'woo_category_description' );
function woo_category_description() {
if ( is_product_category() ) {
global $wp_query;
$cat_id = $wp_query->get_queried_object_id();
$cat_desc = term_description( $cat_id, 'product_cat' );
$description = '<div class="description">'.$cat_desc.'</div>';
echo $description;
}
}
I am trying to change the name of a tab in product page of woocommerce to a different name.
I am trying to find which PHP file has that particular code but I am unable to do that. Have also used plugins like WhatTheFile (it said the product page is loaded from single-product.php, but I couldn't find the html to edit there) and String Locator and they couldn't help even. Please have a look at this video I made and you will better understand my problem.
https://www.dropbox.com/s/bruhb2n83lhfnp6/Code.mp4?dl=0
I am using G5Plus April theme
Thank you
you can add code like this in functions.php of your theme to customize the product description tab title. For more details, Link 1, Link 2
add_filter( 'woocommerce_product_tabs', 'woo_customize_tabs', 100, 1 );
function woo_customize_tabs( $tabs ) {
$tabs['description']['title'] = __( 'More Information' ); // Rename the description tab
return $tabs;
}
Hope this will helps you.
I am having a problem with a site I am developing with wordpress.
It happened after upgrading to the latest version (4.7)
Anyway. Go to the site www.scientized.com (just dummy content for now), and go the source. At around line 124 you see the tag <style type="text/css" id="wp-custom-css"> and then after some css is loaded.
The thing is, is that this some of my old css code from way early. To make life easier and to isolate the problem I have delete all css in my child themes style.css as well as the custom css in the customizer, and delete jetpack just to be sure. Yet this css is being loaded from somewhere. I have file explored the crap out of my site trying to find where this is located, but couldn't find anything.
I have found that in the wp-includes/theme.php there is this function:
function wp_custom_css_cb() {
$styles = wp_get_custom_css();
if ( $styles || is_customize_preview() ) : ?>
<style type="text/css" id="wp-custom-css">
<?php echo strip_tags( $styles ); // Note that esc_html() cannot be used because `div > span` is not interpreted properly. ?>
</style>
<?php endif;
}
so this wp_get_customer_css() function is calling the old css from somewhere -- I tried to follow the functions back to see where - but my php is not that good and got lost. Does anyone know where this is being loaded from?
I think I need to know where the JetPack custom css location is. I have read it is generated dynamically -- so I am not sure how to go about the problem.
Edit: I dont get the text box in the custom css area in customizer. Where is this text located?
Edit: I dont get the text box in the custom css area in customizer. Where is this text located?
The Additional CSS content is stored in wp_posts database table as a separate record. It's post_type is set to custom_css. To find which post is assigned to the field, you need to look in the option theme_mods_{your theme's slug}.
For example, here is the one from my test Sandbox site which is running the Genesis Sample theme. The post ID is 31, per the key custom_css_post_id.
How do I check my site?
You can go directly into your database via phpMyAdmin and look in the wp_options table. Or...you can do this:
add_action( 'init', 'check_custom_css_post_id_theme_mod' );
function check_custom_css_post_id_theme_mod() {
var_dump( get_theme_mods() );
}
The above code will display the theme mods for your current theme. Note the one that is keyed as 'custom_css_post_id'. That one holds the ID to the post for the CSS.
How to Remove It
To remove a theme mod, you use remove_theme_mod( 'custom_css_post_id' );. See codex for the documentation on this construct. It will remove the binding between the Additional CSS. How? It deletes the sub-option.
Note, it does not delete the post record, meaning you'll have an orphaned record in wp_posts.
The wp-custom-css is loaded from custom css & js
In a WordPress woocommerce template, this line outputs woocomerce product description / excerpt
<?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>
Adding my HTML after that line outputs my HTML outside the div that holds the excerpt/description of the product. I am trying to add a div inside the content as if it was added in the editor.
Basically, I want to add something in all products but because I have many products already, I want a way to insert it in template file or something just once and applied to all.
Anyone know how can I do that?
You could add a filter that adds the div, before the woocommerce software adds it. Try something like this, inside your <theme>/functions.php file:
function add_my_div($desc) {
return '<div class="my-div">'.$desc.'</div>';
}
add_filter('woocommerce_short_description', 'add_my_div', 0, 1);
Notice it is on priority 0. This should run before most other filters. The default value for priority is 10, and I am pretty sure that is the priority that WC adds it's wrapper div.
Hope this helps.
jquery .append did the trick for me
http://api.jquery.com/append/
#loushou Thanks for your comment. It looks like your suggestion could work also but I haven/t tried it yet. Will do If I got the time and update my findings here.
Thanks