including a carousel (4 posts)

  1. pdxDaniela
    Posted 2 years ago #

    I am trying to call in a carousl. I saved it on its own php file. and am trying to call it in custom page by using

    <?php include(ABSPATH . 'carousel.php'); ?>
    Not working. Could someone please advs I also tried
    <?php include(STYLESHEETPATH.'carousel.php');?>
    And that did not work either.
    thank you

  2. KostasNi
    Posted 2 years ago #

    Is the carousel.php file in your theme directory? If not move it there and then you can use:

    <?php get_template_part('carousel'); ?>

  3. John S
    Posted 2 years ago #

    If carousel.php is in the template folder you could try

    <?php include(get_template_directory() . '/carousel.php'); ?>

    or perhaps get_stylesheet_directory() depending on where your file is located. More info about that here: http://codex.wordpress.org/Function_Reference/get_template_directory

    Based on what i've read, STYLESHEETPATH and ABSPATH are deprecated so it's not recommended to use them or their counterparts, Ref: https://core.trac.wordpress.org/ticket/18298

    Edit: Also +1 for KostasNi's solution

  4. pdxDaniela
    Posted 2 years ago #

    Hey guys. thank you. You were also right I found and used
    <?php get_template_part('carousel', 'page'); ?>
    And it worked.

    Thank you for letting me know about the deprecation!
    You all have a good weekend

    if you know of a good link for styling the navbar w/bootsrap let me know please!

Topic Closed

This topic has been closed to new replies.

About this Topic