560, 780, 950 ); // Load style settings if ( K2_STYLES ) { $styleinfo = get_option('k2styleinfo'); if ( ! empty($styleinfo) ) { // style contains header height setting if ( ! empty($styleinfo['header_height']) ) @define( 'HEADER_IMAGE_HEIGHT', $styleinfo['header_height'] ); // style contains header width setting if ( ! empty($styleinfo['header_width']) ) @define( 'HEADER_IMAGE_WIDTH', $styleinfo['header_width'] ); // style contains layout widths setting if ( ! empty($styleinfo['layout_widths'][$columns]) ) @define( 'HEADER_IMAGE_WIDTH', $styleinfo['layout_widths'][$columns] ); if ( ! empty($styleinfo['header_text_color']) ) @define( 'HEADER_TEXTCOLOR', $styleinfo['header_text_color'] ); } } // Default settings @define( 'HEADER_IMAGE_HEIGHT', 200 ); @define( 'HEADER_IMAGE_WIDTH', $default_widths[$columns] ); @define( 'HEADER_TEXTCOLOR', 'ffffff' ); @define( 'HEADER_IMAGE', '%s/images/transparent.gif' ); // Only load Custom Image Header if GD is installed if ( extension_loaded('gd') && function_exists('gd_info') ) { add_custom_image_header(array('K2Header', 'output_header_css'), array('K2Header', 'output_admin_header_css')); } } function install() { add_option('k2headerimage', '', 'Current Header Image'); add_option('k2blogornoblog', 'Blog', 'The text on the first tab in the header navigation.'); } function uninstall() { delete_option('k2headerimage'); delete_option('k2blogornoblog'); remove_theme_mods(); } function display_options() { // Get the current header picture $current_header_image = get_option('k2headerimage'); // Get the header pictures $header_images = K2Header::get_header_images(); ?>
  • %1$s px by %2$s px.', 'k2_domain'), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT ); if ( extension_loaded('gd') and function_exists('gd_info') ) { printf( __(' Use %s to customize the header.', 'k2_domain'), '' . __('Custom Image Header', 'k2_domain') . '' ); } ?>

  • 1 ) $header_image = $images[ rand(0, $size - 1) ]; else $header_image = $images[0]; } // image is an attachment if ( is_numeric($header_image) ) { $header_image = wp_get_attachment_url($header_image); if ( empty($header_image) ) return false; return $header_image; } return K2_HEADERS_URL . "/$header_image"; } function get_header_images() { global $wpdb; $images = K2::files_scan(K2_HEADERS_DIR, array('gif','jpeg','jpg','png'), 1); $attachment_ids = $wpdb->get_results("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'k2-header-image'", ARRAY_N); if ( !empty($attachment_ids) ) foreach ( $attachment_ids as $id_array ) $images[] = $id_array[0]; return $images; } function output_header_css() { $image_url = K2Header::get_header_image_url(); ?>