Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #526960

    Hi I have been trying to work out how I can load content via a php include within my page. Tried various ways with no luck.

    I am looking to incorporate
    include('/home/mobile/public_html/4u4/quote/testimonial.php');
    so that each time the page loads it displays a different testimonial that are all stored in a separate file.

    Any help appreciated!!!

    #526963

    Hi thewormman!

    I would just copy the code in the file and paste it into the page.php template. Around line 30 will have it display beneath all of your regular page content.

    Cheers!
    Elliott

    #526995

    Thanks Elliot trying to learn this as I go along, where would I find the page.php template?

    Sorry if Im being a bit dense

    Thanks

    #526999

    Also I only want to run it on my main front page

    #527030

    Hi!

    It’s in the Enfold theme folder. If you only want to display something on the homepage then you can surround it with this.

    if ( is_home() || is_front_page() ) {
    
    }

    Does this script have a shortcode or function you can use? If you haven’t noticed it yet we have our own testimonial elements you can use, http://kriesi.at/themes/enfold/shortcodes/testimonials/.

    Cheers!
    Elliott

    #527133

    Hi Elliot thanks for your patience

    So I would just put in

    <?php if ( is_home() || is_front_page() ) {
    include('/home/mobile/public_html/4u4/quote/testimonial.php');
    } ?>

    at the bottom of page.php template is that right?

    #527272

    Hi could you just confirm I have this correct thanks

    So I would just put in

    <?php if ( is_home() || is_front_page() ) {
    include('/home/mobile/public_html/4u4/quote/testimonial.php');
    } ?>

    at the bottom of page.php template is that right?

    #527289

    That isnt showing up at all is there something else I need to do to enable it????

    Getting a bit frustrated now…

    #527485

    Ok after no further replies I have worked it out myself so I will explain in case anyone searches for the same thing. Bit disappointed no further help was forthcoming.

    If the code is placed in page.php as stated by Elliot above it will only show up in the basic page with no modifications or content added. As soon as content/layout elements are added page.php isn’t used and template-builder.php is, so by adding the include code to the page just before the footer code on template-builder.php it will appear.
    The additional code stated by Elliot to show only on the home page, can be used here and works.

    Last part of template-builder.php

    echo avia_sc_section::$close_overlay;
    echo '		</div><!--end builder template-->';
    echo '</div><!-- close default .container_wrap element -->';
    //inserted code
    if ( is_home() || is_front_page() ) {
    include('/home/mobile/public_html/4u4/quote/testimonial.php');
     }
    // end of inserted code
    get_footer();
    #528137

    Hi!

    Glad you got it sorted. Also, keep in mind that when a topic gets a reply it will reset it’s position in the queue so it just takes longer for us to see it when you bump your own topic.

    Cheers!
    Elliott

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.