wordpress

Customizing loop product image via a hook in Woocommerce

萝らか妹 提交于 2021-02-20 10:11:29
问题 I am customizing woocommerce themes. I stuck on loop product using hook action woocommerce. To call/include the thumbnail image in a loop, we call this hook <?php do_action('woocommerce_before_shop_loop_item_title'); ?> And the thumbnail image appears. I am confused where is the <img src"" .... location? How to edit that code? Thanks 回答1: The hook woocommerce_before_shop_loop_item_title load the image from this function code: if ( ! function_exists( 'woocommerce_template_loop_product

Add external javascript file in wordpress

元气小坏坏 提交于 2021-02-20 06:47:09
问题 I want to add more than one external javascript files in wordpress theme, I have found code for adding one file, but I need to add more javascript files. How can I do it? function wpTan_scripts() { wp_register_script('app', '/js/app.js', false); wp_enqueue_script( 'app' ); } add_action('wp_enqueue_scripts', 'wpTan_scripts'); 回答1: you can add as many scripts as you want. function themeslug_enqueue_script() { wp_enqueue_script( 'jquery-v-2', 'http://code.jquery.com/jquery-2.1.3.min.js', false )

Wordpress and Woocomerce integration with mobile app [closed]

我们两清 提交于 2021-02-20 05:26:44
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 8 days ago . Improve this question My wife has an online store built in Wordpress with Woocomerce. Now we are working on the mobile app in Flutter for people who buy diets in the store. We want to integrate some data from Wordpress/Woocomerce with the mentioned app. We want to give users

Setting limited number of reviews on product page in WooCommerce [closed]

北城以北 提交于 2021-02-20 04:59:07
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . Improve this question Is is it possible to set a limited number of reviews to display on the product page under the review tab? Currently some of my products have 40 reviews and to display them all on a single page takes up too much space. Is there a way to limit the number of reviews to say 3, and

Ajax with GET in Wordpress

落花浮王杯 提交于 2021-02-20 04:46:06
问题 The plugin below is a bare-bones ajax request plugin: /* /wp-content/plugins/ajax-test/ajax-test.php */ /** * Plugin Name: Ajax Test * Plugin URI: http://mysite.co.uk * Description: This is a plugin that allows us to test Ajax functionality in WordPress * Version: 1.0.0 * Author: Me * Author URI: http://mysite.co.uk * License: GPL2 */ add_action( 'wp_enqueue_scripts', 'ajax_test_enqueue_scripts' ); function ajax_test_enqueue_scripts() { wp_enqueue_script( 'test', plugins_url( '/test.js', _

Ajax with GET in Wordpress

有些话、适合烂在心里 提交于 2021-02-20 04:46:05
问题 The plugin below is a bare-bones ajax request plugin: /* /wp-content/plugins/ajax-test/ajax-test.php */ /** * Plugin Name: Ajax Test * Plugin URI: http://mysite.co.uk * Description: This is a plugin that allows us to test Ajax functionality in WordPress * Version: 1.0.0 * Author: Me * Author URI: http://mysite.co.uk * License: GPL2 */ add_action( 'wp_enqueue_scripts', 'ajax_test_enqueue_scripts' ); function ajax_test_enqueue_scripts() { wp_enqueue_script( 'test', plugins_url( '/test.js', _

WooCommerce Add to cart redirection to previous URL

自闭症网瘾萝莉.ら 提交于 2021-02-20 04:19:47
问题 At the request of users, I need the add to cart button on the individual product page to redirect users to the previous page after clicking add product to cart. With following code, customer returns to a specific page (in this case the shop page): function my_custom_add_to_cart_redirect( $url ) { $url = get_permalink( 311 ); // URL to redirect to (1 is the page ID here) return $url; } add_filter( 'woocommerce_add_to_cart_redirect', 'my_custom_add_to_cart_redirect' ); with this code the users

Add image caption under image thumbnail in WooCommerce single product page

别说谁变了你拦得住时间么 提交于 2021-02-20 04:09:59
问题 I'm trying to add the image caption under each image thumbnail in WooCommerce single product page. Here you can see where I want the text to be showed (presently "undefined") I want to add the individual caption text (not the product title, the image caption. Each image has a different caption). Is there an easy way to do that? I'm using ToolSet and can add JavaScript snippet if needed. I saw a post that talk about this but can't figure it out where to put that code : Show caption under

Woocommerce - Check if product was created less than 60 days ago

陌路散爱 提交于 2021-02-20 04:08:16
问题 I want to check if a Woocommerce product was created less than 60 days ago. - If true, do something. I am obtaining the date the product was created in backend/admin using the official Woocmmerce function $product->get_date_created . My code partially works, but it seems to be checking if $product->get_date_created literally contains the value 60 instead of perfoming the calculation and minusing 60 days from the current DateTime . I have come to this conclusion because my IF statement runs

Woocommerce - Check if product was created less than 60 days ago

守給你的承諾、 提交于 2021-02-20 04:08:10
问题 I want to check if a Woocommerce product was created less than 60 days ago. - If true, do something. I am obtaining the date the product was created in backend/admin using the official Woocmmerce function $product->get_date_created . My code partially works, but it seems to be checking if $product->get_date_created literally contains the value 60 instead of perfoming the calculation and minusing 60 days from the current DateTime . I have come to this conclusion because my IF statement runs