我对我的一些类别使用自定义类别模板。例如:cat-12。php等等。我使用Fv Simpler Seo,目前它似乎不支持编辑类别模板的选项。
考虑到我使用自定义类别模板,是否有一种功能或方式可以在不使用插件的情况下包含自定义元描述和自定义标题(覆盖作为标题的默认类别名称)?
我对我的一些类别使用自定义类别模板。例如:cat-12。php等等。我使用Fv Simpler Seo,目前它似乎不支持编辑类别模板的选项。
考虑到我使用自定义类别模板,是否有一种功能或方式可以在不使用插件的情况下包含自定义元描述和自定义标题(覆盖作为标题的默认类别名称)?
对于类别的元描述,可以使用followinf dunction
//META DESCRIPTION FUNCTION
function seometadescription(){
global $post, $posts;
if ( is_single() || is_page() ) :
$customDesc = \'meta_desc\';
if ( have_posts() ) : while ( have_posts() ) : the_post();
$descriere = get_post_meta($post->ID, $customDesc, true);
endwhile;
endif;
elseif( is_category() ):
$descriere = category_description();
elseif( is_front_page() ) :
$descriere = \'some words for front page description\';
endif;
$customMetaDesc = \'<meta name="description" content="\'.$descriere.\'" />\';
echo $customMetaDesc;
}
// end meta desc function
$customDesc=是一个自定义字段,我用于描述帖子和页面,如果您没有将页面作为首页替换为is\\U front\\U page(),则使用is\\U home对于META关键字,我在这个上找到了一个函数web site
同意,大多数类别模板文件都以get_header
然后您可以在content=""
, 但请确保您不会与任何PHP脚本冲突。
<meta name="keywords" content="" />
<meta name="title" content="" />
<meta name="" />
仔细查看自定义类别模板。那里must 可以选择对其进行编辑。可能不是通过仪表板,可能是在主题或插件文件夹中。我认为不可能没有编辑模板的选项。
我遵循wordpress codex网站上关于通过插件创建管理主题的说明。我激活了插件,但我的样式表没有包含在<head>.. 这是我的代码:add_action( \'admin_init\', \'kd_plugin_admin_init\' ); add_action( \'admin_menu\', \'kd_plugin_admin_menu\' ); function kd_plugin_admin_init() { /* Register