Skip to content
Home » Documentation » Contact Form 7 – Dynamic Text Extension » Shortcodes » Included Shortcodes

Included Shortcodes

    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.

    1. Current Page Variables
    2. Get the Current URL
    3. Get the Referring URL
    4. Page/Post Variables
    5. Post Meta & Custom Fields
    6. Get Terms Assigned to Current Post
    7. Get Featured Images or Attachments from Media Library
    8. Current User & User Meta
    9. Site/Blog Information
    10. Theme Customizer Options
    11. HTTP GET Variables
    12. HTTP POST Variables
    13. Get Cookie Values
    14. 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.

    Post IDs

    string(0) ""
    

    2 thoughts on “Included Shortcodes”

    1. 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.

    2. 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:

      [dynamictext inputname "get_post_category"]

      And that should provide you with a comma separated list of category names in the text field. Let me know if this helps!