• I am curious about adding new actions/filters to functions.php. Should I separate each action and filter inside its own <?php ?> tag? Or should it all be compiled into one and separated just by the semi-colon?

    If more clarity is needed, please post it here so I can try and clarify a bit better.

Viewing 2 replies - 1 through 2 (of 2 total)
  • It’s fine to put them all together.

    The functions.php is a PHP file. That means that by default you can start the file with <?php and put as much as you want – and then close the file with ?>

    The only time you close the PHP tag is when you want to post HTML to the website (or run another language, I suppose). Like in your theme files like page.php or header.php where you would stop using PHP for a while and use HTML instead:

    EG: <?php if(is_page()){ ?>Some cool html here<?php } ?>

    In the example, it says “if this is a page” (using PHP) and then switches back to HTML for a while. Then when you’re done posting HTML code you close it back up with another php setting <?php } ?>

    I hope that helps clear up how PHP works within the theme structure for ya!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Quick Functions.php Question’ is closed to new replies.