WordPress.org

Ready to get started?Download WordPress

Forums

Where does initalization code belong (5 posts)

  1. jwzumwalt
    Member
    Posted 2 years ago #

    I am new to WP. I ran accross a code snippet that allows a custom post type to be used as an event list.

    add_action( 'init', 'create_post_type' );
    function create_post_type() {
    register_post_type( 'event',
    ... etc

    I was not told what file to put this code in...
    Where does it belong?
    Where does initalization code belong?
    If it goes in functions.php, where should it be called from?

    Thanks - jz

  2. In your function.php is a good place.

    You don't have to 'call' it, though. The code you were given (add_action...) will do that :)

  3. jwzumwalt
    Member
    Posted 2 years ago #

    Thank you for your reply.

    If I understand you correctly... WP somehow scans functions.php and automaticaly executes that?
    JZ

  4. That would be correct.

  5. jwzumwalt
    Member
    Posted 2 years ago #

    Thanks for the help.

Topic Closed

This topic has been closed to new replies.

About this Topic