Though it’s not clear exactly what do you want. But, you can do this by two ways.
-
Make a Function like
function wpse_1001(){ $contact = new WP_Query(array( 'post_type' => 'contact' // 'post_status' => 'publish' )); while($contact -> have_posts()){ $contact -> the_post(); $watsapp = get_field('watsapp_no'); $mobile = get_field('mobile_no'); $telephone = get_field('telephone_no'); $address = get_field('address'); } wp_reset_query(); }
Use the Code anywhere on your Code.
- You can Use Shortcodes by
add_shortcode()
, so that you can use it from your Editor also.
https://codex.wordpress.org/Function_Reference/add_shortcode
If you like Shortcodes then you can use on your Code by do_shortcode()
function.
https://developer.wordpress.org/reference/functions/do_shortcode/