Jump to content
Sign in to follow this  
antonella

Add Category as Title on Posts Pages and Single Post Pages

Recommended Posts

antonella

I would like the title of the Blog Category to appear as the Page title on the Posts pages and the Single Post Page. How can I do that? Here are a few samples: Posts page (Title would be News & Events) http://www.sonsofpoland.org/site/news-events/ Single Post Page (Title would show as Press Releases or whatever category from the page it was linked from. For example, if it was linked through the press releases page, it would show as Press Releases. If it was clicked on from the News & Events page, it would show as News & Events.) http://www.sonsofpoland.org/site/2011/08/11/the-associated-sons-of-poland-assists-triplets/ Is any of this at all possible? At least I would like the title to appear on the Posts list pages if not the single posts page. Thanks, Antonella

Share this post


Link to post
Share on other sites
antonella

Thanks, but what files in Platform Pro do I add this? The single.php file only says "setup_pagelines_template();" and nothing else. This is obviously handled differently in Platform Pro from basic WP themes. Where do I find the template for single post page and blog post list so that I can modify? Thanks, Antonella

Share this post


Link to post
Share on other sites
catrina

The file you're looking for has a blog post list, so it should The template loop PHP file,


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
antonella

I've added the code:

Category: <?php single_cat_title(); ?>

in the template.postloop.php file. However, I get this error on all pages: Parse error: syntax error, unexpected '<' in /data/9/1/46/134/1209949/user/1289583/htdocs/site/wp-content/themes/platformbase/template.postloop.php on line 27 Where do I put the actual line? I was putting it above this code: // Start of 'The Loop' if(have_posts()){ while (have_posts()) : the_post(); if(!pagelines_show_clip($count, $paged) || is_admin()): Also, I don't want this to appear on all my pages, just the blog list and the single post pages. Is this the only area it will show up in? Thanks.

Share this post


Link to post
Share on other sites
Jenny

This is above my head so hopefully someone else can help but I assume you need to add a closing php tag

?>
before your added html and an opening php tag
<?php

after your html.


Jenny :: Web designer at Simple Mama (follow me at @simplemamacom)

Check out Share Me, a social sharing add-on for DMS that is super simple to set up.

Share this post


Link to post
Share on other sites
antonella

I figured out I had the code in the wrong place. I had to put it at the beginning of the file, before this section: `<?php /* THE LOOP (Posts, Single Post Content, and Page Content) This file contains the WordPress "loop" which controls the content in your pages & posts. You can control what shows up where using WordPress and PageLines PHP conditionals This theme copyright © 2008-2010 PageLines */. However, it's only showing the static text "Category:" without showing the category title (for example, News). I also tried another code snippet I found on the Wordpress forums, and it gets me closer, although still not perfect because it shows duplicate category titles for the posts that have more than one. But I have a request to the WP forums on that one. `

<?php $categories = get_the_category(); foreach($categories as $category) { $cat_name = $category->name; if($cat_name != 'featured') echo 'term_id).'">'.$cat_name . ' '; } ?>

` Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×