Advanced Custom Forms PHP formatting for do_shortcode

Even though you are echoing the shortcode, I think you still need to echo the ACF field inside the string of the do_shortcode function. Change your ACF field return function for the_field() : <?php echo do_shortcode(“[tnc-pdf-viewer-iframe file=”.the_field(‘document_link’).” width=”900px” height=”700px” download=”false” print=”false” fullscreen=”true” share=”true” zoom=”true” open=”true” pagenav=”true” logo=”true” find=”true” current_view=”true” rotate=”true” handtool=”true” doc_prop=”true” toggle_menu=”true” toggle_left=”true” scroll=”true” … Read more

Shortcode custom query not passing value

You haven’t defined $atts, so your function isn’t receiving any of the attributes passed by the user. This isn’t sufficient: $atts = shortcode_atts($defaults, $atts); That just combines $atts and $defaults into $atts, but the original $atts hasn’t been defined. You need to accept $atts as the first argument passed to your function: function clients_shortcode( $atts … Read more

Query for getting posts with their custom fields data in WordPress

You can use this code, $args = array( ‘cat’ => 4, // Category ID // ‘category_name’ => ‘staff’, // Category Name ‘posts_per_page’ => -1, ) // The Query $query = new WP_Query( $args ); // The Loop while ( $query->have_posts() ) { $query->the_post(); $thumbnail_image = get_post_meta( get_the_ID(), ‘thumbnail_image’, true ); $first_image = get_post_meta( get_the_ID(), ‘first_image’, … Read more

Field has disappeared on post page

To expose a postmeta field in the Block Editor, you need to register it and enable it to show in the REST API. With your field being named “manufacturer_url” you would use something like this: <?php // Use “init” hook add_action(‘init’, ‘wpse_register_mfr_postmeta’); function wpse_register_mfr_postmeta() { // Make sure to set your CPT slug as the … Read more

How would i insert a value of custom field from Advaced Custom Field into shortcode generated by Gravity Forms [closed]

Yes, you can retrieve the saved meta value and pass it as a parameter to a shortcode. First option is to get the saved value to a variable, validate it and then concatenate it to a shortcode string you pass to do_shortcode(). // get saved meta value $form_id = get_field(‘your_key_for_form_id_here’); // make sure we have … Read more