Jump to content

knowledhe base article h1 & h2


Recommended Posts

Hi,

By default, WHMCS knowledge base articles have:

H1: "Knowledge Base"

H2: <article title>

This doesn't seem like a sensible optimisation of headings. Surely the article title is more important than the fact it is part of the Knowledge Base?

Is there a way I can swap the H1 & H2 around?

Help appreciated.

Steve

Link to comment
Share on other sites

You can change the following files:

/templates/six/knowledgebasearticle.tpl
/templates/six/includes/pageheader.tpl

Changing the h1 tag  in the pageheader.tpl file will also change the tag for every other page where that header is used. You can probably use an if/else block to only change it for the knowledgebase article.

Edited by DennisHermannsen
Link to comment
Share on other sites

if you wanted to avoid touching the templates, you could use an action hook to redefine the h1 / h2 font sizes on that page...

<?php

# Change KB Article Header Sizes Hook
# Written by brian!

function change_knowledgebase_article_header_sizes_hook($vars) {
	
	$validtemplates = array("knowledgebasearticle");
	if (in_array($vars['templatefile'],$validtemplates)) {
		$head_return = "<style>.header-lined h1 {font-size: 30px !important;}
		.kb-article-title h2 {font-size: 36px !important;}</style>";
		return $head_return;
	}
}
add_hook("ClientAreaHeaderOutput",1,"change_knowledgebase_article_header_sizes_hook");

xJGIzge.png ---> XBLnLYP.png

if you want to add additional pages to change the h1 heading size, then you can add them to the $validtemplates array.

Link to comment
Share on other sites

53 minutes ago, bear said:

I believe he's after more than changing font size only? In SEO, H1 gets more attention than H2, so the article title should get "top billing" over the fact it's a KB page. 

then he could switch to 21 where the kb article title uses H1 by default. 😎

Link to comment
Share on other sites

10 minutes ago, Steve75 said:

I don't understand what this means sorry Brian.

if you use the Twenty One theme (v8 or later) rather than Six, then it uses H1 for kb article titles...

aAbNZ7F.png

the suggestion was facetious on my part - personally, I wouldn't suggest switching themes solely for this reason if you're happy using Six.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated