wordpress-plugin

WooCommerce Product Bundles - Cart Quantity

谁都会走 提交于 2019-12-02 03:41:11
Configuration: WordPress 4.1 The Events Calendar PRO 3.9 The Events Calendar: WooCommerce Tickets 3.9 WooCommerce 2.2.11 WooCommerce Product Bundles 4.6.2 For an Events website, selling the following tickets: Adult $25 Child $5 Infant $0 Family $55 (Consists of up 1-2 x Adult, 1-3 Child) The Family ticket is configured as a WooCommerce Bundled Product, with the bundled products being Adult and Child. Adult is set to a quantity of 2 and Child is set to a quantity of 3 When the Family bundled product is added to the cart, the number of items reported as being in the cart is 6. This is made up of

How can I add meta data to the head section of the page from a wordpress plugin?

本小妞迷上赌 提交于 2019-12-02 03:31:18
I am writing a wordpress plugin and need to add some meta tags to the head section of the page from within my plugin. Does anyone know how I would do this? Thanks Yes you can add an action hook to wp_head like this: add_action('wp_head', myCallbackToAddMeta); function myCallbacktoAddMeta(){ echo "\t<meta name='keywords' content='$contents' />\n"; } 来源: https://stackoverflow.com/questions/5805888/how-can-i-add-meta-data-to-the-head-section-of-the-page-from-a-wordpress-plugin

How to get DOCUMENT_ROOT to work on both localhost and web host?

梦想的初衷 提交于 2019-12-02 01:28:27
I have a WordPress plugin that I would like to work on localhost as well as in deployment without modification, but I can't seem to set the location for a directory using one statement. I would like to do this: $feed->set_cache_location($_SERVER['DOCUMENT_ROOT'] . '/wp-content/cache'); While that works on the web host. On localhost it produces this error: C:/xampp/htdocs/wp-content/cache/a547b8792c3144c98549be23ef1465e7.spc is not writeable On localhost, I need to set it to this to get it work: $feed->set_cache_location($_SERVER['DOCUMENT_ROOT'] . '/mysite/wp-content/cache'); Surely there must

How to round up the price in wordpress to the nearest value?

北城余情 提交于 2019-12-02 00:31:05
I am using following function to round up the price in wordpress.. add_filter( 'woocommerce_get_price_excluding_tax', 'round_price_product', 10, 1 ); add_filter( 'woocommerce_get_price_including_tax', 'round_price_product', 10, 1 ); add_filter( 'woocommerce_tax_round', 'round_price_product', 10, 1); add_filter( 'woocommerce_get_price', 'round_price_product', 10, 1); function round_price_product( $price ){ // Return rounded price return ceil( $price ); } The above function round up the prices like If price Rs 999.85/- to Rs 1000/- If price Rs 999.15/- to Rs 1000/- I want round up the price like

Failed to import “Contact form 1”: Invalid post type wpcf7_contact_form Failed to import Media “db_site.sql_.txt”

心不动则不痛 提交于 2019-12-02 00:15:24
I'm new to web development specially with wordpress. I created a website using wordpress as cms framework. I imported a database to my wordpress dashboard, all went well but the problem was some of the content was never imported successfully and the message is this, "...Failed to import Media “db_site.sql_.txt” and Failed to import “Contact form 1”: Invalid post type wpcf7_contact_form.." what could be the problem with this? I appreciate any help from you. Thanks!..=) You are missing the required WordPress plugin: install and activate plugin Contact Form 7 import the theme again... I'm a new

Wordpress - Removing default styles

浪尽此生 提交于 2019-12-01 23:04:35
I'm trying to create my own Wordpress theme just for a one page, secured form. This form looks as it should normally, as you can see in this screenshot --> Unfortunately, even though I've included my own reset.css file, WordPress is inheriting styles from the theme's style.css file. See here --> As you can see, the font size is much smaller, input fields aren't getting proper padding, the body background is supposed to be blue but is a grayish color in the second screenshot, fields aren't getting proper margins etc. I know everyone is going to be asking for code, but before I do that, I'm just

Disqus comment form not displayed on self hosted Wordpress site

谁说我不能喝 提交于 2019-12-01 22:20:48
问题 I have followed all instructions on installing Disqus commenting system on my website but the old comment form is still visible. My question is: is <?php comment_form(); ?> enough to display the comments or there needs to be something else on the single.php page. What else should I be taking care? I don't have any other commenting engine installed. Thank you 回答1: OK I found it. Instead of using the <?php comment_form(); ?> I had to use <?php comments_template(); ?> . That did the trick 回答2:

Wordpress CSS and JS Version Numbers Not Working

≡放荡痞女 提交于 2019-12-01 22:03:33
问题 I am trying to figure out why the version number query string is not being included in any of my JS or CSS files that I set. I have looked through all documentation and tried different methods. I have even tried just removing the version and Wordpress won't add it's own version. Was hoping to get any other ideas to try from someone so I can cache break Cloudflare easier. wp_enqueue_style( 'theme-stylesheet', get_template_directory_uri() . '/assets/css/style.css', false, '1.0' ); wp_register

Wordpress CSS and JS Version Numbers Not Working

拜拜、爱过 提交于 2019-12-01 21:21:25
I am trying to figure out why the version number query string is not being included in any of my JS or CSS files that I set. I have looked through all documentation and tried different methods. I have even tried just removing the version and Wordpress won't add it's own version. Was hoping to get any other ideas to try from someone so I can cache break Cloudflare easier. wp_enqueue_style( 'theme-stylesheet', get_template_directory_uri() . '/assets/css/style.css', false, '1.0' ); wp_register_script( 'theme-scripts', get_template_directory_uri() . '/assets/js/blacklab.min.js', array( 'jquery' ),

Wordpress - Fatal error: Call to a member function get_var() on a non-object $wpdb

人走茶凉 提交于 2019-12-01 21:16:30
[Solution by s_ha_dum on http://wordpress.stackexchange.com] I'm trying to direct users to a certain post based on a password entered in post settings. I have almost working code: Form on page: <form method="post" action=""> <input type="password" name="passwordfield"> <input type="hidden" name="homepagepassword" value="1"> <input type="submit" value="Submit"> </form> Code in functions.php function doPasswordStuff(){ if(isset($_POST['homepagepassword'])){ $post_password = $_POST['passwordfield']; $post_id = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_password = %s",