How to pass multiple custom fields as shortcode’s parameters

You can do this several different ways. Need to know how you are passing the 1 custom field in your current shortcode. It seems like you might be doing it like this: [your_short_code price=”how_are_you_setting_this”] if this is the case then you can just add more attributes like this: [your_short_code price=”how_are_you_setting_this” next_field=”set_this_field”] // From your code … Read more

Custom Post type shortcodes

For shortcode, you can use add_shortcode function of WordPress theme`s function.php. function shortcode_video_slider() { ?> <div class=”cr-carousel”> <?php $loop = new WP_Query( array( ‘post_type’ => ‘video_slider’) ); //Change video_slider with your custom post name. if ( $loop->have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post(); ?> <div> <?php if ( has_post_thumbnail() ) { ?> <div … Read more

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

editing shortcode for custom post type within a plugin

In your code $atts is always $atts = [ ‘category’ => ” ], you cannot use ‘terms’ => $atts, in query parameters $query_args. [litters category=”first_slug,second_slug”] You can assign to ‘terms’ in ‘tax_query’ parameter a string (single category) or an array (multiple category). $args[‘category’] is passed to the shortcode function as string, so you need to … Read more