コード例 #1
0
 /**
  * Sets up theme defaults and registers support for various WordPress features.
  *
  * Note that this function is hooked into the after_setup_theme hook, which runs
  * before the init hook. The init hook is too late for some features, such as indicating
  * support post thumbnails.
  */
 function chaostheory_setup()
 {
     /**
      * Make theme available for translation
      * Translations can be filed in the /languages/ directory
      * If you're building a theme based on chaostheory, use a find and replace
      * to change 'chaostheory' to the name of your theme in all the template files
      */
     load_theme_textdomain('chaostheory', get_template_directory() . '/languages');
     /**
      * Add default posts and comments RSS feed links to head
      */
     add_theme_support('automatic-feed-links');
     /**
      * Enable support for Post Thumbnails on posts and pages
      *
      * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
      */
     add_theme_support('post-thumbnails');
     set_post_thumbnail_size(get_custom_header()->width, get_custom_header()->height, true);
     /**
      * This theme uses wp_nav_menu() in one location.
      */
     register_nav_menus(array('primary' => __('Primary Navigation', 'chaostheory')));
 }
コード例 #2
0
function cc_add_header_image()
{
    global $post;
    $header_image = get_header_image();
    $custom_header_image = get_custom_header();
    /*echo '<!-- debug: header_image ' . print_r( array('header_image' => $header_image, 'custom_header_image' => $custom_header_image ), true ). ' -->';*/
    if (!empty($header_image)) {
        ?>
	<div class="cc-header-image">	
		<a class="cc-header-image-link" href="<?php 
        echo esc_url(home_url('/'));
        ?>
" title="<?php 
        echo esc_attr(get_bloginfo('name', 'display'));
        ?>
" rel="home">
			<img src="<?php 
        echo $header_image;
        ?>
" width="<?php 
        echo $custom_header_image->width;
        ?>
" height="<?php 
        echo $custom_header_image->height;
        ?>
" alt="">
		</a>
	</div>	
	<?php 
    }
}
コード例 #3
0
 function mh_logo()
 {
     $header_img = get_header_image();
     $header_title = get_bloginfo('name');
     $header_desc = get_bloginfo('description');
     echo '<a href="' . esc_url(home_url('/')) . '" title="' . esc_attr($header_title) . '" rel="home">' . "\n";
     echo '<div class="logo-wrap" role="banner">' . "\n";
     if ($header_img) {
         echo '<img src="' . esc_url($header_img) . '" height="' . get_custom_header()->height . '" width="' . get_custom_header()->width . '" alt="' . esc_attr($header_title) . '" />' . "\n";
     }
     if (display_header_text()) {
         $header_img ? $logo_pos = 'logo-overlay' : ($logo_pos = 'logo-text');
         $text_color = get_header_textcolor();
         if ($text_color != get_theme_support('custom-header', 'default-text-color')) {
             echo '<style type="text/css" id="mh-header-css">';
             echo '.logo-name, .logo-desc { color: #' . esc_attr($text_color) . '; }';
             echo '.logo-name { border-bottom: 3px solid #' . esc_attr($text_color) . '; }';
             echo '</style>' . "\n";
         }
         echo '<div class="logo ' . $logo_pos . '">' . "\n";
         if ($header_title) {
             echo '<h1 class="logo-name">' . esc_attr($header_title) . '</h1>' . "\n";
         }
         if ($header_desc) {
             echo '<h2 class="logo-desc">' . esc_attr($header_desc) . '</h2>' . "\n";
         }
         echo '</div>' . "\n";
     }
     echo '</div>' . "\n";
     echo '</a>' . "\n";
 }
コード例 #4
0
 /**
  * Styles the header image and text displayed on the blog
  *
  * @see chuchadon_custom_header_setup().
  */
 function chuchadon_header_style()
 {
     /* Header text color. */
     $header_color = get_header_textcolor();
     /* Header image. */
     $header_image = esc_url(get_header_image());
     /* Start header styles. */
     $style = '';
     /* Header image height. */
     $header_height = get_custom_header()->height;
     /* Header image width. */
     $header_width = get_custom_header()->width;
     /* When to show header image. */
     $min_width = absint(apply_filters('chuchadon_header_bg_show', 800));
     $background_arguments = esc_attr(apply_filters('chuchadon_header_bg_arguments', 'no-repeat'));
     if (!empty($header_image)) {
         $style .= "@media screen and (min-width: {$min_width}px) { body.custom-header-image .site-header { background: url({$header_image}) {$background_arguments}; -webkit-background-size: 50%; -moz-background-size: 50%; -o-background-size: 50%; background-size: 50%; } }";
     }
     /* Site title styles. */
     if (display_header_text()) {
         $style .= ".home-title a { color: #{$header_color} }";
     }
     if (!display_header_text()) {
         $style .= ".home-title, .home-description { clip: rect(1px, 1px, 1px, 1px); position: absolute; height: 1px; width: 1px; overflow: hidden; }";
     }
     /* Echo styles if it's not empty. */
     if (!empty($style)) {
         echo "\n" . '<style type="text/css" id="custom-header-css">' . trim($style) . '</style>' . "\n";
     }
 }
コード例 #5
0
    /**
     * Shows the small info text on top header part
     */
    function colormag_render_header_image()
    {
        $header_image = get_header_image();
        if (!empty($header_image)) {
            if (get_theme_mod('colormag_header_image_link', 0) == 1) {
                ?>
		<a href="<?php 
                echo esc_url(home_url('/'));
                ?>
" title="<?php 
                echo esc_attr(get_bloginfo('name', 'display'));
                ?>
" rel="home">
		<?php 
            }
            ?>
		<div class="header-image-wrap"><img src="http://thevrforums.com/images/banner.png" class="header-image" width="<?php 
            echo get_custom_header()->width;
            ?>
" height="<?php 
            echo get_custom_header()->height;
            ?>
" alt="<?php 
            echo esc_attr(get_bloginfo('name', 'display'));
            ?>
"></div>
	<?php 
            if (get_theme_mod('colormag_header_image_link', 0) == 1) {
                ?>
		</a>
		<?php 
            }
        }
    }
コード例 #6
0
ファイル: custom-header.php プロジェクト: MagikPress/magik
/**
 * Callback function for outputting the custom header CSS to `wp_head`.
 *
 * @since  1.0.0
 * @access public
 * @return void
 */
function magik_custom_header_wp_head()
{
    $header_image = get_header_image();
    $style = "body.custom-header #branding {  }";
    $style = sprintf('body.custom-header #branding { background: url(%1$s) center center no-repeat !important; text-indent: -9999px;background-size: %2$dpx %3$dpx !important; min-height: %3$dpx}', esc_url($header_image), absint(get_custom_header()->width / 2), absint(get_custom_header()->height / 2));
    echo "\n" . '<style type="text/css" id="custom-header-css">' . trim($style) . '</style>' . "\n";
}
コード例 #7
0
ファイル: header.php プロジェクト: aragonc/chamiluda
    /**
     * Creates the tag for header image
     */
    function franz_header_image()
    {
        $header = get_custom_header();
        if ($header->url) {
            /* Scale hidpi header image */
            $custom_header = get_theme_support('custom-header');
            $header_args = array_pop($custom_header);
            if ($header->width >= 2 * $header_args['width']) {
                $header->width = floor($header->width / 2);
                $header->height = floor($header->height / 2);
            }
            ?>
       <img class="img-responsive" src="<?php 
            echo esc_url($header->url);
            ?>
" height="<?php 
            echo esc_attr($header->height);
            ?>
" width="<?php 
            echo esc_attr($header->width);
            ?>
" alt="" /> 
         
    <?php 
        } else {
            bloginfo('name');
        }
    }
コード例 #8
0
 function mh_newsdesk_lite_logo()
 {
     $header_img = get_header_image();
     $header_title = get_bloginfo('name');
     $header_desc = get_bloginfo('description');
     echo '<a href="' . esc_url(home_url('/')) . '" title="' . esc_attr($header_title) . '" rel="home">' . "\n";
     echo '<div class="logo-wrap" role="banner">' . "\n";
     if ($header_img) {
         echo '<img src="' . esc_url($header_img) . '" height="' . get_custom_header()->height . '" width="' . get_custom_header()->width . '" alt="' . esc_attr($header_title) . '" />' . "\n";
     }
     if (0 && display_header_text()) {
         $text_color = get_header_textcolor();
         if ($text_color != get_theme_support('custom-header', 'default-text-color')) {
             echo '<style type="text/css" id="mh-header-css">';
             echo '.logo-title, .logo-tagline { color: #' . esc_attr($text_color) . '; }';
             echo '</style>' . "\n";
         }
         echo '<div class="logo">' . "\n";
         if ($header_title) {
             echo '<h1 class="logo-title">' . esc_attr($header_title) . '</h1>' . "\n";
         }
         if ($header_desc) {
             echo '<h2 class="logo-tagline">' . esc_attr($header_desc) . '</h2>' . "\n";
         }
         echo '</div>' . "\n";
     }
     echo '</div>' . "\n";
     echo '</a>' . "\n";
 }
コード例 #9
0
ファイル: custom-header.php プロジェクト: double360/wordpress
/**
 * Outputs markup to be displayed on the Appearance > Header admin panel.
 * This callback overrides the default markup displayed there.
 *
 */
function encounters_lite_admin_header_image()
{
    ?>
	<div id="headimg">
		
		<?php 
    $header_image = get_header_image();
    if (!empty($header_image)) {
        ?>
			<img src="<?php 
        echo esc_url($header_image);
        ?>
" class="header-image" width="<?php 
        echo get_custom_header()->width;
        ?>
" height="<?php 
        echo get_custom_header()->height;
        ?>
" alt="" />
		<?php 
    }
    ?>
	</div>
<?php 
}
コード例 #10
0
/** Styles the header image and text displayed on the blog preview. */
function contango_admin_header_image()
{
    ?>
<div id="headimg">	
<?php 
    if (get_header_image()) {
        ?>

<div id="logo-image">
  <a href="<?php 
        echo esc_url(home_url('/'));
        ?>
" onclick="return false;"><img src="<?php 
        header_image();
        ?>
" width="<?php 
        echo esc_attr(get_custom_header()->width);
        ?>
" height="<?php 
        echo esc_attr(get_custom_header()->height);
        ?>
" alt="<?php 
        bloginfo('name');
        ?>
" /></a>
</div><!-- end of #logo -->

<?php 
    } else {
        // header image was removed
        ?>

<div id="logo-text">
  <span class="site-name"><a href="<?php 
        echo esc_url(home_url('/'));
        ?>
" onclick="return false;" title="<?php 
        echo esc_attr(get_bloginfo('name', 'display'));
        ?>
" rel="home"><?php 
        bloginfo('name');
        ?>
</a></span>
  <span class="site-description"><?php 
        bloginfo('description');
        ?>
</span>
</div><!-- end of #logo -->

<?php 
    }
    // header image was removed (again)
    ?>

</div>

<?php 
}
コード例 #11
0
function igthemes_header_branding()
{
    ?>
<div class="site-branding col12">
    <?php 
    if (get_header_image()) {
        ?>
            <img src="<?php 
        header_image();
        ?>
" width="<?php 
        echo get_custom_header()->width;
        ?>
" height="<?php 
        echo get_custom_header()->height;
        ?>
" class="header-image">
    <?php 
    }
    // End header image check.
    ?>
    <?php 
    if (igthemes_get_option('logo')) {
        ?>
            <a href="<?php 
        echo esc_url(home_url('/'));
        ?>
" id="site-logo" title="<?php 
        echo esc_attr(get_bloginfo('name', 'display'));
        ?>
" rel="home">
            <img src="<?php 
        echo esc_url(igthemes_get_option('logo'));
        ?>
" alt="<?php 
        echo esc_attr(bloginfo('name'));
        ?>
"></a>
    <?php 
    } else {
        ?>
    <h1 class="site-title">
        <a href="<?php 
        echo esc_url(home_url('/'));
        ?>
" rel="home"><?php 
        bloginfo('name');
        ?>
</a>
    </h1>
        <?php 
    }
    ?>
</div><!-- .site-branding -->
<?php 
}
コード例 #12
0
ファイル: functions.php プロジェクト: brstgt/layuda
function adelle_theme_heading()
{
    if (get_header_image() == true) {
        ?>
    <a href="<?php 
        echo esc_url(home_url());
        ?>
">
      <img src="<?php 
        header_image();
        ?>
" class="header-title" height="<?php 
        echo get_custom_header()->height;
        ?>
" width="<?php 
        echo get_custom_header()->width;
        ?>
" alt="<?php 
        bloginfo('name');
        ?>
" title="<?php 
        bloginfo('name');
        ?>
" />
    </a>
  <?php 
    } elseif (is_home() || is_front_page()) {
        ?>
      <h1><a href="<?php 
        echo esc_url(home_url());
        ?>
" class="header-title"><?php 
        bloginfo('name');
        ?>
</a></h1>
      <p class="header-desc"><?php 
        bloginfo('description');
        ?>
</p>
  <?php 
    } else {
        ?>
      <h5><a href="<?php 
        echo esc_url(home_url());
        ?>
" class="header-title"><?php 
        bloginfo('name');
        ?>
</a></h5>
      <p class="header-desc"><?php 
        bloginfo('description');
        ?>
</p>
  <?php 
    }
}
コード例 #13
0
function ubersmake_custom_header_setup()
{
    $args = array('default-image' => '%2$s/images/headers/atrium.jpg', 'default-text-color' => '000', 'width' => apply_filters('pilcrow_header_image_width', 990), 'height' => apply_filters('pilcrow_header_image_height', 257), 'wp-head-callback' => 'pilcrow_header_style', 'admin-head-callback' => 'pilcrow_admin_header_style', 'admin-preview-callback' => 'pilcrow_admin_header_image');
    $options = pilcrow_get_theme_options();
    if (in_array($options['theme_layout'], array('content-sidebar', 'sidebar-content'))) {
        $args['width'] = apply_filters('pilcrow_header_image_width', 770);
        $args['height'] = apply_filters('pilcrow_header_image_height', 200);
    }
    add_theme_support('custom-header', apply_filters('pilcrow_custom_header_args', $args));
    set_post_thumbnail_size(get_custom_header()->width, get_custom_header()->height, true);
    register_default_headers(array('atrium' => array('url' => '%2$s/images/headers/atrium.jpg', 'thumbnail_url' => '%2$s/images/headers/atrium-thumbnail.jpg', 'description' => _x('Atrium', 'Header image description', 'ubersmake'), 'source' => 'https://www.flickr.com/photos/ubersmake/14967126893/'), 'cafe' => array('url' => '%2$s/images/headers/cafe.jpg', 'thumbnail_url' => '%2$s/images/headers/cafe-thumbnail.jpg', 'description' => _x('Cafe', 'Header image description', 'ubersmake'), 'source' => 'https://www.flickr.com/photos/ubersmake/15836437415/'), 'causeway' => array('url' => '%2$s/images/headers/causeway.jpg', 'thumbnail_url' => '%2$s/images/headers/causeway-thumbnail.jpg', 'description' => _x('Causeway', 'Header image description', 'ubersmake'), 'source' => 'https://www.flickr.com/photos/ubersmake/14975660961/'), 'edinburgh' => array('url' => '%2$s/images/headers/edinburgh.jpg', 'thumbnail_url' => '%2$s/images/headers/edinburgh-thumbnail.jpg', 'description' => _x('edinburgh', 'Header image description', 'ubersmake'), 'source' => 'https://www.flickr.com/photos/ubersmake/15062454096/'), 'paris' => array('url' => '%2$s/images/headers/paris.jpg', 'thumbnail_url' => '%2$s/images/headers/paris-thumbnail.jpg', 'description' => _x('Paris', 'Header image description', 'ubersmake'), 'source' => 'https://www.flickr.com/photos/ubersmake/15174505258/')));
}
コード例 #14
0
ファイル: hatch-customheader.php プロジェクト: benlaud/hatch
 /**
  * Enqueue our custom header styles/scripts
  *
  * @access public
  */
 function wp_enqueue_scripts()
 {
     $hero = '#homepage-hero {';
     $hero .= 'background-image:url(' . get_custom_header()->url . ');';
     $hero .= 'background-color:' . get_theme_mod('header_bg_color') . ';';
     $hero .= 'padding: 1.25rem 0;';
     $hero .= 'margin: -2rem 0 2rem;';
     $hero .= 'position: relative;';
     $hero .= 'text-align: left;';
     $hero .= 'height: auto;';
     $hero .= '}';
     $hero .= '#homepage-hero h1 a, #homepage-hero h4 {color:#' . get_header_textcolor() . '}';
     wp_add_inline_style('app-css', $hero);
 }
コード例 #15
0
function cleansimplewhite_header_style()
{
    $header_image = get_header_image();
    ?>
    <style>
    
    #header a:link,
    #header a:visited {
        color: <?php 
    echo get_theme_mod('header_link_color');
    ?>
 !important;
    }
    #header div {
        color: <?php 
    echo get_theme_mod('header_text_color');
    ?>
 !important;
    }
    
    <?php 
    if (!empty($header_image)) {
        ?>
    #header {
        background-image: url(<?php 
        echo $header_image;
        ?>
);
        height: <?php 
        echo get_custom_header()->height;
        ?>
px;
    }
    <?php 
    }
    ?>
    
    <?php 
    if (!display_header_text()) {
        ?>
    #header * {
        text-indent: -9999px;
    }
    <?php 
    }
    ?>
    
    </style>
    <?php 
}
コード例 #16
0
 function mh_logo()
 {
     $header_img = get_header_image();
     echo '<div class="logo-wrap" role="banner">' . "\n";
     if ($header_img) {
         echo '<a href="' . esc_url(home_url('/')) . '" title="' . get_bloginfo('name') . '" rel="home"><img src="' . $header_img . '" height="' . get_custom_header()->height . '" width="' . get_custom_header()->width . '" alt="' . get_bloginfo('name') . '" /></a>' . "\n";
     } else {
         echo '<div class="logo">' . "\n";
         echo '<a href="' . esc_url(home_url('/')) . '" title="' . get_bloginfo('name') . '" rel="home">' . "\n";
         echo '<h1 class="logo-name">' . get_bloginfo('name') . '</h1>' . "\n";
         echo '<h2 class="logo-desc">' . get_bloginfo('description') . '</h2>' . "\n";
         echo '</a>' . "\n";
         echo '</div>' . "\n";
     }
     echo '</div>' . "\n";
 }
コード例 #17
0
    /**
     * Styles the header image displayed on the Appearance > Header admin panel.
     *
     * @see listify_custom_header_setup().
     */
    function listify_admin_header_style()
    {
        /* Supplimentary CSS */
        wp_enqueue_style('listify-fonts', listify_fonts_url());
        $header_image = get_custom_header();
        ?>
	<style type="text/css">
		.appearance_page_custom-header #headimg {
			border: none;
			background-color: <?php 
        echo listify_theme_mod('color-header-background');
        ?>
;
			padding: 10px;
			width: auto;
		}

		.appearance_page_custom-header #headimg img {
			float: none;
			display: inline-block;
			vertical-align: middle;
		}

		#headimg h1 {
			margin: 0 0 0 20px;
			font-family:  'Montserrat', sans-serif;
			font-size: 26px;
			font-weight: normal;
			display: inline-block;
			vertical-align: middle;
		}

		#headimg h1 a {
			text-decoration: none;
		}

		#desc {
			display: none;
		}

		#headimg img {
			float: left;
		}
	</style>
<?php 
    }
コード例 #18
0
ファイル: functions.php プロジェクト: BBGInnovate/rizeWP
function independent_publisher_site_info()
{
    ?>
	<?php 
    if (get_header_image()) {
        ?>
		<a class="site-logo" href="<?php 
        echo esc_url(home_url('/'));
        ?>
" title="<?php 
        echo esc_attr(get_bloginfo('name', 'display'));
        ?>
" rel="home">
			<img class="no-grav" src="<?php 
        echo esc_url(get_header_image());
        ?>
" height="<?php 
        echo absint(get_custom_header()->height);
        ?>
" width="<?php 
        echo absint(get_custom_header()->width);
        ?>
" alt="<?php 
        echo esc_attr(get_bloginfo('name', 'display'));
        ?>
" />
		</a>
	<?php 
    }
    ?>
	<h1 class="site-title">
		<a href="<?php 
    echo esc_url(home_url('/'));
    ?>
" title="<?php 
    echo esc_attr(get_bloginfo('name', 'display'));
    ?>
" rel="home">Africa <span class="orangeHighlight">Rizing</span></a>
	</h1>
	<h2 class="site-description"><?php 
    bloginfo('description');
    ?>
</h2>
	<?php 
    get_template_part('menu', 'social');
}
コード例 #19
0
ファイル: functions.php プロジェクト: ayumuWorks/Website
/**
 * 管理ページ、カスタムヘッダーのスタイル
 */
function admin_header_style()
{
    ?>
<style type="text/css">
	#headimg {
		max-width: <?php 
    echo get_custom_header()->width;
    ?>
px;
		height: <?php 
    echo get_custom_header()->height;
    ?>
px;
	}
</style>
<?php 
}
コード例 #20
0
ファイル: header.php プロジェクト: honeymustard/teaberry
/**
 * output markup to be displayed in the admin panel
 */
function teaberry_admin_header_image()
{
    ?>

    <div id="headimg">

    <?php 
    $image = get_header_image();
    if (!empty($image)) {
        $header = array('image' => esc_url($image), 'class' => 'header-image', 'width' => get_custom_header()->width, 'height' => get_custom_header()->height);
        vprintf('<img src="%s" class="%s" width="%s" height="%s" alt="" />', $header);
    }
    ?>

    </div>

<?php 
}
コード例 #21
0
ファイル: custom.php プロジェクト: ComEnYns/Web-Projects
function matraman_lite_header_default()
{
    echo '<div class="header-default">';
    ?>

 <img src="<?php 
    header_image();
    ?>
" height="<?php 
    echo get_custom_header()->height;
    ?>
" width="<?php 
    echo get_custom_header()->width;
    ?>
" alt="" />

<?php 
    echo '</div>';
}
コード例 #22
0
 function mh_magazine_lite_custom_header()
 {
     $header_img = get_header_image();
     $header_title = get_bloginfo('name');
     $header_tagline = get_bloginfo('description');
     echo '<div class="mh-custom-header" role="banner">' . "\n";
     echo '<a href="' . esc_url(home_url('/')) . '" title="' . esc_attr(get_bloginfo('name')) . '" rel="home">' . "\n";
     echo '<div class="mh-site-logo" role="banner">' . "\n";
     if ($header_img) {
         echo '<img class="mh-header-image" src="' . esc_url($header_img) . '" height="' . esc_attr(get_custom_header()->height) . '" width="' . esc_attr(get_custom_header()->width) . '" alt="' . esc_attr($header_title) . '" />' . "\n";
     }
     if (display_header_text()) {
         $header_text_color = get_header_textcolor();
         if ($header_text_color != get_theme_support('custom-header', 'default-text-color')) {
             echo '<style type="text/css" id="mh-header-css">';
             echo '.mh-header-title, .mh-header-tagline { color: #' . esc_attr($header_text_color) . '; }';
             echo '</style>' . "\n";
         }
         echo '<div class="mh-header-text">' . "\n";
         if (is_front_page()) {
             $header_title_before = '<h1 class="mh-header-title">';
             $header_title_after = '</h1>' . "\n";
             $header_tagline_before = '<h2 class="mh-header-tagline">';
             $header_tagline_after = '</h2>' . "\n";
         } else {
             $header_title_before = '<h2 class="mh-header-title">';
             $header_title_after = '</h2>' . "\n";
             $header_tagline_before = '<h3 class="mh-header-tagline">';
             $header_tagline_after = '</h3>' . "\n";
         }
         if ($header_title) {
             echo $header_title_before . esc_attr($header_title) . $header_title_after;
         }
         if ($header_tagline) {
             echo $header_tagline_before . esc_attr($header_tagline) . $header_tagline_after;
         }
         echo '</div>' . "\n";
     }
     echo '</div>' . "\n";
     echo '</a>' . "\n";
     echo '</div>' . "\n";
 }
コード例 #23
0
ファイル: header-functions.php プロジェクト: bobth1019/inc
    /**
     * Shows the small info text on top header part
     */
    function esteem_render_header_image()
    {
        $header_image = get_header_image();
        if (!empty($header_image)) {
            ?>
		<img src="<?php 
            echo esc_url($header_image);
            ?>
" class="header-image" width="<?php 
            echo get_custom_header()->width;
            ?>
" height="<?php 
            echo get_custom_header()->height;
            ?>
" alt="<?php 
            echo esc_attr(get_bloginfo('name', 'display'));
            ?>
">
	<?php 
        }
    }
コード例 #24
0
ファイル: header.php プロジェクト: serhi/wordpress-sites
function wcb_header_image()
{
    global $post;
    // Check if this is a post or page, if it has a thumbnail, and if it's a big one
    if (is_singular() && has_post_thumbnail($post->ID) && ($image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'post-thumbnail')) && $image[1] >= get_custom_header()->width) {
        // Houston, we have a new header image!
        echo get_the_post_thumbnail($post->ID);
    } elseif (get_header_image()) {
        ?>
		<img src="<?php 
        header_image();
        ?>
" width="<?php 
        echo get_custom_header()->width;
        ?>
" height="<?php 
        echo get_custom_header()->height;
        ?>
" alt="" />
	<?php 
    }
}
コード例 #25
0
 /**
  * Sets up theme defaults and registers support for various WordPress features.
  *
  * Note that this function is hooked into the after_setup_theme hook, which runs
  * before the init hook. The init hook is too late for some features, such as indicating
  * support post thumbnails.
  */
 function duster_setup()
 {
     /**
      * Make theme available for translation
      * Translations can be filed in the /languages/ directory
      * If you're building a theme based on Duster, use a find and replace
      * to change 'duster' to the name of your theme in all the template files
      */
     load_theme_textdomain('duster', get_template_directory() . '/languages');
     /**
      * Add default posts and comments RSS feed links to head
      */
     add_theme_support('automatic-feed-links');
     /**
      * Enable support for Post Thumbnails on posts and pages
      *
      * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
      */
     add_theme_support('post-thumbnails');
     // We'll be using post thumbnails for custom header images on posts and pages.
     // We want them to be 940 pixels wide by 198 pixels tall.
     // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
     set_post_thumbnail_size(get_custom_header()->width, get_custom_header()->height, true);
     /**
      * Add Duster's custom image sizes
      */
     add_image_size('large-feature', get_custom_header()->width, 500, true);
     // Used for large feature images
     add_image_size('small-feature', 500, 500);
     // Used for featured posts if a large-feature doesn't exist
     /**
      * This theme uses wp_nav_menu() in one location.
      */
     register_nav_menus(array('primary' => __('Primary Menu', 'duster')));
     /**
      * Enable support for Post Formats
      */
     add_theme_support('post-formats', array('aside', 'link', 'gallery', 'status', 'quote'));
 }
コード例 #26
0
ファイル: theme-hooks.php プロジェクト: BraadMartin/Alcatraz
/**
 * Maybe output a Header image.
 *
 * @since  1.0.0
 */
function alcatraz_output_header_image()
{
    if (apply_filters('alcatraz_enable_custom_header', false) && get_header_image()) {
        ?>
		<a href="<?php 
        echo esc_url(home_url('/'));
        ?>
" class="header-image-wrap" rel="home">
			<img src="<?php 
        header_image();
        ?>
" class="header-image" width="<?php 
        echo esc_attr(get_custom_header()->width);
        ?>
" height="<?php 
        echo esc_attr(get_custom_header()->height);
        ?>
" alt="">
		</a>
	<?php 
    }
}
コード例 #27
0
ファイル: functions.php プロジェクト: Harreh/magicowl
/**
 * Custom Header WP Head Callback
 * @since 0.1.1
 */
function genbu_custom_header_wp_head_callback()
{
    /* Default value */
    $style = '';
    /* If display header text, display as background to #header */
    if (display_header_text()) {
        /* Use Header Text Color */
        if (get_header_textcolor()) {
            $style .= '.custom-header #site-title a,';
            $style .= '.custom-header #site-title a:hover';
            $style .= '{color:#' . get_header_textcolor() . ';}';
        }
    }
    /* If header Image is set */
    if (get_header_image()) {
        $style .= '#site-logo{ max-width:' . get_custom_header()->width . 'px; }';
    }
    /* Print */
    if (!empty($style)) {
        echo "\n" . '<style type="text/css" id="custom-header-css">' . trim($style) . '</style>' . "\n";
    }
}
コード例 #28
0
ファイル: functions.php プロジェクト: cabelotaina/redelivre
    function consulta_custom_header()
    {
        $custom_header = get_custom_header();
        ?>
        <style type="text/css">
                    
            #branding { background: url(<?php 
        header_image();
        ?>
) no-repeat; height: <?php 
        echo $custom_header->height;
        ?>
px;}
            <?php 
        if ('blank' == get_header_textcolor()) {
            ?>
                #branding a { height: <?php 
            echo $custom_header->height;
            ?>
px; }
                #branding a:hover { background: none !important; }    
            <?php 
        } else {
            ?>
       
                #branding, #branding a, #branding a:hover { color: #<?php 
            header_textcolor();
            ?>
 !important; }
                #branding a:hover { text-decoration: none; }
                #description { filter: alpha(opacity=60); opacity: 0.6; }
            <?php 
        }
        ?>
        
        </style>
        <?php 
    }
コード例 #29
0
ファイル: lib-content.php プロジェクト: jimdough/Roadmaster
 function xinmag_logo_image($header_image, $size = 'full')
 {
     $html = '';
     //	$header_image = get_header_image();
     if (!empty($header_image)) {
         if (function_exists('get_custom_header')) {
             $header_width = get_custom_header()->width;
             $header_height = get_custom_header()->height;
         } else {
             $header_width = HEADER_IMAGE_WIDTH;
             $header_height = HEADER_IMAGE_HEIGHT;
         }
         if ('full' != $size) {
             $ratio = $size / $header_height;
             $header_height = (int) $header_height * $ratio;
             $header_width = (int) $header_width * $ratio;
         }
         $html = '<img src="' . $header_image . '" width="';
         $html .= $header_width . '" height="' . $header_height;
         $html .= '" alt="' . get_bloginfo('name') . '" />';
     }
     echo apply_filters('xinmag_logo_image', $html);
 }
コード例 #30
0
ファイル: header.php プロジェクト: ravitechrlabs/wordpress
    /**
     * Creates the tag for header image
     */
    function franz_header_image()
    {
        $header = get_custom_header();
        if ($header->url) {
            /* Scale hidpi header image */
            $custom_header = get_theme_support('custom-header');
            $header_args = array_pop($custom_header);
            if ($header->width >= 2 * $header_args['width']) {
                $header->width = floor($header->width / 2);
                $header->height = floor($header->height / 2);
            }
            ?>
        <img src="<?php 
            echo esc_url($header->url);
            ?>
" height="<?php 
            echo esc_attr($header->height);
            ?>
" width="<?php 
            echo esc_attr($header->width);
            ?>
" alt="" />
        <!-- <img src="<?php 
            echo esc_url(FRANZ_ROOTURI);
            ?>
/images/logo.png" srcset="<?php 
            echo esc_url(FRANZ_ROOTURI);
            ?>
/images/logo.png 320w, <?php 
            echo esc_url(FRANZ_ROOTURI);
            ?>
/images/logo-hd.png" class="img-responsive" width="250" height="30" alt="Franz Josef" /> -->
    <?php 
        } else {
            bloginfo('name');
        }
    }