Remove H1 and H2 tags from header on posts?
-
I have recently found out my headings have been wrong for quite awhile.
On every post I make, the H1 and H2 spots are being used by the header. Instead of my post be the only H1 in a post, there are multiple due to the header.
How can I fix this?
-
Hi Cory1990,
The H-tags are probably hard-coded in your theme files. If you’re talking about on the single-post page, the file you want to look in will be single.php.
I am having issues editing this because it seems my template is vastly different from others. Here is a little bit of code form the single.php
if (have_posts()){
/* Display navigation to next/previous posts when applicable */
if (theme_get_option(‘theme_top_single_navigation’)) {
theme_page_navigation(
array(
‘next_link’ => theme_get_previous_post_link(‘« %link’),
‘prev_link’ => theme_get_next_post_link(‘%link »’)
)
);
}while (have_posts())
{
the_post();
get_template_part(‘content’, ‘single’);
comments_template();It seems that it is pulling from the info for a single php from a different part of the template.
Am i reading that correct?
Cory, yes, it appears you’re reading that correctly. Most of the WordPress bundled themes use this style because it’s a cleaner way to do it. In this case, you want to focus on the
get_template_part
section near the bottom of the code you pasted.See where it says
get_template_part( 'content', 'single' );
? That’s referencing a second file called content-single.php, or content.php or single.php (confusing, right?). I suggest you look in your file list in the editor and try to locate a file called content-single.php (or, if it doesn’t exist, one of the other choices I listed).If you’re interested, you can read more about
get_template_part
in the Codex article.Alright im crazy confused now. THis is what is in the content single.php
<?php
global $post;
theme_post_wrapper(
array(
‘id’ => theme_get_post_id(),
‘class’ => theme_get_post_class(),
‘title’ => theme_get_meta_option($post->ID, ‘theme_show_post_title’) ? get_the_title() : ”,
‘before’ => theme_get_metadata_icons(‘date,author,edit’, ‘header’),
‘content’ => theme_get_content(),
‘after’ => theme_get_metadata_icons(‘category,tag’, ‘footer’)
)
);
?>Am i reading correctly that it is once again taking the info from another page? THe get meta options?
Wow, this theme is kind of intense. Can you provide us with a link to your site and the name of the theme you’re using?
Yea. Its a theme i made in artisteer. Is there a plugin that simply removed H1 and H2 defualt tags on single posts.
Is there a plugin that simply removed H1 and H2 defualt tags on single posts.
Not that I’ve ever seen.
Unfortunately, it looks like the markup you seek might live inside the
theme_post_wrapper()
function which can probably be found in your theme’s functions.php file. I frankly can’t fathom why the theme developer would do it this way … it makes it incredibly difficult to customize after the fact as I’m sure you’re well aware by now ??Yea this has become a nightmare, and I know it is affecting my search results. Essenitally all of my posts have my site name as the first heading.
Is there a way to simply remove my header all together for posts?
From what I’m seeing, it looks like the developer has wrapped everything up in functions. You might take another close look at the single.php. Look above the Loop section, e.g.
if ( have_posts() ...
and see if there’s anything to do withthe_title()
orget_the_title()
.Sorry I couldn’t be of more help.
deleted
‘theme_header_show_headline’ => 1,
‘theme_header_show_slogan’ => 1,is this what im looking for? switch it to a different heading? Or is the 1 value saying true?
Also i found some wrapper options. 9( a lot of code sorry)
unction theme_post_wrapper($args = ”) {
$args = wp_parse_args($args,
array(
‘id’ => ”,
‘class’ => ”,
‘title’ => ”,
‘thumbnail’ => ”,
‘before’ => ”,
‘content’ => ”,
‘after’ => ”
)
);
extract($args);
if (theme_is_empty_html($title) && theme_is_empty_html($content)) return;
if ($id) {
$id = ‘ id=”‘ . $id . ‘”‘;
}
if ($class) {
$class = ‘ ‘ . $class;
}
?>
<div class=”art-post<?php echo $class; ?>”<?php echo $id; ?>>
<div class=”art-post-body”>
<div class=”art-post-inner art-article”>
<?php
echo $thumbnail;
if (!theme_is_empty_html($title)){
echo ‘<h2 class=”art-postheader”><img src=”‘.get_bloginfo(‘template_url’).’/images/postheadericon.png” width=”29″ height=”21″ alt=”” />’.$title.'</h2>’;
}
ob_start();
echo $before;
$meta = ob_get_clean();
if (strlen($meta) > 0) {
echo ‘<div class=”art-postmetadataheader”>’.$meta.'</div>’;
}?>
<div class=”art-postcontent”>
<!– article-content –>
<?php echo $content; ?>
<!– /article-content –>
</div>
<div class=”cleared”></div>
<?php
echo $after;
?>
</div>
<div class=”cleared”></div>
</div>
</div>i notticed a few parts have the H2 code. DOes this help?
Cory,
FYI, when you’re going to be posting big blocks of code, you should use https://wordpress.pastebin.com instead of posting it directly here. You just paste the code there, click submit then supply the URL to it here. Sometimes wayward code can wreak havoc on the forums ??
i notticed a few parts have the H2 code. DOes this help?
I suppose you could try removing this block:
if (!theme_is_empty_html($title)){ echo '<h2 class="art-postheader"><img src="'.get_bloginfo('template_url').'/images/postheadericon.png" width="29" height="21" alt="" />'.$title.'</h2>'; }
Well i tired that..and now i have a major problem. My site has crashed…
Im not sure what I did. I made a back up of the code.
But now it says there is an error on like 63???
If you have FTP access, I suggest logging in and replacing the file with the original (if you have it or can get it). My best suggestion at this point is to approach whoever developed your theme and asking them what the best way forward is for customizing your single page. It’s getting late here, I’m just sorry I could help you get your (original) problem resolved.
- The topic ‘Remove H1 and H2 tags from header on posts?’ is closed to new replies.