The Contact Form 7 – Dynamic Text Extension includes some shortcodes out-of-the-box to make it easy to get started with the most common use cases. See below for all shortcodes that are included with this plugin including how to use them, attributes, and examples.
- Current Page Variables
- Get the Current URL
- Get the Referring URL
- Page/Post Variables
- Post Meta & Custom Fields
- Get Terms Assigned to Current Post
- Get Featured Images or Attachments from Media Library
- Current User & User Meta
- Site/Blog Information
- Theme Customizer Options
- HTTP GET Variables
- HTTP POST Variables
- Get Cookie Values
- Generate a random GUID
When using these shortcodes, be sure to adhere to the correct shortcode syntax or simply use the Form Tag Generator within Contact Form 7.
While some of these shortcodes seem like duplicates of CF7’s default:source attribute, these using DTX’s dynamic form tags also offer features such as obfuscating values, dynamic placeholders, and cache compatibility.
Hi this is a great plugin!
I’m wondering if its possible to get the post’s category name in similar way as can do it for post titles?
I’ll appreciatte some answer here, thanks.
Hi Ricardo, I saw your comment in the support forums but also thought I should put my response here in case you see it first. But yes! You can do that with a custom shortcode like this:
function get_post_category() { $categories = wp_get_post_categories( 0, array('fields' => 'names') ); if (is_array($categories)) { return implode(', ', $categories); } return ''; } add_shortcode('get_post_category', 'get_post_category');And then you can use your custom shortcode with DTX like so:
And that should provide you with a comma separated list of category names in the text field. Let me know if this helps!