当前位置: 首页 > 知识库问答 >
问题:

如何从标题中删除标语?

上官德寿
2023-03-14

如何注释我header.php中的标语?

我正在使用2014年的主题,并试图遵循WordPress codex中的元标签说明。要生成一个描述元标记,它会指示您将描述添加到标语中。但是这个标语显示在我打开网页的每个窗口/选项卡的顶部(以及我的网站名称)。要隐藏标语,WordPress建议“删除或注释掉标头区域的标签”我做这个有困难。我在header.php?中到底要评论什么,我在标题中没有看到任何带有“标语”或“描述”的内容我使用儿童主题仅供参考。

这是我的header.php

<?php /**  * The Header for our theme  *  * Displays all of the <head> section and everything up till <div id="main">  *  * @package WordPress  * @subpackage Twenty_Fourteen  * @since Twenty Fourteen 1.0  */ ?>
<!DOCTYPE html> 
<!--[if IE 7]>
 <html class="ie ie7" <?php language_attributes(); ?>> 
<![endif]-->
 <!--[if IE 8]> 
<html class="ie ie8" <?php language_attributes(); ?>>
 <![endif]--> 
<!--[if !(IE 7) | !(IE 8) ]>
<!--> <html <?php language_attributes(); ?>>
 <!--<![endif]-->
 <head> 
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width"> 
<title>
<?php wp_title( '|', true, 'right' ); ?>
</title> 
<link rel="profile" href="http://gmpg.org/xfn/11"> 
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> 
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script> 
<![endif]--> 
<?php wp_head(); ?> 
</head>
 <body <?php body_class(); ?>> 
<div id="page" class="hfeed site"> 
<?php if ( get_header_image() ) : ?>
<div id="site-header">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">     
<img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="">
</a>
</div>
<?php endif; ?>
<header id="masthead" class="site-header" role="banner"> 
<div class="header-main"> 
<h1 class="site-title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<?php bloginfo( 'name' ); ?></a>
</h1> 
<div class="search-toggle"> 
<a href="#search-container" class="screen-reader-text">
<?php _e( 'Search', 'twentyfourteen' ); ?>
</a> 
</div> 
<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation"> <button class="menu-toggle">
<?php _e( 'Primary Menu', 'twentyfourteen' ); ?></button> 
<a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?>
</a> 
<!-- <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?> --> 
</nav> 
</div>
<div id="search-container" class="search-box-wrapper hide"> 
<div class="search-box">
<?php get_search_form(); ?>
</div>
</div>  

</header><!-- #masthead -->     <div id="main" class="site-main"> 

共有1个答案

陈开宇
2023-03-14

这是/themes/twenty14d/functions.php中由过滤器钩子wp\u title调用的函数twenty14d\u wp\u title()中的内容。

要修改这一点,在您的子主题/主题/子主题/functions.php中,您可以删除原始过滤器并添加自己的:

add_action( 'after_setup_theme', 'remove_parent_stuff' );

function remove_parent_stuff()
{
    remove_filter( 'wp_title', 'twentyfourteen_wp_title', 10 );
    add_filter( 'wp_title', 'my_child_wp_title', 10, 2 );
}

function my_child_wp_title( $title, $sep ) 
{
    // ADAPT the original 2014 function to your needs
    return 'Hello, world!';
}

要添加元描述,请使用以下操作挂钩:

add_action( 'wp_head', 'my_child_description' );

function my_child_description()
{
    echo '<meta name="description" content="Lorem ipsum lorem" />' . "\r\n"; // \r\n makes a line break, it has to be with double quotes
}
 类似资料:
  • 问题内容: 我正在使用以下代码进行练习, http://docs.oracle.com/javase/tutorial/uiswing/examples/layout/BorderLayoutDemoProject/src/layout/BorderLayoutDemo.java 我也加 在createAndShowGUI()方法中, 而且,我希望此窗口不具有标题栏,关闭和最小化按钮。 我尝试了以

  • 问题内容: 我正在通过“双重缓冲”方法来捕获JFrame的屏幕截图,如下所示: 在何处扩展JFrame。我得到的图像的标题栏所在的顶部有一个空白条。在没有为标题栏分配额外空间的情况下,捕获JFrame内容图像的最直接方法是什么? 问题答案: 您应该能够使用Screen Image类。只需指定框架的内容窗格(如果有菜单,则指定根窗格)作为所需图像的组件。 或者您的基本代码应该起作用,再次将内容窗格(

  • 我有几个Kafka的题目作为测试。现在我想通过清理我的Kafka主题列表来把它们全部除掉。我设置了变量,然后停止并重新启动zookeeper和kafka服务器。但什么也帮不了我。主题仍然存在,“标记为删除”。我读了这个问题,但没有找到任何答案。否则,这里建议手动移除任何主题。但我该怎么做呢?在故事的结尾,手动或通过命令行,我如何永久删除Kafka主题?

  • 我在一个文件夹中有两个csv文件,如下所示:文件1: 文件 2: 我想从文件夹中读取文件,然后删除标题名称(col1,col2),然后将行更改为列,将列更改为行,这意味着转置它并将这两个文件合并到一个新的csv文件中,如下所示:

  • 如何删除Jtable标题网格线,我可以从行中删除网格线,但它在Jtable标题中给出了网格线。是否可以删除Jtable标题网格线。

  • 有人有更好的主意吗?