Aug 13, 2004 WordPress:

Category display et al

I have once again found myself playing with WordPress. This time I added support for showing the currently selected category at the top right corner of the content area. Click any categories on the menu and see the results by yourself.

If you are a regular visitor, please update your CSS file by pressing CTRL+F5 (or the required key combination to force reloading all files).

In the same process I also added links to previous and next post into single post pages.

Once again, both these changes required some digging in WP. The next post wouldn’t include > sign inside the link, so I changed the code. Bad solution, but seemingly the only one. The current category was easier, I accidentally spotted proper undocumented function for the job: get_the_category_by_ID(). So I simply added the following code to index.php:

if(isset($cat)) {
  echo get_the_category_by_ID($cat);
}

And presto, we have the current category! Add your own HTML code around the function for more formatting.

1 Comment

The URI to TrackBack this entry is: http://www.nomadig.com/2004/08/13/category-display-et-al/trackback

1. the bomb site weblog » WordPress Category Titles — Monday, Aug 16 2004

[...] “id” to your hearts content in your CSS. Simple really! My thanks to Janne at Nomadig for pointing this one out.

Comments (0) slvShowNewIndicato [...]

Leave a comment

The following Textile shortcuts are available:

_emphasis_
*strong*
@code@
^superscript^
~subscript~
+inserted text+

Hyperlink:
"link text":http://link.url

Image:
!http://image.url!

Lists:
* bulleted
# numbered

Hide help

Please be polite and use common sense when posting. Any comment is subject to removal. The e-mail address is required, but it is not shown to anybody else than the administrator.

Commenting uses Textile and your message is previewed below. Show Textile help

Write your comments

 

Preview

2.  — Feb 8 2012