Archived

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

  • 0

Displaying A Post's Category

Question

Posted · Report post

So on Climbur.com I want to be able to have text like this at the top of each post underneath the post title:

 

This story will inspire you to CREATE.

 

or 

 

This story will inspire you to THINK.

 

The words in all caps are my categories on the site. How do I make it so I can add this text and automatically pull in the text with the category name (where it's in all caps)?

 

Thanks!

Share this post


Link to post
Share on other sites

10 answers to this question

Posted · Report post

Hi there

 

To achieve this you'll need to use a hook to insert some code into the relevant position on the page. You can use the actionmap plugin from the store to find the position you want the text to appear, then use either hooker plugin to insert the code. You can find out more about hooks here http://support.pagelines.me/docs/customization/hooks/

 

I'm not a developer, but I think the code you'll need to insert into the hook will look something like the following

<p><?php single_cat_title('This store will inspire you to '); ?>.</p>

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks James. Do you know how to make the category itself a link?

Share this post


Link to post
Share on other sites

Posted · Report post

Also, that didn't work :) It just displayed a period and no text/category...

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks. I just tried putting in: <?php get_category_link$category_id ); ?> 

 

Using the pagelines_loop_before_post_content hook and it displayed nothing...

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks for sticking with me on this subject trying to solve it. Unfortunately, not a single example from that page works via the hook editor. It always outputs partial code, but no Category/Link. 

Share this post


Link to post
Share on other sites

Posted · Report post

Hm, and is this on an individual post page or a post within the blog page?

Share this post


Link to post
Share on other sites

Posted · Report post

Hi there,

 

To enable php to be used within the hooker plugin you'll need to add define( 'PL_HOOKS_PHP', true ); to the wp-config first as mentioned in the plugin instructions. Hooker will only allow html/js/css by default, php will need to be added using that code.

Share this post


Link to post
Share on other sites