Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1059941
    flysocal
    Participant

    Is it possible to have a static comment at the bottom of every single blog post? Something like “Thanks for reading and make sure to visit this <hyperlink> page.” Since it wouldn’t change… maybe CSS is the answer?

    I could enter it at the end of every single post… but in that case, it would also show at the end of every post that shows on the main blog page. I’m trying to avoid this.

    Thanks,

    #1059986
    Thai
    Moderator

    Hey There,

    Please add the following code under functions.php file locates in your child theme:

    add_action( "x_after_the_content_end", "x_add_text" );
    function x_add_text() {
      ?>
      <p class="x-custom-text">Thanks for reading and make sure to visit this <a href="http://www.yourwebsite.com/">link</a> page.</p>
      <?php
    }

    Hope it helps 🙂

    #1060834
    flysocal
    Participant

    Hi there.

    We’re close. Two issues;
    1. While it does show at the bottom of every post, I don’t want it to show at the bottom of every post when on the landing page. Only when viewing the individual post.
    2. Can a blank line be inserted above this modification, so it seems like a new paragraph and not a run on sentence?

    Thanks for the help.

    #1060853
    Rue Nel
    Moderator

    Hello There,

    Thanks for the updates! To resolve this issue, please have the code updated and make use of this code instead:

    // Custom Static Text
    // =============================================================================
    function x_add_text() { ?>
      <?php if ( is_single() ) : ?>
    
        <hr class="x-hr mtm mbm" style="border-top-color: #000; border-top-width: 2px;">
        <p class="x-custom-text">Thanks for reading and make sure to visit this <a href="http://www.yourwebsite.com/">link</a> page.</p>
      
      <?php endif; ?>
    
    <?php }
    add_action( "x_after_the_content_end", "x_add_text" );
    // =============================================================================

    Feel free to change the color of the line.

    #1060880
    flysocal
    Participant

    That did provide the space I wanted via a border. Can it be moved up to right under my blog content and right above my back/forward buttons?

    Also, instead of a link to the URL I typed in functions.php, it just shows “link” as a hyperlink. Maybe a typo?

    Thanks for the help.

    #1060889
    Paul R
    Moderator

    Hi,

    Please change the code to this.

    
    // Custom Static Text
    // =============================================================================
    function x_add_text() { ?>
      <?php if ( is_single() ) : ?>
    
        <hr class="x-hr" style="border-top-color: #000; border-top-width: 2px; margin-bottom:20px;margin-top:20px;">
        <p class="x-custom-text">Thanks for reading and make sure to visit this <a href="http://www.yourwebsite.com/">link</a> page.</p>
      
      <?php endif; ?>
    
    <?php }
    add_action( "x_after_the_content_end", "x_add_text" );
    // =============================================================================
    

    Change margin bottom and margin top to adjust spacing.

    Then change the URL and the text link in the code.

    Hope that helps

    #1060919
    flysocal
    Participant

    Still have an issue with placement. I can adjust the margins… but I don’t think it’s going to accomplish what I’m looking for.
    I’m trying to get a couple of spaces after the last post text content… then the custom static text we’re working on. It should almost seem as part of the post content… just a static portion.

    Thanks,

    #1060929
    Christopher
    Moderator

    Hi there,

    Please provide us with URL of page in question.

    Thanks.

    #1060973
    flysocal
    Participant
    This reply has been marked as private.
    #1061001
    Rue Nel
    Moderator

    Hello There,

    Thanks for providng the url. I went ahead and updated the code. I ended up having this code instead:

    // Custom Static Text
    // =============================================================================
    function x_add_text($content) {
      if ( is_single() ) {
    
        $content .= '<hr class="x-hr" style="border-top-color: #ada7a4; border-top-width: 2px; margin-bottom:20px;margin-top:0px;">';
    
        $content .= '<p class="x-custom-text">Thanks for reading and make sure to visit this and make it much better and much more interesting  <a href="http://www.cruisingvolare.com/about">CruisingVolare</a> page.</p>';
      
      }
    
      return $content;
    }
    add_filter( "the_content", "x_add_text", 5 );
    // =============================================================================

    Hope this would work out for you.

    #1061021
    flysocal
    Participant

    Perfect! That’s exactly the look I was trying to accomplish.

    I really appreciate your prompt service!

    Thanks again to the Themeco team!

    #1061046
    Paul R
    Moderator

    You’re welcome! 🙂

  • <script> jQuery(function($){ $("#no-reply-1059941 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>