Advanced Carousel

Ok, as ai said you before, i want to make a tutorial about a more advanced carousel than previous was.

I won’t explain HTML and CSS code (is very simple and intutive):


CSS file:

* {margin:0;padding:0;}

.clearfix:after {content:".";display:block;height:0;clear:both;visibility:hidden}
.clearfix {display:inline-block}
/* Hide from IE Mac \*/
.clearfix {display:block}
/* End hide from IE Mac */
* html .clearfix {height:1px}
.carousel {
	position: relative;
	overflow:hidden;
	height:500px;
	width:540px;
	margin:50px auto
}
	.carousel .ctrls {
		margin:10px
	}
	.carousel ul {
		position: absolute;
		width:8000px;
	}
		.carousel li {
			float:left;
			width:98px;
			height:98px;
			border: 1px solid #fff;
			list-style:none;
			margin-right:10px;
			text-align: center;
		}

The good part of this carousel is that you can have as many as you want in your page. You can have both fixed and fluid width and will work with no problem. Or at least no problem: on fluid layout, some images can be cutted. So, the best use is fixed width. Also, you can have autoscroll (with timers, i will say more later), but is not recommended because you may encounter some performance troubles.

After we include last version of jQuery, we have to do these things:

1) Iterate trough all .carousel containers (if you want to pick another name, this is the place and this is also the time!) and set the width.

$('.carousel').each(function(){
	var _this=this;
	var elWidth = $(_this).find('li:eq(0)').width()+12;
	$(_this).find('ul').width(elWidth*$(_this).find('li').length).css('left', 0);
});

We assume that all LI have same width, 10px margin and a border. So we adjust the width with 12 px (2px from border). If you have a wider margin (or none) change it, otherwise you will have some serious problems :D

The previous/next buttons we will control with a separate function, because we don’t have double scroll on double click, right? We put the function INSIDE of the each loop:

function carouselCtrls () {
	$(_this).find('a.prev').unbind().click(function(){
		$(this).unbind();
		if(parseInt($(_this).find('ul').css('left'))<0) {
			$(_this).find('ul').animate({
				left: '+='+elWidth
			}, function(){
				carouselCtrls();
			});
		}
		return false;
	});
	$(_this).find('a.next').unbind().click(function(){
		$(this).unbind();
		var maxWidth = (parseInt($(_this).find('ul').width())-$(_this).width()-10)-(-parseInt($(_this).find('ul').css('left')));
		if(maxWidth>0){

		$(_this).find('ul').animate({
			left: '-='+elWidth
		}, function(){
				carouselCtrls();
			});
		}else {
			$(_this).find('ul').animate({left:0},function(){
				carouselCtrls();
			});
		}
		return false;
	});
	};


Let see how it works (i will explain only one link because the other one works same – but reverted):
Continue reading

Wordnewz WordPress theme

Well.. is done :) The Wordnewz is finally done.

As i said, there is two version of theme: free and premium. Read below to see the differences.

Preview:

Free theme :

  • You have to edit all files to make some changes. For ads you need to edit files from ads folder. For index settings you need to change index.php
    • For featured slider: find
      < ?php $my_query = new WP_Query('tag=featured&showposts=3');

      featured – enter tag slug and how many slides you want

    • For small excerpts find:
      $my_query = new WP_Query('category_name=economy&showposts=3');

      Change category_name according to your category slug

  • Images is added width custom fields with 130x130px for index and 200x150px for inner slider
  • Plugin settings
  • Print This
  • Email this
  • Excerpt length: 150

Download here.

What about premium version?

When you purchase the premium version you will have:

  • Technical support
  • Install/configure wordpress theme and plugins
  • Small changes of theme (colours, sizes, etc)
  • Admin panel for theme
  • RSS for each category
    • mail: slice [@] iamntz. [] com
    • y!messenger: i0nutzb
    • skype: i0nutzb
  • The price for premium theme is $50 and for more details you can contact me here:

    For now i don’t have an automatic way for purchasing, but i will reply you ASAP.

WordPress get_posts() function

Today i spent some time trying to figure how to get existing (and also used) tags from wordpress and using in admin panel as a combo box, for my brand new theme Wordnewz.

The return of get_tags() function was some kind of array but, because of my skills (not) in PHP i spend WAY too much time to go figure what to do. The initial result of get_tags() function is:

Array
(
    [0] => stdClass Object
        (
            [term_id] => 28
            [name] => Featured
            [slug] => featured
            [term_group] => 0
            [term_taxonomy_id] => 29
            [taxonomy] => post_tag
            [description] =>
            [parent] => 0
            [count] => 6
        )
)

And i only needed [name] and [slug]. Ofcourse, like a smart guy that i am, i pointed my browser on wordpress codex where i found… NOTHING. Nothing about this function… Great. Let’s try various stuff and google it for any ideas. And i found a PHP function get_object_vars for easy conversion. After this, all was GREAT. I use it like this:

$allTags = get_tags();
foreach($allTags as $thisTags) {
		$thisTag = get_object_vars($thisTags);
		echo '


\n';
}

And it WORKS like a charm. I posted this thing because i didn’t found too much references for stdClass Object or get_tags() WordPress function.

And another one!

After last two wordpress themes that i released in last weeks was a success (i expected to have less feedback than i had), i was thinking to make another theme. This time will be a free-premium theme. What it mean this? The theme will be launched as a free theme and will have some features available only if you pay (almost anything from site will be customizable from admin panel).

Anyway, it’s a theme great for using in a news site, fixed width, two sidebars, using custom fields and various plugins.

Here is a preview of current progress:

I think will be done by the end of this week, when i will release both free and premium version of the theme.

Stay tuned for more.

Another free WordPress theme – Rounded.Cube

Yesterday i was pretty bored: weekend, alone, and all bad things and i say to make another free wordpress theme. I opened Photoshop and i start to draw. You can see the results on the next screenshot or here.

Free wordpress theme

Some of the main features:

  • Widgetizable;
  • Xhtml 1.1 / CSS 2.1 Valid;
  • 2 columns;
  • trackbacks and pingbacks are separated from comments;
  • and more things that you can discover if you try this great and free wordpress theme :D

You can download the teme HERE.

But wait! There is more nice things to come! More free wordpres theme to come and if you want a premium theme, don’t wait and contact me.