<?php the_field($field_name); ?>
… Wherever you want it.
You might take a look at the excellent ACF official documentation :
http://www.advancedcustomfields.com/resources/the_field/
That’s not working. The Contact Form 7 field is an object I believe. When you return it, it produces nothing in the template output.
Hi,
everything seems to work fine, but at the frontend my contact form is not be rendered;-( The HTML-Markup is just empty!
I used this code:
<?php global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'kontaktformular', true); wp_reset_query(); ?>
As you can see my ACF custom field has the name “kontaktformular”!
Any ideas???
Kind regards
Thomas
Hi there once again,
to complete my last comment: I’m using WP 4.0! Maybe that could be the reason?
I would really appreciate a quick helping hand;-)
Kind regards
Thomas
@douglas Karr : I think how this field work is that it fetch the id of the form chosen from the dropdown list in the edit page, and then execute the CF7 shorcode accordingly. But that’s just a guess.
@ both : Here’s a code I’ve been using in my own template :
<?php if( get_field('formulaire_cta') ):
the_field('formulaire_cta');
endif; ?>
As you can guess, the slug of my acf cf7 field is ‘formulaire_cta’. The if condition verifies if the field do exist.
Hope this help 🙂
Hi nyoz,
thanx! I tried your code example but sadly the result is the same;-(
But now I noticed that the HTML markup isn’t empty! I’ll get back a “36”! In my opinion the reason therefor is, that the 36 is in the WP contact form shortcode: [contact-form-7 id=”36″ title=”Kontaktformular”].
Are you using WP 4.0?
Kind regards
Thomas
Hi all,
can anybody give me a helping hand in the next few days?
Kind regards
Hi flinsi,
Here is the setup in ACF of a Contact form 7 field for ACF I’ve used in a recent website (working like a charm with WP4.0) : http://image.noelshack.com/fichiers/2014/38/1411077672-capture-d-ecran-2014-09-18-a-23-59-07.jpg
And the code I gave you is the only other thing I put inside my template.
Are you sure you did attribute a cf7 in your post edit page ?
Hi folks,
believe it or not, but I’m still too dumb to get it work properly;-(
Take a look at these three screenshots:
WP Custom Field (Kontakt): https://dl.dropboxusercontent.com/u/538449/Bildschirmfoto%202015-07-21%20um%2022.01.04.png
WP Page: https://dl.dropboxusercontent.com/u/538449/Bildschirmfoto%202015-07-21%20um%2022.03.43.png
Output: https://dl.dropboxusercontent.com/u/538449/Bildschirmfoto%202015-07-21%20um%2022.04.04.png
As you can see, the WP-shortcode of the contact form isn’t translated;-(
What’s wrong here?
Big Thanx
Thomas