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+    8
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    547
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!

  • Like 1

Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
alisamski+    8
alisamski

Thanks Rob... that worked great.

Share this post


Link to post
Share on other sites
Rob    547
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

    • 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é
    • Bleuy
      By Bleuy+
      Afternoon Peeps
       
      I trust this all finds you well?
       
      I’m not sure if my problem is WooCommerce related or DMS template related, so I am trying both forums in the hope of a resolution of my problem.
       
      The Challenge:-
      Provide customer with Product Pages that relate to their Product_Category along with similar functionality (Sub Category menu on the right of Page)
       
      http://sportsgallerie.wpengine.com/product-category/boxing/
        I would like to replicate the functionality of the above but with a Unique Image Header for each Category Page.  Is this possible?
       
      Or
       
      Create specific Product Pages that have similar functionality to the Product_Category pages?
       
      I have created the relevant pages and am using the relevant WooCommerce Shortcodes, however, these are not functioning as I would expect them to and I believe that this may be a Functions.php issue??
       
      The page in question is: http://sportsgallerie.wpengine.com/gallery/boxing-art/ ‎
       
      The shortcode I am using to pull through the relevant products (63 in total) is:-
       
      [product_category category=”boxing” columns="3" order="ASC" per_page="20"]
       
      Issues:-
      I am not getting the Sub-Categories, 17 in total (as I would with the Product_Category option) I am only getting 1 page (20 items) and no option to show more pages or products (the more pages /previous items is missing from the bottom) Again I would refer you to the http://sportsgallerie.wpengine.com/product-category/boxing/ as this is very much how I want these pages to function.  
      I can’t seem to find anything on searching the net that relates specifically to my issues, so I can only assume that this is potentially a DMS/ or more likely user issue!
       
      All advise/assistance greatly appreciated.
       
       
       
×