如何在Mystile主题的Top侧添加徽标而不是Header Portion?

时间:2017-05-02 07:38:26

标签: wordpress woocommerce

我的 woo commerce 网站面临一个非常大的问题。

我使用 Mystile主题,我希望我的徽标位于主页的顶部(与搜索一致)。但默认情况下,它与菜单部分一致。我附上截图供您准备参考: enter image description here

2 个答案:

答案 0 :(得分:0)

您可以通过自定义自定义到主题文件header.php中来实现此目的 您需要在顶部栏中调用徽标代码。 打开你的header.php并找到类包装器,然后进入包装器将有一个带有顶部调用标识代码的div进入这个div,它看起来就像这样。 http://prntscr.com/f361zd

答案 1 :(得分:0)

请将您的header.php文件中的以下代码复制并粘贴到mystile主题中。在更改代码之前,请先复制一份原始代码

<?php
// File Security Check
if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && basename( __FILE__ ) == basename( $_SERVER['SCRIPT_FILENAME'] ) ) {
    die ( 'You do not have sufficient permissions to access this page!' );
}
?>
<?php
/**
 * Header Template
 *
 * Here we setup all logic and XHTML that is required for the header section of all screens.
 *
 * @package WooFramework
 * @subpackage Template
 */
global $woo_options, $woocommerce;
?><!DOCTYPE html>
<html <?php language_attributes(); ?> class="<?php if ( $woo_options['woo_boxed_layout'] == 'true' ) echo 'boxed'; ?> <?php if (!class_exists('woocommerce')) echo 'woocommerce-deactivated'; ?>">
<head>

<meta charset="<?php bloginfo( 'charset' ); ?>" />

<title><?php woo_title(''); ?></title>
<?php woo_meta(); ?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo( 'stylesheet_url' ); ?>" media="screen" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php
    wp_head();
    woo_head();
?>

</head>

<body <?php body_class(); ?>>
<?php woo_top(); ?>

<div id="wrapper">



    <div id="top">
        <nav class="col-full" role="navigation">
                     <?php
                $logo = esc_url( get_template_directory_uri() . '/images/logo.png' );
                if ( isset( $woo_options['woo_logo'] ) && $woo_options['woo_logo'] != '' ) { $logo = $woo_options['woo_logo']; }
                if ( isset( $woo_options['woo_logo'] ) && $woo_options['woo_logo'] != '' && is_ssl() ) { $logo = preg_replace("/^http:/", "https:", $woo_options['woo_logo']); }
            ?>
            <?php if ( ! isset( $woo_options['woo_texttitle'] ) || $woo_options['woo_texttitle'] != 'true' ) { ?>
                <a id="logo" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_attr( get_bloginfo( 'description' ) ); ?>">
                    <img src="<?php echo $logo; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" />
                </a>
            <?php } ?>

            <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
            <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
            <?php if ( function_exists( 'has_nav_menu' ) && has_nav_menu( 'top-menu' ) ) { ?>
            <?php wp_nav_menu( array( 'depth' => 6, 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'top-nav', 'menu_class' => 'nav fl', 'theme_location' => 'top-menu' ) ); ?>
            <?php } ?>
            <?php
                if ( class_exists( 'woocommerce' ) ) {
                    echo '<ul class="nav wc-nav">';
                    do_action( 'mystile_cart_nav' );
                    echo get_search_form();
                    echo '</ul>';
                }
            ?>
        </nav>
    </div><!-- /#top -->



    <?php woo_header_before(); ?>

    <header id="header" class="col-full">



        <hgroup>


            <h3 class="nav-toggle"><a href="#navigation"><mark class="websymbols">&#178;</mark> <span><?php _e('Navigation', 'woothemes'); ?></span></a></h3>

        </hgroup>

        <?php woo_nav_before(); ?>

        <nav id="navigation" class="col-full" role="navigation">

            <?php
            if ( function_exists( 'has_nav_menu' ) && has_nav_menu( 'primary-menu' ) ) {
                wp_nav_menu( array( 'depth' => 6, 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'main-nav', 'menu_class' => 'nav fr', 'theme_location' => 'primary-menu' ) );
            } else {
            ?>
            <ul id="main-nav" class="nav fl">
                <?php if ( is_page() ) $highlight = 'page_item'; else $highlight = 'page_item current_page_item'; ?>
                <li class="<?php echo $highlight; ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Home', 'woothemes' ); ?></a></li>
                <?php wp_list_pages( 'sort_column=menu_order&depth=6&title_li=&exclude=' ); ?>
            </ul><!-- /#nav -->
            <?php } ?>

        </nav><!-- /#navigation -->

        <?php woo_nav_after(); ?>

    </header><!-- /#header -->

    <?php woo_content_before(); ?>