Closed GoogleCodeExporter closed 9 years ago
Now you owe me 2 beer!!!
Try this one in your functions.php:
function l_child($pc) {
if ($thematic_post_alt = get_option('posts_per_page')) {
$pc[] = 'l_child';}
return $pc;
}
add_filter('post_class','l_child');
Cheers,
Chris
Original comment by chris.gossmann@googlemail.com
on 7 Feb 2009 at 8:09
OkOk .. still need to work on it .. filter won't work on your last page if the
number
of posts is less than post_per_page ...
Original comment by chris.gossmann@googlemail.com
on 7 Feb 2009 at 8:21
that's really good!!!!!! it solves the issue 30 but not this one.
maybe I was not clear enough.
i'm talking about this:
<ul>
<li class="page_item page-item-27"><a
href="http://localhost/fabiolananew/?page_id=27" title="two">Two</a></li>
<li class="page_item page-item-28"><a
href="http://localhost/fabiolananew/?page_id=28" title="three">Three</a></li>
</ul>
I would like to add a class to page "Three", the last page (ie li
class="page_item
page-item-28 LASTPAGE"
so it will be easy to manage the style of the menu link if, as I written
before, I
use "border-right" only, as a separator for <li>s.
at this time we can't manage the <li> individually.
Hope it's clear enough.
if the page order isn't set, I don't know how to add this class. Otherwise, if
order
is set we could write a function that "reads" the page order on the DB and add
the
class to the biggest number.
I owe you 50 beers!
Original comment by dannydam...@gmail.com
on 7 Feb 2009 at 8:24
OK .. will be back as soon as I have a solution ;-)
Original comment by chris.gossmann@googlemail.com
on 7 Feb 2009 at 9:01
maybe you could add a border-left to all but the first children?
function thematic_add_firstchild_to_menu($content) {
$pattern = "/<ul><li(.*?)class=('|\")([A-Za-z0-9 \/_\.\~\:-]*?)('|\")([^\>]*?)>/is";
if ( preg_match_all ( $pattern , $content , $firstChildren ) ) {
foreach ( $firstChildren[0] as $firstChild ) {
$replacement = '<ul><li$1class=$2$3 first-child$4$5>';
$replacedChild = preg_replace($pattern, $replacement, $firstChild);
$content = str_replace($firstChild, $replacedChild, $content);
}
}
return $content;
} // end thematic_add_firstchild_to_menu
add_filter('wp_page_menu','thematic_add_firstchild_to_menu');
Best regards, Arne
Original comment by arne.fra...@gmail.com
on 20 Apr 2010 at 11:36
I'm marking this a wont fix. I don't have an opinion on the matter but if it's
been sitting for two years. Someone can resurrect if so inclined.
Original comment by eugene.m...@gmail.com
on 17 Jan 2012 at 3:12
Original issue reported on code.google.com by
dannydam...@gmail.com
on 25 Jan 2009 at 3:14