WordPress.org

Ready to get started?Download WordPress

Forums

including a carousel (4 posts)

  1. pdxDaniela
    Member
    Posted 2 months 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
    dlm

  2. KostasNi
    Member
    Posted 2 months 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
    Member
    Posted 2 months 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
    Member
    Posted 2 months 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
    D

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

Reply

You must log in to post.

About this Topic