• Resolved Deniska

    (@deniska)


    I want to get data from array. This code is working:

    add_filter( 'single_template', 'my_template' );
    function my_template( $template ) {
    $catid = array(4,5,6);
    if ( in_category($catid) )
    $template = locate_template( array( 'single-port.php' ) );
    return $template;
    }

    but I try to set data like this :

    add_filter( 'single_template', 'my_template' );
    function my_template( $template ) {
    $catid = array(get_option('imp_cat'));
    if ( in_category($catid) )
    $template = locate_template( array( 'single-port.php' ) );
    return $template;
    }

    Last example doesnt work. Categories ID doesn’t received.What I need to do?
    Thanks!

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

The topic ‘Can’t get data from array’ is closed to new replies.