KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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"> </a> <a class="nextpost" href="linktonextpost" title="next post's title"> </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 an a-tag with the href of the previous/next post which is in the same category as the one currently viewed without inner text because of the backgroundimage with the previous/next post name in title-attribute 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.
Tags (comma-separated)
Save Edits
Cancel