You are here:  » No H1 titles appear in upper level sub-categories


No H1 titles appear in upper level sub-categories

Submitted by Retro135 on Fri, 2017-01-20 03:10 in

Hi David,
Is it possible to also have H1 titles for each level of Category Hierarchy? Examples:
{link saved}
{link saved}

Current H1 code in header.php:
{code saved}

Submitted by support on Fri, 2017-01-20 10:33

Hi,

Sure - I see that your custom code in header.php is using the $q variable, so you can simply set that in categories.php - look for the following code at line 101:

  require("html/header.php");

...and REPLACE with:

  $q = $nodeInfo["name"];
  require("html/header.php");

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Fri, 2017-01-20 12:37

Works a charm! However, on the last category, it lists the entire path rather than just the current category as the others. Is there any way to just have the current category on the last? Examples:
{link saved}

Submitted by support on Fri, 2017-01-20 12:48

Hi,

When you get to the last category in a hierarchy the page is actually generated by search.php where $q would be, for example;

category:/Top Level/Sub Category 1/Sub Category 2/

Your custom code in html/header.php is already processing $q to remove category:, and pad out the separators with " / " however an alternative would be process $q into a separate variable $header_q and if it is category path, show only the lowest level, so where you have:

<?php print htmlspecialchars(str_replace(array(":","merchant","category","brand","/"),array("","","",""," / "),$q),ENT_QUOTES,$config_title); ?>

....REPLACE with:

<?php
  $header_q = str_replace(array(":","merchant","category","brand"),array("","","",""),$q);
  $header_p = explode("/",$header_q);
  if (count($header_p) > 1) $header_q = array_pop($header_p);
  print htmlspecialchars($header_q,ENT_QUOTES,$config_title);
?>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Fri, 2017-01-20 13:49

Fabuloso, works a charm! TY very much!