• Resolved pristique1

    (@pristique1)


    I am using the “Athena” theme, and all of the shortcodes I am using on my site are displaying as plain text in the homepage (which samples my posts) but then work on the full specific ‘posts’ where they exist. I noticed that the raw shortcode for multiple images I have in a post (simply images added to a post through the post ‘visual editor’) show up as plain text as well on the homepage as well, but again work successfully on the full ‘post’ where they exist.

    I have tried uninstalling and reinstalling all my plugins, and also have tried multiple edits to the index.php, functions.php, etc which I saw suggested in other forums and had no luck with any of it.

    Does anyone have any ideas of how I can get these shortcodes to either hide or activate on the sample posts section of my homepage so they are not plain text?

    Thanks for any advice…

Viewing 4 replies - 1 through 4 (of 4 total)
  • Barry

    (@barryhughes-1)

    Hey there @pristique1!

    In template-parts/content-blog.php the theme does this:

    <?php echo wp_trim_words(get_the_content(), 50); ?>

    That is, it grabs the post content and shortens it if needed so that it isn’t more than 50-words long (basically, it’s forming an ‘excerpt’). However, unlike a call to the_content(), using get_the_content() will not normally cause the shortcodes to be parsed, which is why you’re hitting this problem.

    Modifying the above line to:

    <?php the_excerpt(); ?>

    Will probably give you the results you are looking for – though you may wish to do this via a child theme rather than modify Athena itself. Maybe the theme authors could make this change in a future version? Not really sure what the advantage of the existing approach over a call to the_excerpt() is ˉ\_(ツ)_/ˉ

    Thread Starter pristique1

    (@pristique1)

    Thread Starter pristique1

    (@pristique1)

    thank you, this did the trick!

    Barry

    (@barryhughes-1)

    Glad it helped!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shortcodes displaying as plain text only in homepage’ is closed to new replies.