Tagged: x
-
AuthorPosts
-
July 14, 2016 at 10:15 pm #1087944
On our site, I would like to display a blurb after every article, but “inside” the same container as the article. For example, on the page linked along with login details below, we want this to show up just under the nutrition label but inside the white box.
My first guess was to add a widget area, and I tried to do this following the instructions in this post:
https://community.theme.co/forums/topic/adding-new-widget-area-to-child-theme/
However, the widget area shows up on the dashboard but not the site.
First off, is a widget area the best way to go here? Second, is there a better way to add this nowadays?
July 14, 2016 at 10:16 pm #1087950This reply has been marked as private.July 15, 2016 at 4:01 am #1088224Hello There,
Thanks for posting in and the very detailed information. My question is what should be inside a blurb? Is it just a static text? If that is the case, since you already have your child theme active and ready, please insert this following code in your child theme’s functions.php file;
function add_my_blurb($content){ $blurb = "<div class="clear"></div> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer scelerisque eros eu pulvinar dictum. Nunc egestas massa at elit bibendum, cursus fringilla nunc faucibus.</p>"; $content = $content . $blurb; return $content; } add_filter('the_content', 'add_my_blurb');
Hope this helps. Please let us know how it goes.
July 15, 2016 at 1:45 pm #1088916This would likely be an image – my preference would be something that my wife could edit through the wordpress dashboard, but if this is the best way I can make it work.
July 15, 2016 at 11:38 pm #1089530Hi There,
In that case please update the given code to this:
function add_my_blurb() { if ( is_active_sidebar( 'YOUR SIDEBAR ID' ) ) : ?> <div class="my_blurb"> <?php dynamic_sidebar( 'YOUR SIDEBAR ID' ); ?> </div> <?php endif; } add_action( 'x_before_the_content_end', 'add_my_blurb' );
Then on your admin dashboard navigate to Appearance > Sidebars create a new sidebar and copy the newly created sidebar ID and replace the YOUR SIDEBAR ID phrase on the code with it.
Then navigate to Appearance > Widgets you will see your sidebar there for you to add a content.
Hope it helps, Cheers!
July 16, 2016 at 2:26 pm #1090017This worked, but it’s showing the widget twice (I’m just using a tag cloud for testing):
http://www.originaleating.com/paleo-diet-recipes/tropical-salsa-salmon/
July 16, 2016 at 4:20 pm #1090087Nevermind, found that I accidentally saved the widget twice.
Thanks again for the great support!
July 17, 2016 at 12:09 am #1090341You’re so much welcome!
-
AuthorPosts