• Hello
    I have few lines of code in a theme, I did not understood, can anyone explain me this.
    $screen = get_current_screen(); // understood this
    if ( $screen && ‘post’ == $screen->base && ‘page’ == $screen->id ) { // not sure about this line
    // code to execute something
    }

    As per I have understood the code is executed when post type is post or page, I am not sure how, I need to add another custom post type ( playe r) in that if statement.

Viewing 1 replies (of 1 total)
  • I’ll write it in English.
    if ( $screen && ‘post’ == $screen->base && ‘page’ == $screen->id )
    If the $screen variable has a value AND the $screen base equals ‘post’ AND the $screen id equals ‘page’

    Themes shouldn’t be doing things based on admin pages, or custom post types. Put the code in a plugin.

Viewing 1 replies (of 1 total)

The topic ‘what does this code means’ is closed to new replies.