WordPress.org

Ready to get started?Download WordPress

Forums

Getting content inside shortcode (3 posts)

  1. prionkor
    Member
    Posted 2 years ago #

    I have a shortcode defined which works well on the content.

    [shortcode]
        Contents inside shortcode
    [/shortcode]

    Now what i want is to get the contents inside the short code to give a preview of the post on loop-post.php. In other words I need the raw contents on the shortcode before it get parsed.

    Let me know if you have any questions. Thanks!

  2. digitalrenewal
    Member
    Posted 2 years ago #

    Im looking to do something similar. I want to echo the contents inside a conditional statement... I havent totally figured it out but been playing with something like this

    echo do_shortcode('[shortcode]'. the_content() .'[/shortcode]');

    Would love to hear someone elses opinion on this.

  3. prionkor
    Member
    Posted 2 years ago #

    @digitalrenewal: actually when you use $content = get_the_content(); you actually get the content without the shortcode parsed. Then you can use regex to find out the content inside the shortcode.

    Let me now if you have more questions.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic