WooCommerce: how to disable image zoom? - wordpress

In WooCommerce we want to disable the product image zoom on hover. I've seen multiple options to do it in the child theme, functions.php. But they all are not working.
The child theme function.php is working (has some other code in it that is working). It's also not working when I put it in the main theme function.php file.
I've tried:
add_filter( 'woocommerce_single_product_zoom_enabled', '__return_false' );
and
function remove_image_zoom_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
}
add_action( 'wp', 'remove_image_zoom_support', 100 );
and
add_filter( ‘woocommerce_single_product_zoom_options’, ‘custom_single_product_zoom_options’, 10, 3 );
function custom_single_product_zoom_options( $zoom_options ) {
// Disable zoom magnify:
$zoom_options[‘magnify’] = 0;
return $zoom_options;
}
Any more options?

All the given options don't work. The theme has a (hidden) builtin feature for this.
Thanks for the replies.

Related

Remove product image cropping from Newest Products blocks in WooComemrce

I'm using latest version of WordPress 6.1.1 and I'm using child of 2023 theme. I've installed wooComemrce. On my home page I'm showing WooComemrce's "Newest Products" block. In this block I'm not able to stop thumbnail image cropping.
I've tried this solution How can I display my original product images instead of the ones generated by woocomerce?
It works for all thumbnail images but doesn't work for WooComemrce's "Newest Products" block.
I've added all 6 filters mentioned on https://woocommerce.com/document/image-sizes-theme-developers/#section-2
How to fix it?
Is there any separate filter for the images shown in this block?
Here is my code in child's theme function.php
function rf_product_thumbnail_size( $size ) {
global $product;
$size = 'full';
return $size;
}
add_filter( 'single_product_archive_thumbnail_size', 'rf_product_thumbnail_size' );
add_filter( 'subcategory_archive_thumbnail_size', 'rf_product_thumbnail_size' );
add_filter( 'woocommerce_gallery_thumbnail_size', 'rf_product_thumbnail_size' );
add_filter( 'woocommerce_gallery_image_size', 'rf_product_thumbnail_size' );
add_filter( 'woocommerce_gallery_full_size', 'rf_product_thumbnail_size' );

Remove breadcrumbs from WooCommerce Storefront theme

In order to remove breadcrumbs from the Storefront theme, the documentation states to add the following in functions.php:
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
I tried this in a child theme of Storefront and it doesn't work. Tracing back the woocommerce_breadcrumb, it seems to be added in storefront_content_top action (in the file <storefront_dir>/inc/woocommerce/storefront-woocommerce-template-hooks.php. I commented out the corresponding line and indeed the breadcrumbs are hidden.
However, to do this the right way, I try to disable it from the child theme using
remove_action( 'storefront_content_top', 'woocommerce_breadcrumb', 10 );
but it doesn't work. I should clarify that I test this in a fresh child theme with no other code.
How would one disable the breadcrumbs from a child theme?
Copy and paste the following snippet into your functions.php file.
add_action( 'init', 'z_remove_wc_breadcrumbs');
function z_remove_wc_breadcrumbs() {
remove_action( 'storefront_before_content', 'woocommerce_breadcrumb', 10);
}
since Storefront 2.3.1 try this
add_action('init', 'dp_remove_wc_breadcrumbs');
function dp_remove_wc_breadcrumbs(){
remove_action('storefront_before_content', 'woocommerce_breadcrumb', 10);
};
Try this:
add_filter( ‘woocommerce_get_breadcrumb’, ‘__return_false’ );
remove_action( 'woocommerce_before_main_content','woocommerce_breadcrumb', 20, 0);
.breadcrumb{
display: none;
}

How to remove wp customize sections in genesis

Can one help me to remove the customizer section in genesis. i want to remove color section from the theme customizer in genesis.tried many code but now working. can anyone help me with code
add_action( 'customize_register', 'wpse8170_customize_register' );
function wpse8170_customize_register( WP_Customize_Manager $wp_customize ) {
$wp_customize->remove_section('id-of-section');
}
I had trouble with this too, until I found this code. Just stick it in your functions.php
// Removing Genesis Sections from Customizer page
add_action( 'customize_register', 'gd_remove_customize_section', 20 );
function gd_remove_customize_section($wp_customize){
$wp_customize->remove_section( 'genesis_layout');
$wp_customize->remove_section( 'genesis_breadcrumbs');
$wp_customize->remove_section( 'genesis_comments');
$wp_customize->remove_section( 'genesis_archives');
}

wordpress image_default_link_type no way works

what is the way to change the default link url when inserting an image, so its always 'none' rather then displaying the link in wordpress?
I try all way that I found: http://wpsites.net/wordpress-tips/5-ways-to-change-default-image-links/
I have Version 4.2.2.
But nothing works.
Thanks so much
I always this function to update this settings. just placed in your functions.php and it will do the trick.
add_action( 'after_setup_theme', 'default_attachment_display_settings' );
function default_attachment_display_settings() {
update_option( 'image_default_align', 'none' );
update_option( 'image_default_link_type', 'none' );
}
Cheers

Remove "Updates" link from Wordpress Admin Dashboard

Does anyone knows how to remove the menu link named "Updates", found under the "Dashboard" section of the Wordpress Administration Menu?
I added the following actions & filters, which stop the core, theme & plugins updates, but the menu link is still there, although there is nothing to update:
# Disable WP>3.0 core updates
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
# Disable WP>3.0 plugin updates
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
# Disable WP>3.0 theme updates
remove_action( 'load-update-core.php', 'wp_update_themes' );
add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );
# disable edit plugin and theme files:
define('DISALLOW_FILE_EDIT',true);
# disable core updates:
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
Thank you,
Ciprian
#wunderdojo wasn't "wrong", but WordPress has a bit of a better built in mechanism to handle this.
What you want (or anyone else viewing this these days) is a function called remove_submenu_page
Codex link: https://codex.wordpress.org/Function_Reference/remove_submenu_page
add_action( 'admin_menu', 'control_menu_items_shown' );
function control_menu_items_shown() {
remove_submenu_page( 'index.php', 'update-core.php' );
}
index.php is the name for the "Dashboard" menu item and update-core.php is the name for the "Updates" menu sub item.
Please note the naming mechanisms of these change quite a bit depending on the plugin, theme, etc.
Example from the Mandrill plugin:
remove_submenu_page( 'options-general.php', 'wpmandrill' );
They may not end in .php
It's also worth noting a similiar function remove_menu_page
Codex link: https://codex.wordpress.org/Function_Reference/remove_menu_page
Hope someone finds this useful in the future.
The update options comes in two places in back-end. One as the message on top and second in the 'AT a glance' window in dashboard. Place the below code in your functions.php. This code will hide the update options from these two areas.
add_action('admin_menu','wphidenag');
function wphidenag() {
remove_action( 'admin_notices', 'update_nag', 3 );
}
function admin_style() { ?>
<style>
#wp-version-message a.button{
display:none;
}
</style>
<?php
}
add_action('admin_enqueue_scripts', 'admin_style');
This should do it:
function edit_admin_menus() {
global $submenu;
unset($submenu['index.php'][10]);
return $submenu;
}
add_action( 'admin_menu', 'edit_admin_menus' );
Put that in your theme's functions.php file or in your plugin code.

Resources