在WordPress不断更新的版本中去掉首页功能侧栏模块中的登录,文章RSS,评论RSS,WordPress.org的方法有变化,很不好处理这个问题,不是说WordPress不好 而是总感觉有种不是自己网站的难受,你们懂的话不多说,坚持往下翻一定完美解决这些问题!!!
一、使用FTP工具链接到服务器空间地址
找到文件夹“widgets” 函数编辑器工具采用的 Notepad++
打开网站的根目录,找到wp-includes文件夹,在此目录下找到widgets文件夹,这个目录下有个class-wp-widget-meta.php文件,就是我们要修改的文件
二、打开文件ctrl+F查找 “wp_register” 关键字位置
大概在55行左右,代码如下
<ul> <?php wp_register(); ?> <li><?php wp_loginout(); ?></li> <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> <?php /** * Filter the "Powered by WordPress" text in the Meta widget. * * @since 3.6.0 * * @param string $title_text Default title text for the WordPress.org link. */ echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>', esc_url( __( 'https://wordpress.org/' ) ), esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ), _x( 'WordPress.org', 'meta widget link text' ) ) ); wp_meta(); ?> </ul>
三、根据个人需求来删除或取代相关函数代码
1.不需要显示”登录” ,OK 删掉下面这些代码
<li><?php wp_loginout(); ?></li>
2.不需要显示”文章RSS” , OK 删掉下面这些代码
<li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
3.不需要显示”评论RSS” , OK 删掉下面这些代码
<li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
4.不需要显示”WordPress.org” , OK 删掉下面这些代码
<?php /** * Filter the "Powered by WordPress" text in the Meta widget. * * @since 3.6.0 * * @param string $title_text Default title text for the WordPress.org link. */ echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>', esc_url( __( 'https://wordpress.org/' ) ), esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ), _x( 'WordPress.org', 'meta widget link text' ) ) ); wp_meta(); ?>
最后保存文件,替换掉服务器上的同名文件即可大功告成!!!
如果本文章对你有帮助 欢迎评论转载,带走时请给予鼓励支持并写上本文链接!
THE END