wordpress-plugin

WooCommerce show custom column

霸气de小男生 提交于 2019-11-27 03:59:28
问题 I want to show a additional column in the backend of WooCommerce (in Orders overview). The column should contain a custom field, which i have defined (delivery date). How to do this? 回答1: In case someone still needs it - instructions on how to add new columns in Woocommerce orders list. No need in unsetting the default columns, just add this in your functions.php and your code will be valid for updates. 1. Define columns position and names add_filter( 'manage_edit-shop_order_columns', 'MY

Wordpress wp-load.php

给你一囗甜甜゛ 提交于 2019-11-27 03:18:01
问题 I'm trying to reverse-engineer a plugin : http://wordpress.org/extend/plugins/wordpress-social-login/ In a part of it, there's this line: (I'm having a hard time understanding the first one, the rest are simply there for reference if they have something to do it.) require_once( dirname( dirname( dirname( dirname( __FILE__ )))) . '/wp-load.php' ); define( 'WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL', plugins_url() . '/' . basename( dirname( __FILE__ ) ) ); define( 'WORDPRESS_SOCIAL_LOGIN_HYBRIDAUTH

PHP fopen() Error: failed to open stream: Permission denied

半城伤御伤魂 提交于 2019-11-27 03:11:38
问题 I learning how to write a WordPress plugin. I need some help writing some data to an XML file. I'm on my local machine, a Mac running MAMP. I have PHP 5.2.13. In my plugin, I've got: $file_handle = fopen('markers.xml', 'w'); $stringdata = "Test Info"; fwrite($file_handle, $stringdata); fclose($file_handle); Running the above gives me the following error: Warning: fopen(markers.xml) [function.fopen]: failed to open stream: Permission denied in /Users/my_name/Sites/my_site/wp-content/plugins/my

Browsing page siblings through next/previous links

主宰稳场 提交于 2019-11-27 02:23:08
问题 I'm using WordPress as CMS for a site I'm developing. When I'm browsing posts, I can use Next/Previous links to walk between posts. I want to have the same thing on pages. Page A Page B Page C Page A should link to next sibling Page B. Page B should link to previous sibling Page A and next sibling Page C. Page C should link to previous sibling Page B. Is there any plugin you can recommend that generates these links? I know there are some plugins that do this, but I specifically want one that

wordpress plugin -> Call to undefined function wp_get_current_user()

让人想犯罪 __ 提交于 2019-11-27 01:30:00
问题 I'm trying to get the current user info in my plugin using the func wp_get_current_user(). But am getting Call to undefined function wp_get_current_user() Apparently this is happening because the file /wp-includes/pluggable which contains the function doesn't get loaded until after the plugins are loaded. Anybody any ideas on how to get the user details in my plugin? 回答1: Apparently this is happening because the file /wp-includes/pluggable which contains the function doesn't get loaded until

wp_rewrite in a WordPress Plugin

﹥>﹥吖頭↗ 提交于 2019-11-27 01:11:28
问题 Ok, I've got this code that I've been using to spit out news to an application of mine. It was working until today. I've cutout all the logic in the following code to make it simpiler. But it should "WORK" Can someone help me fix this code to where it works, and is done right? I know it's hacked together , but it didn't seem to have any problems until today. I have not updated anything, don't know what the deal is. Plugin Name: MyPlugin Example Version: 1.0.1 If ( ! class_exists("MyPlugin") )

Add a fee to WooCommerce per product, based on category

风格不统一 提交于 2019-11-26 22:56:24
问题 I've been trying for a while now to get this working but I haven't find any solution that does exactly what we need, and I'm far from an expert in PHP so I'm a bit lost. We use WooCommerce and WooTickets. The goal is to add a 5% fee for "Service Fee" only to products in the "Tickets" category (ID:34). We have found this code snipper, that add a fixed cost based on a product category : // Add Service Fee to Category function woo_add_cart_fee() { $category_ID = '23'; global $woocommerce;

How to keep the menu state on page reload

与世无争的帅哥 提交于 2019-11-26 21:05:50
I have the following code snippet and wanted to know if there is a possibility to update it achieving this menu behaviour: Step 1. On mouse hover Link 1 ----> it will be translated 1.5em to the right (already set); Step 2. On Link 1 click ----> the menu button will remain fixed in place at the already translated position (done, special thanks to @guest271314 ) on the page reload too, until a new menu button is clicked (not set yet) and another page is loaded . note: next/prev buttons code section, remain unchanged (or can be edited if it's a must, in order to remain functional). note2: I have

Woocommerce add to cart button redirect to checkout

谁说胖子不能爱 提交于 2019-11-26 20:54:39
问题 I created an ecommerce using the plugin woocommerce. I am selling only a subscription so the "/cart/" page is useless. I'm trying to get rid of it so that when my customer click on "Add to cart" button, he ends up on the checkout page. 回答1: you can use a filter in functions.php: add_filter ('add_to_cart_redirect', 'redirect_to_checkout'); function redirect_to_checkout() { global $woocommerce; $checkout_url = $woocommerce->cart->get_checkout_url(); return $checkout_url; } it doesn't seem to

Register/login user with Wordpress JSON API

点点圈 提交于 2019-11-26 19:32:17
问题 I want to create mobile app for one wordpress website. I have integrated the wordpress json plugin. I'm not sure where I can find service for user registration and login. Please advice. 回答1: To register a user this will show you exactly how to register one on the database by simply calling a url and adding data to it using GET Method. Now to do so from a mobile app you just have to make an http request to a url containing all the data required for the user. This will show you how to make a