Tagged: x
-
AuthorPosts
-
November 30, 2016 at 9:28 pm #1276924
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 on top of the thumbnail of the latest posts on the front page?
November 30, 2016 at 9:45 pm #1276944
Rue NelModeratorHello There,
Thanks for writing in! To add a shortcode on top of the thumbnail of the latest posts in your front page, Since you already have your child theme active and ready, please insert this following code in your child theme’s functions.php file;
// Add a shortcode before the blog post items // ============================================================================= function add_custom_shortcode(){ ?> <?php if ( is_home() ) : ?> <?php echo do_shortcode('[the_shortcode_here]'); ?> <?php endif; ?> <?php } add_action('x_before_view_global__index', 'add_custom_shortcode'); // =============================================================================Just make sure that you properly add your
[the_shortcode_here]in the code above.Please let us know how it goes.
November 30, 2016 at 9:51 pm #1276946
JfantasyBooksParticipantThanks! I’ll try it out.
November 30, 2016 at 9:58 pm #1276949
Rue NelModeratorYou’re most welcome.
We would loved to know if this has work for you.November 30, 2016 at 11:04 pm #1276993
JfantasyBooksParticipantUnfortunately it doesn’t work. The shortcode pops up above it at the very top, but I would like for it to appear above every thumbnail for every latest post.
November 30, 2016 at 11:10 pm #1276999
LelyModeratorHi There,
Unfortunately, I am not sure exactly where you want it to appear. Can you give us screenshot pointing us the exact position? This way we can give you more tailored suggestion.
November 30, 2016 at 11:27 pm #1277016
JfantasyBooksParticipantOk. So I made a dummy page that imitates the outlook of this site’s frontpage. https://fantasy-books.live/cornerstone-draft/
As you can see, the right side has the title/excerpt and the left has the thumbnail. This represents the latest posts simlarly structured as the front page.
Only, on top of each latest post, I would like a particular shortcode to appear. The [Enter Shortcode Here] represents where I want it to appear.
November 30, 2016 at 11:45 pm #1277035
LelyModeratorHi There,
Thank you for the clarification.
Please copy content.php file from \wp-content\themes\x\framework\views\global to your child theme here: \wp-content\themes\x-child\framework\views\global.
Open the copied file and then add the following code:<?php if ( is_home() ) : ?> <?php echo do_shortcode('[the_shortcode_here]'); ?> <?php endif; ?>After the following lines:
<?php if ( has_post_thumbnail() ) : ?> <div class="entry-featured">Hope this helps.
November 30, 2016 at 11:48 pm #1277038
JfantasyBooksParticipantIs there an alternative using the child theme?
Edit: Nvm I see it. I will check it out.
November 30, 2016 at 11:53 pm #1277044
LelyModeratorOk then. Do let us know how this goes.
November 30, 2016 at 11:54 pm #1277047
JfantasyBooksParticipantUnfortunately, I don’t see :
<?php if ( has_post_thumbnail() ) : ?> <div class="entry-featured">in that directory path
What I get int he content.php is:
$stack = x_get_stack(); $is_full_post_content_blog = is_home() && x_get_option( 'x_blog_enable_full_post_content' ) == '1'; ?> <?php if ( is_singular() || $is_full_post_content_blog ) : x_get_view( 'global', '_content', 'the-content' ); if ( $stack == 'renew' ) : x_get_view( 'renew', '_content', 'post-footer' ); endif; else : x_get_view( 'global', '_content', 'the-excerpt' ); endif; ?>December 1, 2016 at 12:02 am #1277055
Paul RModeratorHi,
Sorry for the confusion.
You can add the code on top of this line.
if ( is_singular() || $is_full_post_content_blog ) :The code wll read.
<?php if ( is_home() ) : ?> <?php echo do_shortcode('[the_shortcode_here]'); ?> <?php endif; ?> if ( is_singular() || $is_full_post_content_blog ) :Hope that helps.
December 1, 2016 at 12:19 am #1277064
JfantasyBooksParticipantOk! Thank You. Just to let you know, the global did not work and crashed the site. But the code you provided me earlier:
<?php if ( has_post_thumbnail() ) : ?> <div class="entry-featured">Was actually from the ethos. When I put it in my child theme following your instructions on where to put the shortcode, it worked. Thank You.
December 1, 2016 at 12:20 am #1277065
FriechModeratorWe’re delighted to assist you with this.
Cheers!
December 1, 2016 at 5:29 am #1277271
JfantasyBooksParticipantSO, I was able to add the shortcode. But it cuased major problems. It ate away at my resources, significantly slowing down my site.
Are the shortcodes not built to work like this?
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1276924 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
