Hi @j700group,
In tag pages, we’ve not added the H1 tag for the swift theme. However, you can change the H1 tag using custom code. Please follow the below steps to add the custom H1 tag for tag/ archive pages.
Steps:
1. Go to your theme folder and create a new folder & named as “ampforwp”. Screenshot: https://take.ms/qJlnd
2. Then open the ‘ampforwp’ folder (which we created) and create a new file named as “archive.php”. Screenshot: https://take.ms/NKEh6
3. And then open the ‘archive.php’ file, copy & paste the below code:
<?php global $redux_builder_amp;
amp_header() ?>
<div class="cntr archive">
<div class="arch-tlt">
<?php
if(function_exists('ampforwp_custom_archive_title')){
ampforwp_custom_archive_title();
} ?>
</div>
<div class="arch-dsgn">
<div class="arch-psts">
<?php amp_loop_template(); ?>
<?php amp_pagination(); ?>
</div>
<?php
if(isset($redux_builder_amp['gbl-sidebar']) && $redux_builder_amp['gbl-sidebar'] == '1'){ ?>
<div class="sdbr-right">
<?php
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('swift-sidebar');
if ( $sanitized_sidebar) {
$sidebar_output = $sanitized_sidebar->get_amp_content();
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
}
echo $sidebar_output;// amphtml content, no kses
?>
</div>
<?php } ?>
</div>
</div>
<?php amp_footer()?>
4. After pasting the code, please save the code. And goto the “theme’s functions.php” file. Screenshot: https://take.ms/BOtGf
5. At the end of the functions.php file, please copy & paste the below code:
if(!function_exists('ampforwp_custom_archive_title')){
function ampforwp_custom_archive_title(){
global $redux_builder_amp;
if( is_author() ){
$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
if( true == ampforwp_gravatar_checker($curauth->user_email) ){
$curauth_url = get_avatar_url( $curauth->user_email, array('size'=>180) );
if($curauth_url){ ?>
<div class="amp-wp-content author-img">
<amp-img src="<?php echo esc_url($curauth_url); ?>" width="90" height="90" layout="responsive"></amp-img>
</div>
<?php }
}
}
if ( is_archive() ) {
$description = $sanitizer = $arch_desc = '';
the_archive_title( '<h1 class="amp-archive-title">', '</h1>' );
$description = get_the_archive_description();
$sanitizer = new AMPFORWP_Content( $description, array(),
apply_filters( 'ampforwp_content_sanitizers',
array(
'AMP_Style_Sanitizer' => array(),
'AMP_Blacklist_Sanitizer' => array(),
'AMP_Img_Sanitizer' => array(),
'AMP_Video_Sanitizer' => array(),
'AMP_Audio_Sanitizer' => array(),
'AMP_Iframe_Sanitizer' => array(
'add_placeholder' => true,
)
) ) );
$arch_desc = $sanitizer->get_amp_content();
if( $arch_desc ) {
if ( get_query_var( 'paged' ) ) {
$paged = get_query_var('paged');
} elseif ( get_query_var( 'page' ) ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
if($paged <= '1') {?>
<div class="amp-archive-desc">
<?php echo $arch_desc;// amphtml content, no kses ?>
</div> <?php
}
}
}
if( is_category() && 1 == $redux_builder_amp['ampforwp-sub-categories-support'] ){
$parent_cat_id = '';
$cat_childs = array();
$parent_cat_id = get_queried_object_id();
$cat_childs = get_terms( array(
'taxonomy' => get_queried_object()->taxonomy,
'parent' => $parent_cat_id )
);
if( !empty( $cat_childs ) ){
echo "<div class='amp-sub-archives'><ul>";
foreach ($cat_childs as $cat_child ) {
echo '<li><a href="' . esc_url(get_term_link( $cat_child )) . '">' . esc_attr($cat_child->name) . '</a></li>';
}
echo "</ul></div>";
}
}
if(is_search()){
$label = 'You searched for:';
if(function_exists('ampforwp_translation')){
$label = ampforwp_translation( $redux_builder_amp['amp-translator-search-text'], 'You searched for:');
}
echo '<h3 class="amp-loop-label">'.esc_attr($label) . ' ' . esc_attr(get_search_query()).'</h3>';
}
}
}
6. Save the file.
Now the h1 tag will appear on the tag pages. Remember, please give the same name files which I’ve given in the above the steps.
Hope it helps.
Thank you