Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1264286
    yhshin1020
    Participant

    Hey,

    Is it possible to add custom content to the end of all blog posts?

    I am trying to add the following content at the end of all single posts (see picture below).

    Is this possible through custom php?

    If so, could you help me out?

    thanks.

    #1264290
    yhshin1020
    Participant
    This reply has been marked as private.
    #1264323
    Thai
    Moderator

    Hi There,

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

    add_filter( 'the_content', 'x_custom_content' );
    function x_custom_content($content){
    	if(is_singular( 'post' )){
    		ob_start();
    		?>
    		<div id="x-section-1" class="x-section" style="margin: 0px;padding: 45px 0px; background-color: transparent;"><div class="x-container" style="margin: 0px auto;padding: 0px;"><div class="x-column x-sm x-1-1" style="padding: 0px;"><hr class="x-hr" style="border-top-color: hsl(0, 0%, 58%);border-top-width: 1px;"><div class="x-text"><p class="donatebanner">GDAB is a non-profit voluntary welfare organisation, and has been accorded Charity status by the Commissioner of Charities. We are registered with the National Council of Social Service (NCSS) as an associate member and holds an Institute of Public Character status.</p>
    		<p><em>Please consider making a donation to help support the work that we do.</em></p>
    		</div><div class="x-text center-text"><p><button class="fill"><a target="_blank" href="https://give.asia/charity/guide_dogs_association_of_the_blind_ltd">DONATE</a></button></p>
    		</div></div></div></div>
    		<?php
    		return $content . ob_get_clean();
    
    	}
    	return $content;
    }

    Hope it helps 🙂

    #1264355
    yhshin1020
    Participant

    Thanks.

    #1264363
    Thai
    Moderator

    You’re most welcome 🙂

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