Wordpress主题上的PHP脚本
我使用的是Revusion-Flat Corporate Wordpress主题,有一个默认设置,当您添加页面标题时,会在主题的media.CSS文件中为其分配H1状态和CSSWordpress主题上的PHP脚本,php,html,css,wordpress,Php,Html,Css,Wordpress,我使用的是Revusion-Flat Corporate Wordpress主题,有一个默认设置,当您添加页面标题时,会在主题的media.CSS文件中为其分配H1状态和CSS #pagetitle-container h1, #pagetitle-container h3 { font-size:30px; font-family:'Raleway', Helvetica, Arial; font-weight:300; text-transform:uppercase; color:#fff
#pagetitle-container h1, #pagetitle-container h3 {
font-size:30px;
font-family:'Raleway', Helvetica, Arial;
font-weight:300;
text-transform:uppercase;
color:#fff;
position:relative;
margin:0px 0px -30px 0px;
bottom:2px;
}
问题是,正如你可能知道的谷歌搜索引擎优化和分析,我已经被命令每页只有一个H1标签。我希望这个页面标题标题不会是H1,因为我有我自己的H1,我想在页面上使用,例如在正文中
下面是我相信正在进行的PHP。例如,我如何更改pageheader是H6。它不能像更改h1->h6那样简单?
简言之,我只希望页面上有一个h1,例如,你可以用wordpress中的“可视化编辑器”设置它
<!-- pagetitle start here -->
<section id="pagetitle-container" <?php if($bg) echo'style="background:'.$bg.'"'; ?>>
<div class="row">
<?php if($page_breadcrumb_onoff==1){?>
<div class="five column breadcrumb">
<?php if(function_exists('bcn_display')){?>
<?php
echo '<ul>';
bcn_display_list();
echo '</ul>';
?>
<?php }else{ ?>
<ul><?php if (function_exists('indonez_breadcrumbs')) indonez_breadcrumbs(); ?></ul>
<?php }?>
</div>
<?php } ?>
<div class="<?php if($page_breadcrumb_onoff==1){echo 'seven';}else{echo 'twelve';} ?> column pagetitle">
<?php
if(is_singular('portfolio') || is_singular('team') || is_singular('client')) :
echo '<h1>'.get_the_title().'</h1>';
elseif(is_attachment()):
echo '<h1>'.get_the_title().'</h1>';
elseif(is_single() || is_home()) :
echo '<h1>'.$blog_title.'</h1>';
elseif(is_archive()):
echo '<h3>';
if ( is_day() ) :
printf( __( '<span>%s</span>', 'indonez' ), get_the_date() );
elseif ( is_month() ) :
printf( __( '<span>%s</span>', 'indonez' ), get_the_date('F Y') );
elseif ( is_year() ) :
printf( __( '<span>%s</span>', 'indonez' ), get_the_date('Y') );
elseif ( is_author()) :
printf( __( 'Archives %s', 'indonez' ), "<a class='url fn n' href='" . get_author_posts_url( get_the_author_meta( 'ID' ) ) . "' title='" . esc_attr( get_the_author() ) . "' rel='me'>" . get_the_author() . "</a>" );
elseif ( is_search()) :
printf( __( 'Search Results', 'indonez' ), '<span></span>' );
else :
printf( __( '%s', 'indonez' ), '<span>' . single_cat_title( '', false ) . '</span>' );
endif;
echo '</h3>';
elseif(is_search()):
echo ' <h1>';
printf( __( 'Search Result', 'indonez' ), '<span>' . get_search_query() . '</span>' );
echo '</h1>';
elseif(is_404()):
echo ' <h1>'.__( 'ERROR 404', 'indonez' ).'</h1>';
endif;
?>
</div>
</div>
</section>
<!-- pagetitle end here -->
是的,就是这么简单。但是,如果您将该模板中的每个h1标记都更改为h2标记,那么您还没有说明计划如何添加唯一的h1标记。你打算在头模板中手动执行吗?不,我只是想我可以更改base.css文件中的css以适合我。下面是这里无法格式化的脚本抱歉/*******排版******/h1,h2,h3,h4,h5,h6{字体系列:'Roboto',Helvetica,Arial;字体重量:300;填充:0;颜色:71a0c0;文本呈现:优化易读性;页边距顶部:0.2em;页边距底部:0.5em;线条高度:1.2125em;}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{font-weight:inherit;}h1{font-size:38px;}h2{font-size:31px;}h3{font-size:26px;}h4{font-size:22px;}h5{font-size:20px;}h6{font-size:18px;}让我们重新开始:如果你更改当前模板中出现的每一个h1,你的站点将不会有任何h1。我相信你被告知只有一个h1,而不是一个h1。好吧,我认为上面的php,是代码分配一个h1到页面标题和页面标题。我不知道它控制着所有h1的实例。你是对的,我确实需要h1.上面的模板似乎在控制网站标题部分的h1。你说得对。但是你说你想避免页面标题在h1标签中显示的默认行为。我认为你需要澄清当前的行为和期望的行为。另外,现在还不清楚你是否在处理两个h1标签。
$custom_css .= '#mainmenu ul, #menu li ul a,#menu li ul a:visited, #pagetitle-container h1, #pagetitle-container h3, .pageof, .wp-pagenavi .pages, .wp-pagenavi .extend, .pages a, .pages .current, .wp-pagenavi a, .wp-pagenavi .current, a.comment-reply-link, a.comment-reply-link:visited, #cancel-comment-reply-link, .tag-cloud, .grey-column.custom_bg h1, .grey-column.custom_bg h2, .grey-column.custom_bg h3, .grey-column.custom_bg h4, .grey-column.custom_bg h5, .grey-column.custom_bg h6
{font-family:'.$font1.', Helvetica, Arial}'."\n";
$custom_css .= 'h1,h2,h3,h4,h5,h6, .circle-border p, table th, .testi-name{font-family:'.$font2.', Helvetica, Arial}'."\n";
$custom_css .= 'a:link,a:visited,a:active, ul.tabs li.active a, ul.tabs-left li.active a, ul.tabs-right li.active a, ul.tabs-bottom li.active a, .breadcrumb ul li.current-page, #pf-filter ul li a:hover, #pf-filter ul li a:active, #pf-filter ul li a.selected, .post-info ul li a:hover, ul.popular-list li p.comment-count a, ul.popular-list li p.comment-count a:visited, .text-info{color:'.$generalcolor.'}'."\n";
$custom_css .= '.post-type, aside .widget-title, .sitemap-heading h4, .rdm, .widget_search button, #searchform button, .widget_search button:hover, #searchform button:hover, .highlight, .circle-border:hover, .pages a, .wp-pagenavi a, .wp-pagenavi .pages, .teaser:hover .teaser-preview-box, .teaser:hover .teaser-gallery-box, button[type="submit"], input[type="submit"], input[type="button"]{background:'.$generalcolor.'}'."\n";
if($generalcolor!=""){
$custom_css .='.rdm:hover, button[type="submit"]:hover, input[type="submit"]:hover, input[type="button"]:hover{background:'.$buttonhover.'}'."\n";
}
if($generalcolor!=""){
$custom_css .= '.teaser-preview-box, #map, .google_map{border-color:'.$generalcolor.'}'."\n";
}
$custom_css .= 'ul.tabs-right li.active a{border-right:solid 1px '.$generalcolor.'}'."\n";
$custom_css .= 'ul.tabs-left li.active a{border-left:solid 1px '.$generalcolor.'}'."\n";
$custom_css .= 'ul.tabs-top li.active a, ul.tabs li.active a{border-top:solid 1px '.$generalcolor.'}'."\n";
$custom_css .= 'ul.tabs-bottom li.active a{border-bottom:solid 1px '.$generalcolor.'}'."\n";
$custom_css .= 'h1,h2,h3,h4,h5,h6{color:'.$headingcolor.'}'."\n";
$custom_css .= '#top-info{background:'.$topareabg.'}'."\n";
$custom_css .= '#top-info, #top-info span, #top-info a, #top-info a:visited{color:'.$topareatext.'}'."\n";
$custom_css .= '#mainmenu-wrapper{background:'.$menuareabg.'}'."\n";
if($menuareabg!=""){
$custom_css .= '#mainmenu-wrapper{border-color:'.$bordermenuarea.'}'."\n";
}
$custom_css .= '#mainmenu-wrapper, #mainmenu-wrapper .socials-list li a, #mainmenu-wrapper .socials-list li a:visited, #mainmenu-wrapper #top-socials a, #mainmenu-wrapper #top-socials a:visited{color:'.$socialiconcolor.'}'."\n";
$custom_css .= '#mainmenu ul li a, #mainmenu ul li li a:hover, #mainmenu ul li li:hover > a
#mainmenu ul li li.current_page_item > a, #mainmenu ul li li.current_page_item:hover > a,
#mainmenu ul li li.current_page_parent > a, #mainmenu ul li li.current_page_parent:hover > a,
#mainmenu ul li li.current-menu-parent > a, #mainmenu ul li li.current-menu-parent:hover > a,
#mainmenu ul li li.current-menu-item > a, #mainmenu ul li li.current-menu-ancestor > a{color:'.$menucolor.'}'."\n";
$custom_css .= '#mainmenu ul li:hover,
#mainmenu li.current_page_item,
#mainmenu li.current_page_parent,
#mainmenu li.current-menu-parent,
#mainmenu li.current-menu-item{background:'.$bgmenucolor.'}'."\n";
if($bgmenucolor!=""){
$custom_css .= '#mainmenu ul li:hover,
#mainmenu li.current_page_item,
#mainmenu li.current_page_parent,
#mainmenu li.current-menu-parent,
#mainmenu li.current-menu-item{border-color:'.$bordermenuactive.'}'."\n";
}
$custom_css .= '#menu li ul a,#menu li ul a:visited{color:#828282;}';
$custom_css .= '#slideshow-container{background:'.$slideshowbg.'}'."\n";
$custom_css .= 'footer{background:'.$footerbg.'}'."\n";
$custom_css .= 'footer ul li a, footer ul li a:visited, footer p{color:'.$footertextcolor.' !important}'."\n";
if($footertextcolor!=""){
$custom_css .= 'footer ul li a:hover{color:'.$footermenuhover.' !important}'."\n";
}
$custom_css .= 'footer h1, footer h2, footer h3, footer h4, footer h5, footer h6{color:'.$footerheadingcolor.'}'."\n";
$custom_css .= 'footer .circle-social li, footer .circle-icon, footer .square-social li, footer .square-icon {background:'.$footersocialcolor.'}'."\n";
$custom_css .= 'footer .circle-social li:hover, footer .square-social li:hover, footer .circle-icon:hover, footer .square-icon:hover {background:'.$footersocialhover.'}'."\n";