Getting content inside shortcode (3 posts)

  1. Sisir
    Posted 4 years ago #

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

        Contents inside 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
    Posted 4 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. Sisir
    Posted 3 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.


Topic Closed

This topic has been closed to new replies.

About this Topic