InMotion Hosting Support Center

Shortcode To Display In Blog Post Widget

Category: Wordpress

2018-10-05 4:23 pm EST

Hits: 27
Not the best at explaining. But in the current Wordpress theme I am using, there is a widget I have on the home page by the theme developer that shows latest posts. That widget, among other things, takes the text in the "text/main content?" area and displays the it like an excerpt... because it only shows so much. Well, if I put a shortcode in that same text area, it displays nothing.

Now I found and went into the .php file and changed what was happening there to :: echo do shortcode('[actual-shortcode]'); and it will show.

So somewhere, somehow, something is coded to ignore the shortcode when it is in the text area. What I need to know I guess is what to replace (with what I replaced to test) in the php file to make sure the shortcode gets recognized when it is just in the text main content area of the post editor.


You must login before you can ask a follow up question.

You must login before you can submit an answer.

I also added the following into the functions.php for the theme and still got nothing ::

add_filter( 'the_excerpt', 'shortcode_unautop');
add_filter( 'the_excerpt', 'do_shortcode');
add_filter( 'get_the_excerpt', 'shortcode_unautop');
add_filter( 'get_the_excerpt', 'do_shortcode');

I also tested this below before just adding the do_shortcode('[actual-shortcode]'); to just see if it would display anything, and this did not work either ::

<?php echo shortcode_excerpt(); ?> in the widget.php

with this in the functions.php ::

function shortcode_excerpt() {
echo do_shortcode(get_the_excerpt());
8 Points
2018-10-05 04:31 pm EST



1,278 Points
2018-10-05 4:48 pm EST
I recommend you ask the theme developers regarding this as they may have a fix and/or deliver an update to address this in the future.

You must login before you can post a comment about this answer.

They want to charge me. I figured someone, somewhere has run into this before, so I figured I would ask here for help.
8 Points
2018-10-05 5:14 pm EST
Like this Question?

Forum Login

You are NOT logged in. You can still browse our Support Center.

To participate within our Community Support Forum:

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!