在函数中隐藏某些元素后,媒体上传不起作用。php

时间:2015-12-19 作者:Gijo Varghese

我已输入以下代码functions.php. (用于向客户端隐藏某些选项。)但问题是,添加这些代码后,图像无法上传,甚至无法从库中上传照片或创建新帖子。有人请帮忙

echo \'<style> 
        #toplevel_page_wpcf7, #wp-admin-bar-wp-logo,  #screen-meta-links, #menu-tools, #wp-admin-bar-wpseo-menu, #footer-upgrade, #toplevel_page_wpfront-user-role-editor-all-roles,#toplevel_page_vc-general, #menu-settings,#toplevel_page_wpseo_dashboard, #toplevel_page_revslider, #toplevel_page_themepunch-google-fonts,#menu-appearance, #wp-admin-bar-snap-post, .error
        {
            display:none;
        }
    </style>\';

2 个回复
SO网友:Omar Tariq

用以下代码替换您的代码:-

add_action(\'wp_footer\', \'myCssCode\', PHP_INT_MAX);
function myCssCode() {
    ?>
    <style> 
        #toplevel_page_wpcf7, 
        #wp-admin-bar-wp-logo,
        #screen-meta-links,
        #menu-tools,
        #wp-admin-bar-wpseo-menu,
        #footer-upgrade,
        #toplevel_page_wpfront-user-role-editor-all-roles,
        #toplevel_page_vc-general,
        #menu-settings,
        #toplevel_page_wpseo_dashboard,
        #toplevel_page_revslider,
        #toplevel_page_themepunch-google-fonts,
        #menu-appearance,
        #wp-admin-bar-snap-post,
        .error
        {
            display:none;
        }
    </style>
    <?php
}

SO网友:Gijo Varghese
<?php    
add_action( \'admin_head\', \'admin_css\' );
    function admin_css(){ ?>
         <style> 
                    #toplevel_page_wpcf7, #wp-admin-bar-wp-logo,  #screen-meta-links, #menu-tools, #wp-admin-bar-wpseo-menu, #footer-upgrade, #toplevel_page_wpfront-user-role-editor-all-roles,#toplevel_page_vc-general, #menu-settings,#toplevel_page_wpseo_dashboard, #toplevel_page_revslider, #toplevel_page_themepunch-google-fonts,#menu-appearance, #wp-admin-bar-snap-post, .error
                    {
                        display:none;
                    }
                    </style>
    <?php
    }

this one worked

相关推荐

ADD_THEME_SUPPORT(‘CUSTOM-HEADER-UPLOADS’);功能有什么作用?

同时向functions.php 文件中,我发现了以下内容:add_theme_support(\'custom-header-uploads\');这到底是做什么的?我删除了条目functions.php 但对网站没有什么不同。我最初认为这与上传标题图像的能力有关,但这取决于add_theme_support(\'custom-header\');在执行搜索时,我无法在Codex中看到任何有意义的信息。这是某种贬值的特征还是我忽略了什么?