【问题标题】:how to set the search form next to the site title in wordpress如何在wordpress中设置网站标题旁边的搜索表单
【发布时间】:2015-05-13 12:18:44
【问题描述】:

我想将:移动到网站标题旁边。 目前,搜索表单位于网站标题下方。

我只是不知道如何将“get search”放在“echo bloginfo”中。 我想要右侧的搜索表单(在标题之后)。

这是php文件:

<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<header id="masthead" class="site-header2" role="banner">
    <hgroup>
        <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"  rel="home"><?php bloginfo( 'name' ); ?></a></h1>
        <h2 class="site-description"><?php bloginfo( 'description' ); ?> </h2>
    </hgroup>

                <?php get_search_form(); ?>

    <?php if ( get_header_image() ) : ?>
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><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="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" /></a>
    <?php endif; ?>
</header><!-- #masthead -->

<div id="main" class="wrapper">

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    get_search_form() 用于显示搜索表单,您可以像下面这样放置,也可以使用 css 代码进行调整。

      <hgroup>
                <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"  rel="home"><?php bloginfo( 'name' ); ?></a></h1>
     <?php get_search_form(); ?>
                <h2 class="site-description"><?php bloginfo( 'description' ); ?> </h2>
            </hgroup>
    

    【讨论】:

    • 嘿,谢谢你的回答。在css中,我没有与搜索表单相关的东西除了:.widget_search label { display: inline-block;字体大小:13px;字体大小:0.928571429rem;行高:1.846153846; } 那我该怎么办?
    猜你喜欢
    • 2020-08-27
    • 1970-01-01
    • 2018-01-11
    • 1970-01-01
    • 2016-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多