Forums

Execute php function in post content (6 posts)

  1. pipelineae
    Member
    Posted 3 years ago #

    I'm currently working a plugin that requires custom content to be displayed in a post via a tag being inserted by the user.

    I am so sure that I've come across such a feature that was added in recently, but I can't find the codex page again! I've been looking around for the past couple of days, and I just can't find the page again.

    Am I right? Does a function allowing me to declare custom tags exist and I'm not going crazy, or am am I going to have to achieve this with strreplace and a pre_content hook?

    Regards

  2. t31os
    Member
    Posted 3 years ago #

  3. pipelineae
    Member
    Posted 3 years ago #

    Thanks for the suggestion, but no. I've already looked through all the hooks and filters for it. I'm fairly sure it's a function not a hook.

    Running a filter to manipulate the content before it is displayed is my backup plan. I was originally under the the impression you could define a tag which, when placed in a post's content, would execute a defined code.

    I am however having trouble finding it again.

    Cheers

  4. t31os
    Member
    Posted 3 years ago #

    Ah hah!...

    Shortcodes...
    http://codex.wordpress.org/Shortcode_API

    If i'm thinking what you're thinking, and you're thinking what i'm thinking, then that's what you're looking for... :)

  5. pipelineae
    Member
    Posted 3 years ago #

    You are a life saver, thanks mate!

    That's exactly what I was talking about, cheers.

  6. t31os
    Member
    Posted 3 years ago #

    I knew what you meant the first time, but the wording lost me when it came to google...

    Had looked at a plugin that used shortcodes recently though, so fortunately the term popped into my head after a little while... :)

    Curious to know what it is you're implementing if you don't mind my asking?

Topic Closed

This topic has been closed to new replies.

About this Topic