Button link display in shortcodes using custom field in ACF

Try this I have recorrected your code, if you have successfully retrieved those two variables $string = ”; $h_query = new WP_Query( $args ); if( $h_query->have_posts() ){ $string .= ‘<div class=”main_history”>’; while( $h_query->have_posts() ){ $h_query->the_post(); $h_button_field = get_field(‘history_button_title’); // used to display the custom field if( !empty($h_button_field) ): endif; $h_link = get_field(‘history_button_url’); // used to … Read more

Some posts not displaying by taxonomy term

The problem is with your tax_query — the field (database column name) does not match the terms (database column values): $args = array( … ‘tax_query’ => array( array( ‘taxonomy’ => ‘state’, ‘field’ => ‘name’, // <- this should be set to ‘slug’ ‘terms’ => $state_slug, // because you provided term slug ), ), ); I.e. … Read more

Modify Publish Metabox location on CPT

This solution seems to work so far. add_filter(‘screen_layout_columns’, ‘one_column_on_screen_options’); function one_column_on_screen_options($columns) { $columns[‘post’] = 1; return $columns; } // Ignore user preferences stored in DB, and serve only one column layout add_filter(‘get_user_option_screen_layout_post’, ‘one_column_layout’); function one_column_layout($option) { return 1; } add_action( ‘add_meta_boxes_sliding_panel’, ‘sds_do_meta_boxes’, 0, 1 ); function sds_do_meta_boxes( $post ) { remove_meta_box( ‘submitdiv’, ‘sliding_panel’, ‘side’ ); … Read more

WooCommerce and ACF: How to Redirect Upon Add to Cart – Partially Working Example

Try with below code. i have tested and it is working fine for me. add_filter( ‘woocommerce_add_to_cart_redirect’, ‘acf_product_redirect’ ); function acf_product_redirect() { #Get product ID if ( isset( $_REQUEST[‘add-to-cart’] ) || is_numeric( $_REQUEST[‘add-to-cart’] ) ) { $product_id = (int) apply_filters( ‘woocommerce_add_to_cart_product_id’, $_REQUEST[‘add-to-cart’] ); # Check if redirect url set or not if (!empty(get_field(‘redirect_url’, $product_id))) { $redirect_id … Read more