Steve75 Posted June 22, 2021 Share Posted June 22, 2021 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 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted June 22, 2021 Share Posted June 22, 2021 (edited) 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 June 22, 2021 by DennisHermannsen 0 Quote Link to comment Share on other sites More sharing options...
Steve75 Posted June 22, 2021 Author Share Posted June 22, 2021 Thank you Dennis. Can you help me with the conditional logic to test for a kb article please? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 22, 2021 Share Posted June 22, 2021 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"); ---> if you want to add additional pages to change the h1 heading size, then you can add them to the $validtemplates array. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted June 22, 2021 Share Posted June 22, 2021 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. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 22, 2021 Share Posted June 22, 2021 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. 😎 0 Quote Link to comment Share on other sites More sharing options...
Steve75 Posted June 22, 2021 Author Share Posted June 22, 2021 36 minutes ago, brian! said: then he could switch to 21 where the kb article title uses H1 by default. 😎 I don't understand what this means sorry Brian. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 22, 2021 Share Posted June 22, 2021 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... the suggestion was facetious on my part - personally, I wouldn't suggest switching themes solely for this reason if you're happy using Six. 0 Quote Link to comment Share on other sites More sharing options...
Steve75 Posted June 29, 2021 Author Share Posted June 29, 2021 Oh okay. I use a child theme of Six. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.