How might I figure out the category based on the CSS classes on the body please? Here is the body element:
<body class="archive category category-basketball category-23872 content-sidebar">
I want to output DFP page targeting for a category archive page. The format for the DFP page targeting code is
googletag.pubads().setTargeting( "category", "basketball" );
Therefore, I want to check for the existence of a category-{something} where {something} is the value for the category. Unfortunately, the 2nd category-23872 complicates the issue.
Appreciate any help and ideas. Thanks
category-FOOBARwhereFOOBAR != integer? As pointed out by @DanielA.White regex should be doing that magic for you ;)