删除wordpress管理员端的一些动态侧边栏

时间:2013-11-21 11:24:56

标签: php wordpress

我正在使用evento word press主题。该主题中有默认的侧边栏小部件。我不想在管理员端看到。

在sidebar.php中

<?php
    if(dynamic_sidebar ( 'main' ) ){            
    }
?>

在function.php中

<?php
    define('_LIMIT_',10);
    /* google maps defines */
    define('MAP_LAT'    , 48.85680934671159 );
    define('MAP_LNG'    , 2.353348731994629 );
    define('MAP_CLAT'   , 48.85700699730661 );
    define('MAP_CLNG'   , 2.354121208190918 );
    define('MAP_ZOOM'   , 15 );
    define('DEFAULT_AVATAR'   , get_template_directory_uri()."/images/default_avatar.jpg" );
    define( '_TN_'      , get_current_theme() );
    define('BRAND'      , '' );
    define('ZIP_NAME'   , 'conference' );

    define('EXCERPT_CHAR_LEN'   , '600' );

    include 'lib/php/main.php';
    include 'lib/php/actions.register.php';
    include 'lib/php/menu.register.php';

    $content_width = 600;

    if( function_exists( 'add_theme_support' ) ){
        add_theme_support( 'automatic-feed-links' );
        add_theme_support( 'post-thumbnails' );
    }

    if( function_exists( 'add_image_size' ) ){
        add_image_size( 'slideshow'         , 920   , 300   , true );
        add_image_size( '62x62'             , 62    , 62    , true );
        add_image_size( '150xXXX'           , 150   , 999   );
        add_image_size( '300xXXX'           , 300   , 999   ); /*used for animated sponsors widget*/
        add_image_size( '600x200'           , 600   , 200   , true );
        add_image_size( '200x100'           , 200   , 100   , true ); /*gallery size*/
        add_image_size( '440x220'           , 440   , 220   , true ); /*used for 2 col gallery*/
        add_image_size( '280x140'           , 280   , 140   , true ); /*used for 3 col gallery*/

    }

    add_custom_background();
    add_editor_style('editor-style.css');

    /* Localization */
    load_theme_textdomain( 'cosmotheme' );
    load_theme_textdomain( 'cosmotheme' , get_template_directory() . '/languages' );

    if ( function_exists( 'load_child_theme_textdomain' ) ){
        load_child_theme_textdomain( 'cosmotheme' );
    }

    $pg = get_pages();
    $do = true;

    foreach( $pg as $p ){
        if( $p -> post_title == 'Registration' ){
            $do = false;
            break;
        }
    }

    if( $do ){
        $pages = array(
            'post_title' => 'Registration',
            'post_content' => '',
            'post_status' => 'publish',
            'post_type' => 'page'
        );

        wp_insert_post($pages);
    }

    /*New version check*/
    if(is_admin() && ini_get('allow_url_fopen') == '1'){
        function versionNotify(){
             echo api_call::compareVersions(); 
        }

        // Add hook for admin <head></head>
        add_action('admin_head', 'versionNotify');
    }

    /* Cosmothemes Backend link */
    function de_cosmotheme() {
        global $wp_admin_bar;
        if ( !is_super_admin() || !is_admin_bar_showing() ){
            return;
        }

        $current_theme_name = get_current_theme();
        $wp_admin_bar -> add_menu( array(
            'id' => 'cosmothemes',
            'parent' => '',
            'title' => $current_theme_name,
            'href' => admin_url( 'admin.php?page=cosmothemes__general' )
            ) );
    }
    add_action('admin_bar_menu', 'de_cosmotheme');



    add_custom_background();
    add_editor_style('editor-style.css');
?>

我不知道如何删除这个。请帮我删除侧边栏小部件。

1 个答案:

答案 0 :(得分:0)

尝试删除或评论此行:add_action('admin_bar_menu', 'de_cosmotheme');

我喜欢评论这些内容,而不是删除,所以我引用了代码“使用”的内容,因此我总是能够恢复原来编码的方式。


修改 我找到了主题的旧版本,我希望它没有太大改变

查找文件\wp-content\themes\evento\lib\php\options.register.php并注释或删除所有看起来像options::$menu['cosmothemes']['***']

的行

专业提示:通过将/**/

括起来评论多行

<强> EDIT2: 我现在认为你的意思是在外观中以Evento :开头的小部件 - &gt; wordpress admin中的小部件菜单。

\wp-content\themes\evento\lib\php\actions.register.php中配置这些内容,查找包含函数register_widget的行,并对其进行注释或删除。


<强> EDIT3:

根据我们得出的评论,您实际意味着的小部件是register_sidebar在我的文件\wp-content\themes\evento\lib\php\actions.register.php中再次添加的侧边栏,它们从145开始。