WordPress.org

Support

Support » Themes and Templates » Setting PHP constants

Setting PHP constants

  • I am creating a new theme for use on two or three sites.

    My code needs to be able to exclude/include posts with specific Categories which can simply be done if you know the Cat-id.

    Of course, Categories are numbered at set-up time and as I believe I cannot set a Category to a particular Cat-id I have decided to set global constants in one place and set a group of names to the corresponding Cat-id and use the constant throughout the theme code.

    At present I am doing this with define() in index.php at the wordpress root to be sure that the constants are available throughout the theme but I would rather set them inside my theme and out of danger of WordPress updates!

    So

    a) am I right about Category-ids
    b) is there some place where my define() will be executed every time?

    Beano

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Setting PHP constants’ is closed to new replies.
Skip to toolbar