您可以删除的一些默认WP链接head
通过使用remove_action()
. 例如:
// Removes the wlwmanifest link
remove_action( \'wp_head\', \'wlwmanifest_link\' );
// Removes the RSD link
remove_action( \'wp_head\', \'rsd_link\' );
// Removes the WP shortlink
remove_action( \'wp_head\', \'wp_shortlink_wp_head\', 10, 0 );
// Removes the canonical links
remove_action( \'wp_head\', \'rel_canonical\' );
// Removes the links to the extra feeds such as category feeds
remove_action( \'wp_head\', \'feed_links_extra\', 3 );
// Removes links to the general feeds: Post and Comment Feed
remove_action( \'wp_head\', \'feed_links\', 2 );
// Removes the index link
remove_action( \'wp_head\', \'index_rel_link\' );
// Removes the prev link
remove_action( \'wp_head\', \'parent_post_rel_link\' );
// Removes the start link
remove_action( \'wp_head\', \'start_post_rel_link\' );
// Removes the relational links for the posts adjacent to the current post
remove_action( \'wp_head\', \'adjacent_posts_rel_link\' );
remove_action( \'wp_head\', \'adjacent_posts_rel_link_wp_head\' );
// Removes the WordPress version i.e. -
remove_action( \'wp_head\', \'wp_generator\' );
要删除表情符号支持(CSS和Javascript),请执行以下操作:
remove_action( \'wp_head\', \'print_emoji_detection_script\', 7 );
remove_action( \'admin_print_scripts\', \'print_emoji_detection_script\' );
remove_action( \'wp_print_styles\', \'print_emoji_styles\' );
remove_action( \'admin_print_styles\', \'print_emoji_styles\' );
您必须在
functions.php
文件
要编辑主题(zerif)排队的文件,您需要编辑functions.php
文件,以及。例如,您会发现如下内容:
wp_enqueue_style( \'style\', get_stylesheet_uri() );
wp_enqueue_style( \'shortcodes\', get_template_directory_uri() . \'/css/shortcodes.css\' );
wp_enqueue_style( \'font-awesome\', get_template_directory_uri() . \'/css/font-awesome.css\' );
wp_enqueue_script( \'jquery\' );
如果你在你的电脑里找不到
functions.php
, 这是因为有些主题将
functions.php
多个文件中的内容,通常包含在具有名称的特定文件夹中
inc
,
include
或
framework
. 这很容易知道:这些文件必须加载到
functions.php
. 例如:
locate_template( \'inc/widgets.php\', true, true );
locate_template( \'inc/sidebars.php\', true, true );
locate_template( \'inc/breadcrumbs.php\', true, true );
locate_template( \'inc/whatever.php\', true, true );