WordPress.org

Ready to get started?Download WordPress

Forums

Need to know how to include a .php file inside a php include call (4 posts)

  1. Focoloco
    Member
    Posted 2 years ago #

    I would like to include a sidebar.php file based in the category name. The file is the same name as the category. How do I call the file in the PHP include() code so that it grabs the current category name?

    I've tried something like

    <?php include('<?php the_category(' ') ?>.php'); ?>
    but it didn't work.

    THANKS!

  2. stvwlf
    Member
    Posted 2 years ago #

  3. Focoloco
    Member
    Posted 2 years ago #

    Thanks but still not resolved.

  4. stvwlf
    Member
    Posted 2 years ago #

    Do you mean when you are viewing a category archive page, where all the posts on the page are in one category, or when you are looking at a single post that is assigned to some category?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags