• jwzumwalt

    (@jwzumwalt)


    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    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 🙂

    Thread Starter jwzumwalt

    (@jwzumwalt)

    Thank you for your reply.

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

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    That would be correct.

    Thread Starter jwzumwalt

    (@jwzumwalt)

    Thanks for the help.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Where does initalization code belong’ is closed to new replies.