Tagged: x
-
AuthorPosts
-
December 2, 2016 at 5:11 am #1278652
MichaelParticipantHello,
Could you tell me the best way to add in custom text just below every Blog Title? (I don’t need it on the main blog page that shows excerpts of each post, just the titles of the individual blog articles.)
I’m trying to add in an affiliate disclaimer similar to this (see image).
I’m currently on 4.6.4 and using the renew extension. Thank you!
December 2, 2016 at 6:38 am #1278698
DarshanaModeratorHi there,
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
Then copy the file _content-post-header.php which is located under (“x/framework/views/renew/”) into your child theme’s respective location (“x-child/framework/views/renew/_content-post-header.php”).
Then you can add your sub heading for example
<h5>Sub Heading</h5>, as follows.<?php // ============================================================================= // VIEWS/RENEW/_CONTENT-POST-HEADER.PHP // ----------------------------------------------------------------------------- // Standard <header> output for various posts. // ============================================================================= ?> <header class="entry-header"> <?php if ( is_single() ) : ?> <h1 class="entry-title"><?php the_title(); ?></h1> <h5>Sub Heading</h5> <?php else : ?> <h2 class="entry-title"> <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php the_title(); ?></a> </h2> <?php endif; ?> <?php x_renew_entry_meta(); ?> </header>Save the changes and make sure to activate your child theme in-order to see the changes.
Hope that helps.
December 2, 2016 at 11:01 pm #1279545
MichaelParticipantThank you very much for the insight.
I was able to add in the text to the child theme as you described, however it is also showing up on the main blog and archive pages. Is there any way I can just have it show up for a full blog post?
If you look at my current site – http://www.financiallyalert.com
You’ll notice the main page is a preview of several blog posts. I don’t want the extra text (currently reads “Thanks for reading!”) to show up on these preview pages.
I only want this text to appear when they click through to the entire article.
Is this possible?
Thank you so much!
December 3, 2016 at 12:18 am #1279592
Rue NelModeratorHello There,
Thanks for the updates! The given code when properly added should only appear in single blog post and not in the blog index or archive pages. Could you please post the contents of your file in your next reply? If nothing else works out, would you mind providing us the ftp login credentials so we can take a closer look and fix the issue?
To do this, you can make a post with the following info:
– FTP Hostname
– FTP Username
– FTP PasswordDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
Thank you.
December 3, 2016 at 3:26 am #1279699
MichaelParticipantThis reply has been marked as private.December 3, 2016 at 3:45 am #1279708
ChristopherModeratorHi there,
Please update your code to :
—————————————————————————– <?php // ============================================================================= // VIEWS/RENEW/_CONTENT-POST-HEADER.PHP // —————————————————————————– // Standard <header> output for various posts. // ============================================================================= ?> <header class="entry-header"> <?php if ( is_single() ) : ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php else : ?> <h2 class="entry-title"> " title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php the_title(); ?> </h2> <?php endif; ?> <?php x_renew_entry_meta(); ?> <?php if( is_singular('post') ) : ?> <p class="p-meta">Thank you for reading!</p> <?php endif; ?> </header>Hope it helps.
December 3, 2016 at 12:07 pm #1279919
MichaelParticipantThank you very much! It’s working perfectly now.
I did need to add back in an anchor tag that got stripped somehow, but here’s the final code that working now if anyone else needs it:
<?php // ============================================================================= // VIEWS/RENEW/_CONTENT-POST-HEADER.PHP // ----------------------------------------------------------------------------- // Standard <header> output for various posts. // ============================================================================= ?> <header class="entry-header"> <?php if ( is_single() ) : ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php else : ?> <h2 class="entry-title"> <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php the_title(); ?></a> </h2> <?php endif; ?> <?php x_renew_entry_meta(); ?> <?php if( is_singular('post') ) : ?> <p class="p-meta">Thank you for reading!</p> <?php endif; ?> </header>Thanks again! xTheme support rocks. 🙂
December 3, 2016 at 12:57 pm #1279954
NicoModeratorHappy to hear that.
Thank you so much for sharing the code it would really help others.
Feel free to ask us again.
Thanks.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1278652 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
