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
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 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.
I am converting an HTML site to WordPress. In my new theme I have no option for a featured image. How can I enable this option?
Use
add_theme_support( 'post-thumbnails' );
in your function.php
How can I make a wordpress theme woocommerce compatible ? I want to make cart page, my account page, product loop page, product single page,checkout page design into my wordpress theme.
We Can make WordPress theme compatible with woocommerce here is how you can do that
There are two ways to resolve this:
1] Using woocommerce_content() -
This solution allows you to create a new template page within your theme that will be used for all WooCommerce taxonomy and post type displays.
To set up this template page, perform the following steps:
Duplicate page.php-
Duplicate your theme’s page.php file, and name it woocommerce.php. This file should be found like this: wp-content/themes/YOURTHEME/woocommerce.php.
Edit your page (woocommerce.php)-
Open up your newly created woocommerce.php in a text editor, or the editor of your choice.
Replace the loop-
In woocommerce.php, replace the Loop with woocommerce_content();
i.e., instead of if(have_posts)… endif; should be replaced by
woocommerce_content()
This will ensure that the WooCommerce templates are picked up for the product and taxonomy pages.
2] Using WooCommerce Hooks-
The hook method is more involved that using woocommerce_content, but is more flexible. This is similar to the method we use when creating our themes. By inserting a few lines in your theme’s functions.php file, First unhook the WooCommerce wrappers;
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
Then hook in your own functions to display the wrappers your theme requires:
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10); function my_theme_wrapper_start() {
echo '<section id="main">';} function my_theme_wrapper_end() {
echo '</section>';}
3] Declare WooCommerce support -
Now that you have made the changes, the final thing you have to do, is specify that your theme now supports WooCommerce. You need to add the following in functions.php of your theme.
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
To make it more practical for you this is the video for you, which you
can follow too- How To Make WordPress Theme Compatible With WooCommerce Plugin
You need to install WooC and look at the all the style tags that come accross with it then you can style up the pages and add all of that to your style sheet.
Also you can use hooks but Im not 100% sure how you would check if WooC is active off the top of my head so that hooks in your code only come up when the plugin is active.
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: