Support » Plugins » Include by default a shortcode in posts

  • Hi,

    I was thinking in a way to include by default a shortcode in the post editor content, maybe once I open it, or otherwise when the post is called by php (sorry if my approach is wrong, I’m quite ignorant about php).

    (I don’t care about the position in the post markup the shortcode would be inserted in ; the begginig or the end, both possibilities are good for me.)

    Which core file should I modify to resolve something like that (if is a matter of modifying WP core files) ?

    I’d be very grateful if someone can answer this.

    I need to insert a contact form shortcode ([contact-form]), but in an automatized way.

    Thanks very much for any input.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I guess it would look like something like this/

    function adding_your_shortcode($content)  {
       $yourshortcode = '[contact-form]';
       SOMETHING MAGIC HERE($yourshortcode);
       return $content;
    add_filter('the_content','adding_your_shortcode', '10');

    Maybe something similar ?
    I just don’t know which php actions can I use to insert the shortcode (the SOMETHING MAGIC section).

    Thanks if anyone can answer.

    anybody ? I really don’t know how to build a function which can do that.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Include by default a shortcode in posts’ is closed to new replies.