Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 菜单中未显示徽标_Php_Html_Css_Wordpress - Fatal编程技术网

Php 菜单中未显示徽标

Php 菜单中未显示徽标,php,html,css,wordpress,Php,Html,Css,Wordpress,在我的WordPress菜单中,我有一个设置为第一个列表项的徽标。它在主页上显示得很好,但在所有其他页面上都没有显示。这是因为主页上图像的url与所有其他页面不同。看图片以便更好地理解。 正如您所看到的,在主页以外的页面上,正确的url应该具有页面slug。我不知道如何将slug放入我菜单上的当前url。提前谢谢 <?php /** * The header for our theme * * This is the template that displays all of

在我的WordPress菜单中,我有一个设置为第一个列表项的徽标。它在主页上显示得很好,但在所有其他页面上都没有显示。这是因为主页上图像的url与所有其他页面不同。看图片以便更好地理解。 正如您所看到的,在主页以外的页面上,正确的url应该具有页面slug。我不知道如何将slug放入我菜单上的当前url。提前谢谢

    <?php
/**
 * The header for our theme
 *
 * This is the template that displays all of the <head> section and everything up until <div id="content">
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package Revived_Furnishings
 */

?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">

<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
<div id="page" class="site">
    <a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'revivedfurnishings' ); ?></a>

    <header id="masthead" class="site-header" role="banner">

        <nav id="site-navigation" class="main-navigation" role="navigation">

        <img class="mobile-logo" src="wp-content/themes/revivedfurnishings/images/logo.jpg">

            <button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><?php esc_html_e( '', 'revivedfurnishings' ); ?>Menu</button>
            <?php wp_nav_menu( array( 'theme_location' => 'menu-1', 'menu_id' => 'primary-menu' ) ); ?>
        </nav><!-- #site-navigation -->
    </header><!-- #masthead -->

    <div id="content" class="site-content">


我不知道为什么你会把一个标志作为菜单项。最好将它直接放在header.php文件中。但是,如果您不习惯编辑wordpress主题,那么您所要做的就是在图像src的开头添加一个
/
。这意味着URL src将被视为根路径,并且不会附加到当前页面URL的末尾

<img class="logo" src="/wp-content/themes/revivedfurnishings/images/logo.jpg"> 

我不知道为什么你会把一个标志作为菜单项。最好将它直接放在header.php文件中。但是,如果您不习惯编辑wordpress主题,那么您所要做的就是在图像src的开头添加一个
/
。这意味着URL src将被视为根路径,并且不会附加到当前页面URL的末尾

<img class="logo" src="/wp-content/themes/revivedfurnishings/images/logo.jpg"> 

在wordpress中,您应该给出如下图像路径:

/image\u folder\u name/image.jpg“alt=”image“/>


无需在wordpress中提及“wp内容/主题/复活家具”

,您应该给出如下图像路径:

/image\u folder\u name/image.jpg“alt=”image“/>


不需要提及“wp内容/主题/复兴家具”

Hmm,这似乎不起作用。它仍然在寻找带有页面slug的URL。我想把它直接放到header.php中,但是我很难理解在哪里添加新的
  • 。我将发布header.php代码供您查看。谢谢@JohnChristensen我已经更新了我的答案,并解释了如何将徽标添加到标题中的导航中。嗯,这似乎不起作用。它仍然在寻找带有页面slug的URL。我想把它直接放到header.php中,但是我很难理解在哪里添加新的
  • 。我将发布header.php代码供您查看。谢谢@JohnChristensen我已经更新了我的答案,并解释了如何将徽标添加到标题中的导航中。