Contact Lushano Perera

x Cancel
posted 2 years ago

WordPress + QuickSand jquery plugin small tip

                // Create data type markup based on post classes as need by Quicksand jQuery plugin
function data_type( $data_type = '', $post_id = null ) {
	echo 'data-type="' . join( ' ', get_post_class( $data_type, $post_id ) ) . '"';
}                
Raw

Last week I needed to sort some custom posts using the Quicksand plugin. You'll probably know the WordPress function post_class() which can be usefull to sort posts by categories: the only problem is that the function produces a markup like class="post-52 brand type-brand status-publish hentry category-uomo" when Quicksand needs a markup like this data-type="post-52 brand type-brand status-publish hentry category-uomo"

A workaround can be getting the entire function post_class() located in wp-includes/post-template.php, modify the echo part of code (as I did above) and paste it in your function.php

posted 2 years ago

My website redesign

I've redesigned my personal website to improve the contents management with a better eye on text readability than the previous version. I'm still having some problems with the font rendering: there is a huge difference with the font rendering on Chrome compared to the other browsers. 
Here is a screenshot made on Firefox/Mac http://m.friendfeed-media.com/f5c4993ad0d989584c1bfd287a9733de2034b55d

I've redesigned my personal website to improve the contents management with a better eye on text readability than the previous version. I'm still having some problems with the font rendering: there is a huge difference with the font rendering on Chrome compared to the other browsers. Here is a screenshot made on Firefox/Mac m.friendfeed-media.com/…

posted 2 years ago

Blog post layout

blog post layout on my wordpress based redesigned website.

blog post layout on my wordpress based redesigned website.

posted 2 years ago

Wordpress: Find Page's Top Level Parent ID

http://cssglobe.com/post/5812/wordpress-find-pages-top-level-parent-id

As the author said:

This code checks if the page we're on (current page) has a parent. If so, that means that we are at least 2 levels deep in the navigation. In that case function get_post_ancestors is called. It returns an array of all the ancestors' IDs up to the top level (root). To get the ID of the top level ancestor we need to fetch the last item in that array. On the other hand, if the page we're on doesn't have a parent it means we are currently on a top level page so we can use the current page ID. Once we get the ID of the top level parent we can use it in wp_list_pages function to get its children.

This snipplet really saved my ass!

posted 2 years ago

Livestream status PHP widget

                <?php 
	$user = 'username'; //insert livestream username here
	$json = file_get_contents('http://x' . $user . 'x.api.channel.livestream.com/2.0/livestatus.json'); 
	$status = json_decode($json, 1); 
	if($status['channel']['isLive']) { 
?>
     <!-- user is online so do the stuff you want -->  
<?php } else { ?>
     <!-- user is offline so do the stuff you want -->  
<?php } ?>                
Raw

Here is a simple PHP widget that shows your user status using Livestream API

posted 2 years ago

TBOX Digital Performance

A snapshot of the latest WordPress based <a href="http://www.tboxdigital.com/">project</a> I'm working on.
It's still a working progress, so it doesn't work correctly yet on IE.

Graphics by my graphic designer (nilushana@gmail.com - have any Forrst invitation form him?) and everything else by me.

A snapshot of the latest WordPress based project I'm working on. It's still a working progress, so it doesn't work correctly yet on IE.

Graphics by my graphic designer (nilushana@gmail.com - have any Forrst invitation form him?) and everything else by me.

posted 2 years ago

Looking.it website snaphot #3

CSS3 styled search form - psd by my graphic designer at our company & css3 headache by me :P

Just kidding, CSS3 styling is easy and fun!

CSS3 styled search form - psd by my graphic designer at our company & css3 headache by me :P

Just kidding, CSS3 styling is easy and fun!

posted 2 years ago

Looking.it website snaphot #2

A snapshot of a website redesign I'm working on

A snapshot of a website redesign I'm working on

posted 2 years ago

Looking.it website snaphot #1

A snapshot of a website redesign I'm working on

A snapshot of a website redesign I'm working on

posted 2 years ago

CSS3 Fun

Some time ago I've built a simple lifestream based on Sweetcron for me and my fellas at my company and it was the chance to make some experiments with backgrounds and css3 properties like rgba colors and trasformations (scaling). 
Here is a detail of the pagination links.

Some time ago I've built a simple lifestream based on Sweetcron for me and my fellas at my company and it was the chance to make some experiments with backgrounds and css3 properties like rgba colors and trasformations (scaling). Here is a detail of the pagination links.