wordpress-plugin

WooCommerce: get and set shipping & billing address's postcode

时光怂恿深爱的人放手 提交于 2019-12-03 06:04:12
How do I set/get the Postcode(Zip-code) in woocommerce? Is there a function for this? ie., can I set the zip code through any function? I would also like to know, how to populate this field with my data(say 546621) if the user is not logged in? You can do the following to get/set billing/shipping postcodes, To set the values, $customer = new WC_Customer(); $customer->set_postcode('123456'); //for setting billing postcode $customer->set_shipping_postcode('123456'); //for setting shipping postcode If you just want to fetch the postcodes, you can fetch it from the user meta table itself,

Woocommerce Admin Order Details - Show custom data on order details page

情到浓时终转凉″ 提交于 2019-12-03 05:57:25
I'm searching and trying it for 2 days with no success, please help. I want to filter woocommerce orders to add additional details from db to order details page based on product attribute but I can't find the right woocommerce action/filter hook for this task. Here suppose I've variable $is_customized = false ; If $is_customized == true then I need to add custom data from database to orders detail page. NOTE: I don't want to add additional meta box instead I want to change order detail table for: Replacing the default Product image with the image stored in database and, Adding a div containing

WordPress + Multisite: How to add custom blog options to Add New Site form in Network Admin?

半世苍凉 提交于 2019-12-03 05:54:50
问题 In a WordPress Multisite installation I'm customizing, I need to add a simple text field to the entry form for creating new blog sites, which is located at Network Admin > Sites > Add New Naturally I need this field to get saved along with the other meta data from that form, in the {new_blog_prefix}_options table. I'm particularly interested for the simplest, most straightforward, and/or the "right way" (i.e. The WordPress Way) to accomplish this, but I'll settle for The Way That Works™! So

Make WordPress WP-API faster by not loading theme and plugins

寵の児 提交于 2019-12-03 04:43:21
I would like to make requests to the WordPress API much faster. My API is implemented in a plugin (using register_rest_route to register my routes). However, since this is a plugin, everything is loaded with it (the child-theme and the theme) and basically a query to this API is taking half a second because of all this useless parts loaded. Doesn't WordPress API can be used in another way? Since most plugin making use of the WP-API doesn't need any other plugins to be loaded, even less a theme... I don't understand how they could miss that. Is there anyway to do this? Yes, it is possible. In

woocommerce check zip code before placing order

我怕爱的太早我们不能终老 提交于 2019-12-03 03:59:30
As local delivery is the only option (due to product delivery restrictions) I do not want a customer to get to the checkout page and have to fill out all their details and only then discover we do not deliver to their postcode. Therefore, I require the same functionality of the Local Delivery postcode check at the Checkout page, but to be added at an earlier stage in the checkout process, such as on the Cart page? Or any other page, for that matter. Best place can be in product page before add to cart option. i.e. Enter your postcode to see if we deliver to your area: Result - a yes or no

Good resources for Wordpress? [closed]

旧城冷巷雨未停 提交于 2019-12-03 03:21:46
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I'm building quite a large site, no e-commerce, but a a lot of specific content to be managed. For some reason, the client wants

WordPress plugin development using OOP

ε祈祈猫儿з 提交于 2019-12-03 01:57:56
I am new to plugin development. So please correct me, wherever I get it wrong. I have a website which needs a players plugin with the following needs:- An administrator controllable form for player registration, with some details of them. A listing page where all the registered players are to be shown. Registered players can be deleted & compared with each other. Showing some registered players (10 random players) in the WordPress theme in the front-end. I have completed the activation of the plugin, along with database table creation and administrator menu options for this plugin. I have also

WordPress Admin: When placing a Custom Post Type as a submenu of a parent menu, the parent menu link is being overridden by the CPT

那年仲夏 提交于 2019-12-03 00:48:29
I register a Custom Post Type, and I don't want it to have its own menu, instead I want to place it as a submenu of an existing admin menu item called my-custom-parent-page . Here's my code: register_post_type('my_custom_post_type', array( 'labels' => array( 'name' => __('Books', 'mcpt'), 'singular_name' => __('Book', 'mcpt'), ), 'supports' => array('title', 'editor'), 'show_ui' => true, 'show_in_nav_menus' => false, 'show_in_menu' => 'my-custom-parent-page', ) ); It works, meaning that it's properly located under the menu my-custom-parent-page , however now when I click on the parent menu (i

Wordpress plugin: Hook on custom url

非 Y 不嫁゛ 提交于 2019-12-03 00:15:46
I want to make a plugin, that I will use for some jQuery AJAX loading of table data. I have a function that prints the data correctly, but how do I "hook" into a specific url? Like say, I want the function to be run, and the data to be printed whenever a request to /mycustomplugin/myurl.php is run? (Please note that the url/file should not exist) I have no experience with WP plugins. A simple if ($_SERVER["REQUEST_URI"] == '/mycustomplugin/myurl.php') { echo "<my ajax code>"; } Should work wonders. zarazan To filter your custom URL before Wordpress starts executing queries for other things use

Wordpress shortcode preview in tinyMCE

喜夏-厌秋 提交于 2019-12-02 23:28:53
I've written a shortcode and its functioning like it should. Now the hard part: I would like to show the user a preview already in the tinyMCE editor. Loading CSS in the editor is not a problem for me, but i would love to know if it is possible to already process the shortcode within TinyMCE. Thanks! Let the code talk: I'll put a code to add a visual icon for highlight content word(s) shortcode, and you can then implement any other shortcode you want with the same logic, class spot_shortcodes { function spot_shortcodes() { add_action('init', array(&$this, 'init')); } function init(){ // Enable