WordPress网站中错误的InnerHTML路径(更改徽标)

时间:2015-11-14 18:11:10

标签: html css wordpress

我正在尝试更改Wordpress网站中的徽标。 我选择在“媒体”部分上传并上传图像 从那里访问路径时它正在工作。

但是,如果我访问该网站,图像不会显示。 如果我检查元素图像,则表明路径错误: 为什么src路径没有:?我该如何解决?

<a class="fusion-logo-link" href="http://localhost:8888/mysite">
    <img src="http://localhost8888/mysite/wp-content/uploads/logo.png" width="150" height="157" alt="my site" class="fusion-logo-1x fusion-standard-logo">  

在属性

host: "localhost:8888"
hostname: "localhost"
href: "http://localhost:8888/mysite"
hreflang: ""
id: ""
innerHTML: "↵   ↵   ↵   <img src="http://localhost8888/mysite/wp-content/uploads/logo.png" width="150" height="157" alt="my site" class="fusion-logo-1x fusion-standard-logo">↵ <img src="http://localhost8888/mysite/wp-content/uploads/logo.png" width="150" height="157" alt="my site" style="max-height: 157px; height: auto;" class="fusion-standard-logo fusion-logo-2x">↵    ↵   <!-- mobile logo -->↵   ↵   <!-- sticky header logo -->↵    "
innerText: ""

编辑:

var $standard_logo_height = jQuery( '.fusion-standard-logo' ).height() + parseInt( jQuery( '.fusion-logo' ).data( 'margin-top' ) ) + parseInt( jQuery( '.fusion-logo' ).data( 'margin-bottom' ) );
        window.$initial_desktop_header_height = Math.max( window.$header_height, Math.max( $menu_height + $menu_border_height, $standard_logo_height ) + parseInt( jQuery( '.fusion-header' ).find( '.fusion-row' ).css( 'padding-top' ) ) + parseInt( jQuery( '.fusion-header' ).find( '.fusion-row' ).css( 'padding-bottom' ) ) );
        window.$sticky_can_be_shrinked = true;

        if( js_local_vars.sticky_header_shrinkage == '0' ) {
            $animation_duration = 0;
            window.$scrolled_header_height = window.$header_height;
        }
        if ( $logo ) {
            // Getting the correct natural height of the visible logo
            if ( $logo.hasClass( 'fusion-logo-2x' ) ) {
                var $logo_image = new Image();
                $logo_image.src = $logo( 'src' );
                window.original_logo_height = parseInt( $logo.height() ) + parseInt( js_local_vars.logo_margin_top ) + parseInt( js_local_vars.logo_margin_bottom );
            } else {
                // For normal logo we need to setup the image object to get the natural heights
                var $logo_image = new Image();
                $logo_image.src = $logo( 'src' );
                window.original_logo_height = parseInt( $logo_image.naturalHeight ) + parseInt( js_local_vars.logo_margin_top ) + parseInt( js_local_vars.logo_margin_bottom );

                // IE8, Opera fallback
                $logo_image.onload = function() {
                    window.original_logo_height = parseInt( this.height ) + parseInt( js_local_vars.logo_margin_top ) + parseInt( js_local_vars.logo_margin_bottom );
                };
            }
        }

php

<?php if ( Avada()->settings->get( 'logo' ) ) : ?>
                <a class="fusion-logo-link" href="<?php echo home_url(); ?>">
                    <?php $logo_url = Avada_Sanitize::get_url_with_correct_scheme( Avada()->settings->get( 'logo' ) ); ?>

                    <?php if ( Avada()->settings->get( 'retina_logo_width' ) && Avada()->settings->get( 'retina_logo_height' ) ) : ?>
                        <?php $logo_size['width']  = Avada()->settings->get( 'retina_logo_width' ); ?>
                        <?php $logo_size['height'] = Avada()->settings->get( 'retina_logo_height' ); ?>
                    <?php else : ?>
                        <?php $logo_size['width']  = ''; ?>
                        <?php $logo_size['height'] = ''; ?>
                    <?php endif; ?>

                    <img src="<?php echo $logo_url; ?>" width="<?php echo $logo_size['width']; ?>" height="<?php echo $logo_size['height']; ?>" alt="<?php bloginfo( 'name' ); ?>" class="fusion-logo-1x fusion-standard-logo" />
                    <?php $retina_logo = Avada()->settings->get( 'logo_retina' ); ?>
                    <?php if ( $retina_logo ) : ?>
                        <?php $retina_logo = Avada_Sanitize::get_url_with_correct_scheme( $retina_logo ); ?>
                        <?php $style = 'style="max-height: ' . $logo_size['height'] . 'px; height: auto;"'; ?>
                        <img src="<?php echo $retina_logo; ?>" width="<?php echo $logo_size['width']; ?>" height="<?php echo $logo_size['height']; ?>" alt="<?php bloginfo('name'); ?>" <?php echo $style; ?> class="fusion-standard-logo fusion-logo-2x" />
                    <?php else: ?>
                        <img src="<?php echo $logo_url; ?>" width="<?php echo $logo_size['width']; ?>" height="<?php echo $logo_size['height']; ?>" alt="<?php bloginfo('name'); ?>" class="fusion-standard-logo fusion-logo-2x" />
                    <?php endif; ?>

1 个答案:

答案 0 :(得分:0)

您的徽标的网址是否已刻录?检查header.php,看看是否可以更新徽标网址。如果没有,也许您使用自定义徽标src编辑了functions.php文件,因此您应该提供已更改的代码。

如果您没有修改模板文件中的任何内容,则可能想要从管理区域Settings/General更新WordPress Address (URL)Site Address (URL)