InMotion Hosting Support Center

Shortcode To Display In Blog Post Widget

Category: Wordpress

SRVIVR
Asked:
2018-10-05 4:23 pm EST

Hits: 22
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.

Thanks.

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());
}
SRVIVR
8 Points
2018-10-05 04:31 pm EST

OTHER ANSWERS

0

jtsp
Staff
697 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.
SRVIVR
8 Points
2018-10-05 5:14 pm EST
Like this Question?

Support Center Login

Our Login page has moved. Please click the button below to be redirected to the login page.

Need more Help?

Search

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: support@InMotionHosting.com
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!