get_queried_object_id(); /* Check if the user has set a value for the post stylesheet. */ $stylesheet = get_post_meta( $post_id, $meta_key, true ); /* If a meta value was given and the file exists, set $stylesheet_uri to the new file. */ if ( !empty( $stylesheet ) ) { /* If the stylesheet is found in the child theme '/css' folder, use it. */ if ( file_exists( trailingslashit( get_stylesheet_directory() ) . "css/{$stylesheet}" ) ) $stylesheet_uri = trailingslashit( $stylesheet_dir_uri ) . "css/{$stylesheet}"; /* Else, if the stylesheet is found in the parent theme '/css' folder, use it. */ elseif ( file_exists( trailingslashit( get_template_directory() ) . "css/{$stylesheet}" ) ) $stylesheet_uri = trailingslashit( get_template_directory_uri() ) . "css/{$stylesheet}"; } } /* Return the stylesheet URI. */ return $stylesheet_uri; } ?>