User:Hydroplane

From Habari Project

Jump to: navigation, search

Contents

Wanted Pages

To do

Mark article as read/unread. Something like 'favorite tweet' maybe?

Code

Disable links to the current page in menu

Clear menu links to the current page (thanks lildude).

<?php
foreach ( $pages as $page ) {
?>
<?php if (isset($post) && $post->slug == $page->slug) : ?>
<li class="current_page_item"><?php echo $page->title; ?></li>
<?php else : ?>
<li><a href="<?php echo $page->permalink; ?>"><?php echo $page->title; ?></a></li>
<?php endif; ?>
<?php } ?>

Monthly Archives list

A list of posts grouped by month, with rateit + postwordcount. (thanks mikelietz)

		<dl>
<?php
$stars_classes = array(
            0 => 'nostar',
            1 => 'onestar',
            2 => 'twostar',
	            3 => 'threestar',
	            4 => 'fourstar',
	            5 => 'fivestar'
        );
 
		$results = Posts::get( array(
			'content_type' => 'entry',
			'status' => 'published',
			'limit' => 0,
//			'month_cts' => 1
			)
			);
$whichyear = 0;
$whichmonth = 0;
		foreach( $results as $result ) {
$resultyear = $result->pubdate->get( 'Y' );
$resultmonth = $result->pubdate->get( 'F' );
 
if ( $whichyear != $resultyear || $whichmonth != $resultmonth ) {
	$whichyear = $resultyear;
	$whichmonth = $resultmonth;
	echo "<dt style='padding-top:1em;width:120px;'>$whichmonth $whichyear</dt>\n";
}
//Utils::debug( $result ); die();
$result_link = "<a href='" . $result->permalink . "' title='" . $result->title ."'>" . $result->title . "</a>";
$result_rating = "<div class='rateit-stars rateit-" . $stars_classes[ $result->info->rateit_rating ? round($result->info->rateit_rating) : 0 ] . "'><div class='rateit-readonly'></div></div>";
			echo "\t<dd style='padding-left:125px;'>" . $result_link . $result_rating . $result->word_count . " words</dd>\n";
		}
 
?>
		</dl>
Personal tools