Jump to content

Archived

This topic is now archived and is closed to further replies.

alisamski

Add Category Titles to Category Pages Possible?

Recommended Posts

alisamski

I would like to add a category title on my pages at top... not the usual post info metabar...

 

Frameworks I've added this to the function file... which would create an H1 Title for the category page.

//ADD CATEGORY TITLE AT TOP OF CAT PAGES
add_action('pagelines_inside_top_postloop','cat_title');
function cat_title(){
if ( is_category() ) {
?>
<h1 class="cat-title"><?php single_cat_title(); ?></h1>
<?php
}
}

What would be the proper action? or is there a simpler way?

 

Please advise.

Share this post


Link to post
Share on other sites
Rob

Anca,

 

It may be simpler than that!

 

http://codex.wordpress.org/Function_Reference/single_cat_title

 

There's a simple PHP snippet in there (1st one) that can be converted to a shortcode with a plugin I'm sure you know... Shortcode Exec PHP.

 

Add text area into your category template, above the postloop and drop the shortcode into it. Save and you should have title!


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
alisamski

Thanks Rob... that worked great.

Share this post


Link to post
Share on other sites
Rob

I'm very, very happy to hear that!


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites

  • Similar Content

    • stijnxo
      By stijnxo+
      Is it possible to get the children of the parent page in Powerloop using Custom Taxonomy and Custom term?
    • JP
      By JP+
      Hello,
      We are working on a 2 languages site (https://liguecardioliga.be) with wpml, and lately the call of a category in the loops section (and all the sections requiring a category to select posts) doesn't work in the translated language. It worked well until recently so I wonder if it's because of a recent update (wordpress, wpml, pagelines, a plugin?). Anyone has the same problem? a solution?
      TIA
    • yemoonyah
      By yemoonyah+
      Hi,
      I'm trying to hide my blog post titles on my single post pages but not on the blog page (where all posts are listed).
      Here is the code I use for that:
      .single-post .entry-header .page-title { font-size: 0; } But even though I specify that it should only happen on single post pages, it still shows on the general blog page.
      See here: http://yemoonyah.com/blog
      How can I fix that?
      Thanks,
      Yamile
       
    • StuLeeUK
      By StuLeeUK+
      I have noticed in Google Search Console that I have a lot of errors in the structured data, all down to the error 'Missing: entry-title'.
      All the other fields seem fine but this one error flags up on all blog posts.
      Can anyone point me in the right direction please because I have no idea about this stuff and don't know where to start to try and fix it. Is it anything to even worry about?
    • mzhafzah
      By mzhafzah
      Hello
      I am using DMS 2 theme and I want to create a 2 different links on my website; each link should take you to a different blog post category. Although the process is easy, yet I can not figure out how to give each category page a unique design of its own; Any change I make on any page is applied to the other (I'm aware of the universal elements like the header and footer and I a am not talking about these.)
      Since I am new to wordpress in general, I am not sure if my description is sufficient; apologies if it is not.
      TycoonJé
×