I have a shop website with woocommerce 3.0.3 and on product detail page using default woocommerce templates, there is an issue with lightbox about clicking on the main image or gallery images. The site redirects me to a page with the image link instead of showing the lightbox.
You just need to add these lines in your function.php file and your lightbox (photoswipe) will work absolutely fine.
if(class_exists('WooCommerce')){
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
Hope this helps
I found the solution. In latest version woocommerce-3.0.3, lightbox is replaced with photosswipe. Photoswipe is disabled in my theme. It works only if the theme add support like add_theme_support('wc-product-gallery-lightbox') then it works like a charm
The problem is not only the missing add_theme_support('wc-product-gallery-lightbox')
If the DOM structure is not the same as the updated files: product-thumbnail.php and product-image.php - then the add_theme_support function won't help you.
Copy these files from WooCommerce plugin to your theme, and it should work.
Related
I'm creating a website with wordpress but I cannot see featured image in both screen options or editor
This is blank Wordpress install 5.3.2, I develop new web from scratch so I don't think problem related to other plugins
Go into your themes functions.php and paste the following code inside:
add_theme_support( 'post-thumbnails' );
Reference: https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
Hope you can use it to solve your problem.
I have a WordPress website and use the "AMP for WordPress" plugin.
In the article from my website I use the icon from Fontawesome. If I open the site using the desktop, fontawesome works fine, but when I try to use my phone and display it in the AMP, the fontawesome icon does not show.
Can someone help me?
Thanks in advance.
I believe if the integration with the font-awesome fonts is done correctly, the plugin which you have installed should not conflict with this.
There's a handful of hooks (source: https://ampforwp.com/tutorials/article/hooks-in-ampforwp/) that the AMP plugin contains, specifically the one below which I'm hooking onto (amp_post_template_data). If you add something like this within your functions.php file of your theme, the plugin should know how to utilize the fonts accordingly:
add_filter( 'amp_post_template_data', function( $data ) {
$data['font_urls'] = array(
'fontawesome' => 'https://maxcdn.bootstrapcdn.com...';
);
return $data;
} );
Be sure to replace the actual URL with the font-awesome URL, or your localized file if you have one installed on your theme. Good luck! Hope this helps.
You can add custom fonts easily try this-
add_filter( 'amp_post_template_data', 'wp_amp_add_font_awesome_icons' );
function wp_amp_add_font_awesome_icons( $data )
{
$data['font_urls']['fontawesome'] = get_stylesheet_directory_uri() . '/font-awesome/css/font-awesome.min.css';
return $data;
}
I've created child themes before without issue however when I create one using Woocommerce Mystile theme it does not display properly with menu items missing and images resizing to be too large.
I made the child theme by creating a new folder in the wp-content>themes folder called mystile-child and creating style.css with the contents
/*
Theme Name: Mystile Child
Description: Mystile Child Theme
Template: mystile
*/
I then created a functions.php file with the contents
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>
this is what the parent theme looks like:
This what the child theme looks like
Just out of curiousity - were the logo and other missing elements set up intially using the theme customizer (reached via the wordpress admin menu Appearance > Customize)?
If that's the case, then those settings are created outside of your theme and need to be reset or imported for your child theme. There are a few ways to accomplish this, the easiest way being with a plugin which imports/exports those Customizer settings.
Hope that helps,
Laura
Okay I fixed the problem following the advice found on Wordpress.org support forum here https://wordpress.org/support/topic/mystile-theme-child-header-problem
Seems more of temporary fix though and something that the people at Woocommerce should investigate.
I have create an plugin, it's featured image option working in wordpress default theme(twenty thirteen/forteen ) but not working others themes.
Any Idea ?
Themes have to declare their support for post thumbnails before the
interface for assigning these images will appear on the Edit Post and
Edit Page screens. They do this by putting the following in their
functions.php file:
add_theme_support( 'post-thumbnails' );
Source: http://codex.wordpress.org/Post_Thumbnails#Enabling_Support_for_Post_Thumbnails
I want to use the post editor of wordpress in one of the plugins I'm developing. How am I supposed to add the editor to the plugin.
Atlast I figured out a way to add the tiny-mce editor on my plugin.
You have to add a few script(s) and the post editor of wordpress will be available for you.
This is the code to use:
wp_enqueue_script( 'common' );
wp_enqueue_script( 'jquery-color' );
wp_enqueue_script('utils');
if (function_exists('add_thickbox')) add_thickbox();
wp_print_scripts('media-upload');
if (function_exists('wp_tiny_mce')) wp_tiny_mce();
wp_admin_css();
wp_print_scripts('editor');
do_action("admin_print_styles-post-php");
do_action('admin_print_styles');
It's enough to add the tiny mce editor on your plugin.
Now the following line is necessary to display the editor: