Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1018660

    Hello, I have created a blog page template in Cornerstone (http://staging.wanderingearl.com/template-demonstration-post/) but I would prefer it have it hardcoded the PHP for the individual post page rather than having to use the template. The blogger who is using this site is comfortable with the WP text entry area and would prefer to use it rather than the template. Can you let me know how to do this?

    Thanks in advance!

    #1018719
    Nabeel A
    Moderator

    Hi there,

    Thanks for writing in! Regretfully this isn’t a feature offered by X. It could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

    Thanks for understanding. Take care!

    #1026762

    Thanks for the response. I understand that this is outside the scope of the existing theme and am willing to make the changes myself but I was hoping you could advise me on the proper php edits. Thank you.

    #1027328
    Rad
    Moderator

    Hi there,

    You mean add static content on the bottom of every user added content? Should it be specific to post or page too?

    You can do this, add this code to your child theme’s functions.php with your pre-made content.

    add_filter( 'the_content', 'global_content', 99999 );
    
    function global_content ( $content ) {
    
    if ( is_singular() ) {
    
    ob_start(); ?>
    
    <!--- YOUR CONTENT HERE -->
    
    <?php
    
    $content.= ob_get_clean();
    
    }
    
    return $content;
    
    }

    If it’s shortcode templates, then you can do something like this

    add_filter( 'the_content', 'global_content', 99999 );
    
    function global_content ( $content ) {
    
    if ( is_singular() ) {
    
    $content.= do_shortcode('<!----your shortcode content here-->');
    
    }
    
    return $content;
    
    }

    And if you wish to target pages too, then change it to :

    if ( is_singular() || is_page() )

    Cheers!

    #1028383

    Thank you very much! I’m looking to add the content to the bottom of every blog post but don’t need it to display on any other pages.

    #1029134
    Rad
    Moderator

    Hi there,

    In that case, don’t add || is_page() in your code 🙂

    Cheers!

    #1029901

    Okay, thanks again. You guys rule!

    #1030107
    Thai
    Moderator

    You’re most welcome 🙂

    If you need anything else please let us know.

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