advanced-custom-fields

WordPress post update AFTER ACF field updates

允我心安 提交于 2020-07-03 13:17:48
问题 The code below sends out an email every time I (change the STATUS field and then) safe/update the post. But it's not working the way I want and I know whats's wrong: The field updates are always saved AFTER the post is saved so it always sends out the PREVIOUS field values (its like I'm always 1 step behind). How can I let the POST UPDATE come LAST so that the then triggered action (send email) will have the latest field values included? function yl_send_booking_email_after_post_update( $new

Wordpress ACF - Date format

吃可爱长大的小学妹 提交于 2020-06-14 19:17:29
问题 I am using the date field to render out the date to look like: 11/15/2014. But I want to also display the date like November 15, 2014 else where on the page. Is it somehow possible to render out the date in two different formats? <?php the_field('date'); ?> 回答1: You can use get_field and then you can change the date format to whatever you want. $date = get_field('date'); $date2 = date("F j, Y", strtotime($date)); 回答2: For 11/15/2014, the_date('m/d/Y'); And for November 15, 2014, the_date('F d

Add recipients from product custom fields to Woocommerce new order email notification

与世无争的帅哥 提交于 2020-05-11 03:34:27
问题 In Woocommerce, I would like to add a email custom field with the Advanced Custom Fields plugin to products post type. If customer place an order I would like to add the corresponding email adresses for each order items to new order email notification . How to add recipients from product custom fields to Woocommerce new order email notification? 回答1: For "New order" email notification, here is the way to add custom emails from items in the order (The email custom field is set with ACF in the

Wordpress: Permanently deleting custom post type post. remove the: “1 post moved to the Trash. Undo” message

谁说胖子不能爱 提交于 2020-03-23 02:02:52
问题 Sorry if there is already an answer to this but I couldn't find it. So I have this script that permanently deletes a post from a custom post type. It does permanently delete the post. but after it's deleted I get this message: But I want this message gone because even if u the press undo button it just says: the code for deleting the posts is: function members_skip_trash($post_id) { if (get_post_type($post_id) == 'members') { // Force delete wp_delete_post( $post_id, true ); } } add_action(

Wordpress: Permanently deleting custom post type post. remove the: “1 post moved to the Trash. Undo” message

点点圈 提交于 2020-03-23 02:02:04
问题 Sorry if there is already an answer to this but I couldn't find it. So I have this script that permanently deletes a post from a custom post type. It does permanently delete the post. but after it's deleted I get this message: But I want this message gone because even if u the press undo button it just says: the code for deleting the posts is: function members_skip_trash($post_id) { if (get_post_type($post_id) == 'members') { // Force delete wp_delete_post( $post_id, true ); } } add_action(

get child pages of parent ID and display custom image field with link to page in WordPress

纵然是瞬间 提交于 2020-03-15 07:53:30
问题 I need to get list of child pages, but i need to exclude the first child. I also need to display a custom image field called'page_icon' with url and page title for each. This will act as a sub menu whic will be displayed on each child page. Each menu item needs to have the current class attached to the a tag. i've tried a number of different methods and have had no luck as my skill level is beginner at best. the parent ID is 1064 the custom field is called 'page_icon' which was set up using

Advanced Custom Fields in WooCommerce Email templates

久未见 提交于 2020-02-27 13:46:58
问题 I am using Advanced Custom Fields (ACF) plugin in WooCommerce and I have set a custom field named "tracking-no". How can I display the value of this custom field in the Woocommerce template emails/customer-completed-order.php ? I am using this code: <?php if(get_field('tracking-no')) { echo '<p>' . get_field('tracking-no') . '</p>'; } ?> But I doesn't get anything. Thanks 回答1: In your WooCommerce template you should get first the order ID as argument in get_field(): <?php // Get the $order ID

Advanced Custom Fields in WooCommerce Email templates

旧街凉风 提交于 2020-02-27 13:43:06
问题 I am using Advanced Custom Fields (ACF) plugin in WooCommerce and I have set a custom field named "tracking-no". How can I display the value of this custom field in the Woocommerce template emails/customer-completed-order.php ? I am using this code: <?php if(get_field('tracking-no')) { echo '<p>' . get_field('tracking-no') . '</p>'; } ?> But I doesn't get anything. Thanks 回答1: In your WooCommerce template you should get first the order ID as argument in get_field(): <?php // Get the $order ID

How to expose all the ACF fields to Wordpress REST API in both pages and custom postypes

与世无争的帅哥 提交于 2020-02-19 07:00:52
问题 I want to expose all the ACF fields that belong to a page or custom post type to the WordPress REST API in order to do some API calls through javascript. The final expected result would be all the ACF fields inside an ACF object that you can easily access. 回答1: Through the following code, you will be able to expose page and your custom postypes ACF fields in the wordpress REST API and access them inside the ACF object. You can obviously customise the postypes to exclude or to include in the