It's about the view of a single post. I'm trying to set the links for previous and next blogposts like this way:

<a class="prevpost" href="linktoprevpost" title="prev post's title">&nbsp;</a>
<a class="nextpost" href="linktonextpost" title="next post's title">&nbsp;</a>

where both links get an image as background by using display: block and specified width and height. The titles of the linked posts should be accessible via the title-attribute of the a-tags, so that users can see them by hovering.
I also want to restrict the linked posts on the current category. So I need to find a way to get

  1. an a-tag with the href of the previous/next post
  2. which is in the same category as the one currently viewed
  3. without inner text because of the backgroundimage
  4. with the previous/next post name in title-attribute
  5. with a custom css-class


The category matching needs to be only the first level because I divided my page into 3 main categories. I'm using

$a = get_the_category(get_the_ID());
$cat = $a[0]->name;

for getting the first category's name and setting it as additional body-class in header.php. Maybe I could reuse that?

I also found out that using previous_post_link() and next_post_link() like this way

next_post_link('%link', '', TRUE);

gives me the posts of the same category without inner content, so 1 & 2 & 3 would be solved. But it seems, to get 4 & 5 too I'll need another way.

Using Wordpress Version 3.4.1.

Edit
Report