custom-fields

List custom post type by custom field date

那年仲夏 提交于 2020-01-13 05:47:07
问题 I'm working with Wordpress and WP-Types plugin and need to sort CPT by a custom field date. This work fine: $args = array( 'post_type' => 'parties', 'paged' => $paged, 'meta_key' => 'wpcf-parties_date', 'orderby' => 'meta_value', 'order' => 'DESC', ); The orderby works perfect. On the Database the value of the field date 'wpcf-parties_date' is store in this way ex: 1349481600 . I have two templates where i need to show past and upcoming Posts. My question is how can i display only the future

Save and display product selected custom data everywhere in WooCommerce

跟風遠走 提交于 2020-01-11 10:02:31
问题 I have a code that shows the checkbox on the product edit page. When I click on this checkbox, a select box is displayed on the single product page. Here is my code: // Display Checkbox Field add_action('woocommerce_product_options_general_product_data', 'roast_custom_field_add'); function roast_custom_field_add(){ global $post; // Checkbox woocommerce_wp_checkbox( array( 'id' => '_roast_checkbox', 'label' => __('Roast Level', 'woocommerce' ), 'description' => __( 'Enable roast level!',

Save and display product selected custom data everywhere in WooCommerce

瘦欲@ 提交于 2020-01-11 10:01:18
问题 I have a code that shows the checkbox on the product edit page. When I click on this checkbox, a select box is displayed on the single product page. Here is my code: // Display Checkbox Field add_action('woocommerce_product_options_general_product_data', 'roast_custom_field_add'); function roast_custom_field_add(){ global $post; // Checkbox woocommerce_wp_checkbox( array( 'id' => '_roast_checkbox', 'label' => __('Roast Level', 'woocommerce' ), 'description' => __( 'Enable roast level!',

Issue while adding custom field in billing address section in Magento

旧巷老猫 提交于 2020-01-06 19:34:20
问题 I followed this tutorial for inserting new field in billing address section in Magento checkout. I added new module , form field in billing.phtml page as described in this tutorial. I make sure that the module is enabled in advanced section in admin panel. And the attribute is saved in eav_attribute , sales_flat_order_address , sales_flat_quote_address tables. The issue is when I make place order the checkout page become broken and nothing can done. How can I solve this? Please help.. 来源:

PHP Wordpress code echo's slug not term?

允我心安 提交于 2020-01-06 19:10:44
问题 Does anybody know how I can change the below code for my custom taxonomy (created in the Magic Fields 2 plugin) to solve my problem. I would like it to echo the name of the selected value rather than slug format. e.g. I'd like to echo Client 1 and Client 2 instead of client-1 and client-2 as it currently does. I'd like to display multiword names with spaces and correct capitalisation e.g. Joe Bloggs Associates not joe-bloggs-associates . project_statistics_client is the name of the field

How to do a group by in the Wordpress?

倖福魔咒の 提交于 2020-01-06 14:12:55
问题 I have a drivers post type which has a relationship called team. I want to group drivers by team so I can output them together in their groupings 'teams'. Hopefully that makes sense. I don't really understand the documentation I have a tried a few things but it seems to be missing details. This is what I have at the moment: <?php $type = 'drivers'; $args=array( 'post_type' => $type, 'post_status' => 'publish', 'paged' => $paged, 'posts_per_page' => 12, 'ignore_sticky_posts'=> 0, ); $loop =

Force free shipping method for custom cart item data value in Woocommerce

人走茶凉 提交于 2020-01-06 02:47:48
问题 I've had a user from here help me and assist in getting my code fixed correctly to function correctly and while the above does work for everything with custom field of 90 days to hide all shipping and display only "Free Shipping" if available. However, my client also set free shipping to be shown only on certain amount. I'm wondering if I can add the following; Here's the original code I am using: add_filter( 'woocommerce_package_rates', 'show_only_free_shipping_for_autodelivery', 100, 2 );

How to change Custom field date picker to appear as Month-Year picker

时光毁灭记忆、已成空白 提交于 2020-01-05 10:24:02
问题 How to change default datepicker template to appear as Month-Year view only . below is the template file for detault date picker custom field: ##disable_html_escaping() TODO REENABLE $!{auiparams.put("controlHeaderClass", "aui-field-datepicker")} #customControlHeader ($action $customField.id $customField.name $fieldLayoutItem.required $displayParameters $auiparams) ## Show the use checkbox field to use the current date/time when configuring the field in the admin section. #if (

Save an empty value from a custom Text field in WooCommerce

余生颓废 提交于 2020-01-05 08:27:35
问题 I am working on a WordPress eCommerce website, with WooCommerce being the chosen Shopping Platform. I have created a Custom Field, within the WooCommerce Product Dashboard by inserting the following code into the functions.php file: function product_custom_fields_add(){ echo '<div class="product_custom_field">'; // Minimum Required Custom Letters woocommerce_wp_text_input( array( 'id' => '_minimum_engrave_text_option', 'name' => '_minimum_engrave_text_option', 'desc' => __('set custom minimum

Enable only free shipping method for a specific custom field value in Woocommerce

旧巷老猫 提交于 2020-01-05 03:56:16
问题 I'm trying to add code like the one below into functions.php file. The overall function is to check products in cart and their custom fields (post_meta) called auto_delivery_default. If its certain text in the custom field then display free shipping only, if all other text then show all other shipping methods. Here's what I've gotten so far but I'm overlooking something making it not function right; function show_free_ship_to_autodelivery ( $autodelivery_rate ) { $autodelivery_free = array();