Tagged: x
-
AuthorPosts
-
November 30, 2016 at 11:40 pm #1277028
JfantasyBooksParticipantHey there, Themeco Team!
Name: JFantasyBooks
Site: Fantasy-Books
Site Url: https://fantasy-books.live
WordPress Version: 4.6.1
X Version: 4.6.4
Cornerstone Plugin Version: 1.3.3Problem:
Is it possible to add a shortcode or a text at the bottom of each excerpt on the latest updates page?
November 30, 2016 at 11:42 pm #1277030
RupokMemberHi there,
Thanks for writing in! Excerpt supposed to be plain text so shortcode/HTML won’t work there.
Cheers!
December 1, 2016 at 1:49 am #1277140
JfantasyBooksParticipantI don’t mean to insert a shortcode in the excerpt itself, but below the excerpts.
December 1, 2016 at 2:12 am #1277152
Paul RModeratorHi,
To add a shortcode in excerpts, you can add this in your child theme’s functions.php file
function x_excerpt_string( $more ) { $stack = x_get_stack(); if ( $stack == 'integrity' ) { return ' ... <div><a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a></div>'; } else if ( $stack == 'renew' ) { return ' ... <a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a>'; } else if ( $stack == 'icon' ) { return ' ...'; } else if ( $stack == 'ethos' ) { return ' ... <div class="my_shortcode">'.do_shortcode('[x_icon type="adjust"]').'</div>'; } } add_filter( 'excerpt_more', 'x_excerpt_string' );Change
[x_icon type="adjust"]with your shortcode.Hope that helps
December 1, 2016 at 11:24 pm #1278406
JfantasyBooksParticipantSo I actually did not want to add a shortcode at the end of the excerpt or as a part of the excerpt, but below it.
Strictly below it. As in if I disabled the excerpt, you would see the shortcode below the title instead.
December 2, 2016 at 12:23 am #1278447
Paul RModeratorIn that case, please replace the code with this.
function add_my_shortcode( ) { echo ' <div class="my_shortcode">'.do_shortcode('[x_icon type="adjust"]').'</div>'; } add_action( 'x_after_the_excerpt_end', 'add_my_shortcode' );Hope that helps
December 2, 2016 at 12:29 am #1278451
JfantasyBooksParticipantGreat! Thanks
December 2, 2016 at 12:36 am #1278459
FriechModeratorGlad we could help, Cheers!
December 2, 2016 at 12:37 am #1278460
LelyModeratorYou’re welcome!
Cheers!
December 2, 2016 at 1:21 am #1278487
JfantasyBooksParticipantI’m back.
1. Is there a way to make it so that it’s not after the excerpt end, but before that line you see between each latest post begins?
2. For the latest post at the very top. For some reason there is a gap, making the appearance different from the other posts. Anyway to change that?
December 2, 2016 at 1:30 am #1278495
Paul RModeratorHi,
1. Can you provide us a screenshot with indication where exactly you want it to appear.
2. You can add this under Custom > Edit Global CSS in the Customizer.
.entry-content.excerpt p { margin-bottom:0 !important. }Hope that helps.
December 2, 2016 at 1:46 am #1278504
JfantasyBooksParticipantWell, It’s appearing where I want it. Only, I realized there was an issue with excerpt word count. More characters, the larger the space.
This makes the shortcode a bit nonuniform in comparison to the other latest posts. I figured if the shortcode was set before the <hr> line after every post, it may provide a more uniform look.
December 2, 2016 at 2:20 am #1278524
JfantasyBooksParticipantOk. So the code
.entry-content.excerpt p { margin-bottom:0 !important. }Actually fixed .1, my uniniform problem.
But .2 still remains a problem. The very top post has a gap between the excerpt and the shortcode. This gap is not the same for the other posts, making it look weird.
December 2, 2016 at 2:28 am #1278533
Paul RModeratorHi,
You can try this in your custom css.
.blog .my_shortcode { position: absolute; width: 80%; bottom: 0; } .blog .x-main .hentry { position:relative; }Hope that helps.
December 2, 2016 at 2:41 am #1278544
JfantasyBooksParticipantWell, it helped a lot. Only now the very last one shows a gap, pushing the shortcode to touch the bottom line.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1277028 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
