WordPress.org

Support

Support » How-To and Troubleshooting » Need to know how to include a .php file inside a php include call

Need to know how to include a .php file inside a php include call

  • 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!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need to know how to include a .php file inside a php include call’ is closed to new replies.