<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>CSS Globe | Web Standards Magazine</title><link>http://www.cssglobe.com/</link><description>Css Globe Articles</description><language>en-us</language><sy:updatePeriod xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">hourly</sy:updatePeriod><sy:updateFrequency xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">1</sy:updateFrequency><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/cssglobearticles" type="application/rss+xml" /><feedburner:emailServiceId>cssglobearticles</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>CSSG Collection: Free Comment Styles</title><link>http://feedproxy.google.com/~r/cssglobearticles/~3/UNBd2Oz3szo/cssg-collection-free-comment-styles</link><pubDate>Tue, 29 Sep 2009 02:31:00 PDT</pubDate><guid isPermaLink="false">http://www.cssglobe.com/post/6295/cssg-collection-free-comment-styles</guid><description>&lt;p&gt;This is the second CSSG collection I have created for you here on CSS Globe. After &lt;a href="http://cssglobe.com/post/3875/cssg-collections-web-forms"&gt;FREE form styles&lt;/a&gt; here are some free blog comments styles. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://templatica.com/articles/comments/comments.zip"&gt;&lt;img src="http://templatica.com/articles/comments/cssg.gif" alt="comments examples" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As some of you may know I run a small-time &lt;a href="http://templatica.com"&gt;template shop&lt;/a&gt; called Templatica. In my effort to give that site more visibility (I am being honest here) I decided to move the CSSG collections over to Templatica. Basically all you have to do to get these (and future) free styles is &lt;a href="http://templatica.com/post/25/styling-blog-comments-correct-markup-and-free-examples"&gt;hop over to Templatica&lt;/a&gt; and click the download link. I have also written an &lt;a href="http://templatica.com/post/25/styling-blog-comments-correct-markup-and-free-examples"&gt;article about proper comments section markup&lt;/a&gt; so your trip to Templatica might be worth its while.&lt;/p&gt;
		&lt;hr /&gt;&lt;p&gt;Copyright: &lt;a href="http://cssglobe.com"&gt;Css Globe&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=UNBd2Oz3szo:ymfevzLs984:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=UNBd2Oz3szo:ymfevzLs984:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=UNBd2Oz3szo:ymfevzLs984:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=UNBd2Oz3szo:ymfevzLs984:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=UNBd2Oz3szo:ymfevzLs984:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=UNBd2Oz3szo:ymfevzLs984:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=UNBd2Oz3szo:ymfevzLs984:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cssglobearticles/~4/UNBd2Oz3szo" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.cssglobe.com/post/6295/cssg-collection-free-comment-styles</feedburner:origLink></item><item><title>3 Easy and Fast CSS Techniques for Faux Image Cropping</title><link>http://feedproxy.google.com/~r/cssglobearticles/~3/hiHIMwoaLTI/3-easy-and-fast-css-techniques-for-faux-image</link><pubDate>Mon, 07 Sep 2009 04:04:00 PDT</pubDate><guid isPermaLink="false">http://www.cssglobe.com/post/6089/3-easy-and-fast-css-techniques-for-faux-image</guid><description>&lt;p&gt;This article is a summary of a 3 fast and easy CSS techniques you can use to display only a portion of an image in your content. All techniques explained here actually need only couple of lines of CSS. However, it is not cropping in a real sense of the word, we are not cutting the image down to a certain size (CSS can't do that yet) we are merely hiding the &amp;quot;extra&amp;quot; and displaying only a part of the image we want. That's why I call it &lt;strong&gt;Faux Image Cropping&lt;/strong&gt;.&lt;br /&gt;
	These techniques can be very helpful if you need to keep images at a certain size, i.e. thumbnails in the news section or something similar. Being able to use CSS to control  which portion of image to display is a great bonus.&lt;/p&gt;
&lt;p&gt;Please note that I am using these techniques on content images (IMG element), not background images. &lt;/p&gt;

&lt;h3&gt;Technique 1 - Using Negative Margins&lt;/h3&gt;

&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/lab/imagecrop/01.html" title="View Faux Image Cropping Demo"&gt;Take a look at the demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this technique image needs to be placed into parent element, in my case a paragraph. Parent paragraph must be a floating element (or set to a certain width). This technique will not work on full width (block) elements.&lt;br /&gt;
	We then set negative margins for all 4 sides: top, right, bottom and left.  Negative margins define the how far will image be pulled in each direction leaving only part of the image inside the parent. When we set parent's &lt;em&gt;overflow&lt;/em&gt; property to &lt;em&gt;hidden&lt;/em&gt; we hide the area if the image that is outside the parent - and achieve our goal. You should really play around with the values to get the proper feel of how it works.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://cssglobe.com/lab/imagecrop/01.jpg" alt="Faux Image Cropping" class="alt" /&gt;&lt;/p&gt;

&lt;p&gt;So the HTML will look like this: &lt;/p&gt;

&lt;pre&gt;&amp;lt;p class=&amp;quot;crop&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;http://templatica.com&amp;quot; title=&amp;quot;Css Templates&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;img.jpg&amp;quot; alt=&amp;quot;css template&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt; &lt;/pre&gt;

&lt;p&gt;and the CSS: &lt;/p&gt;

&lt;pre&gt;.crop{
	float:left;
	margin:.5em 10px .5em 0;
	overflow:hidden; /* this is important */
	border:1px solid #ccc;
	}
	/* input values to crop the image: top, right, bottom, left */
.crop img{
	margin:-20px -15px -40px -55px;
	}&lt;/pre&gt;

&lt;h3&gt;Technique 2 - Using Absolute Positioning&lt;/h3&gt;

&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/lab/imagecrop/02.html" title="View Faux Image Cropping Demo"&gt;Take a look at the demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you don't feel good about using negative margins I suggest using this technique. It involves parent (paragraph) that has a specific width and height. Paragraphs's &lt;em&gt;position&lt;/em&gt; property is set to &lt;em&gt;relative.&lt;/em&gt; Width and height define the size of the area being displayed. Image placed inside the paragraph has it's position &lt;em&gt;property&lt;/em&gt; set to &lt;em&gt;absolute&lt;/em&gt;. We can then position it with &lt;em&gt;top&lt;/em&gt; and &lt;em&gt;left&lt;/em&gt; property and by doing that define which part of the image we'd like to display. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://cssglobe.com/lab/imagecrop/02.jpg" alt="Faux Image Cropping" class="alt" /&gt;&lt;/p&gt;

&lt;p&gt;HTML is identical as in previous technique: &lt;/p&gt;

&lt;pre&gt;&amp;lt;p class=&amp;quot;crop&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;http://templatica.com&amp;quot; title=&amp;quot;Css Templates&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;img.jpg&amp;quot; alt=&amp;quot;css template&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt; &lt;/pre&gt;
&lt;p&gt;and the CSS:&lt;/p&gt;

&lt;pre&gt;.crop{
	float:left;
	margin:.5em 10px .5em 0;
	overflow:hidden; /* this is important */
	position:relative; /* this is important too */
	border:1px solid #ccc;
	width:150px;
	height:90px;
	}
.crop img{
	position:absolute;
	top:-20px;
	left:-55px;
	}&lt;/pre&gt;

&lt;h3&gt;Technique 3 - Using Clip Property&lt;/h3&gt;

&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/lab/imagecrop/03.html" title="View Faux Image Cropping Demo"&gt;Take a look at the demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This technique should be the easiest as &lt;em&gt;clip&lt;/em&gt; property defines the portion of the element that should be visible. This sounds like a perfect solution &lt;strong&gt;but there's one catch&lt;/strong&gt;: the &lt;em&gt;clipped&lt;/em&gt; element must be positioned absolutely. To keep the element in the flow we'll have to add additional element, calculate the size of the visible area of the image, add that size to parent, float the parent... A lot of work, don't you think? &lt;br /&gt;
&lt;strong&gt;Oh, there's one more catch&lt;/strong&gt;: the clipped element's size is not reduced to cropped portion, it keeps the original size (width the clipped out area being hidden). We have to use  absolute positioning to move the visible area to the top left corner of the parent.&lt;/p&gt; 

&lt;p&gt;&lt;img src="http://cssglobe.com/lab/imagecrop/03.jpg" alt="Faux Image Cropping" class="alt" /&gt;&lt;/p&gt;

&lt;p&gt;However the &lt;em&gt;clip&lt;/em&gt; property shouldn't be left unmentioned here so here goes the code...&lt;/p&gt;

&lt;p&gt;HTML is somewhat changed here:&lt;/p&gt;

&lt;pre&gt;&amp;lt;div class=&amp;quot;crop&amp;quot;&amp;gt;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;http://templatica.com&amp;quot; title=&amp;quot;Css Templates&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;img.jpg&amp;quot; alt=&amp;quot;css template&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;

&lt;p&gt;here's the CSS:&lt;/p&gt;

&lt;pre&gt;.crop{
	float:left;
	position:relative;
	width:150px;
	height:90px;
	border:1px solid #ccc;
	margin:.5em 10px .5em 0;
	}
.crop p{
	margin:0;
	position:absolute;
	top:-20px;
	left:-55px;
	clip:rect(20px 205px 110px 55px);
	}	&lt;/pre&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;If you carefully look at the examples one by one you will notice that they all look exactly the same. This once again proves that there are many ways to achieve the same things with CSS. If you ask me, for this particular effect, &lt;strong&gt;I would use technique number 1. - negative margins&lt;/strong&gt;. It is the easiest and fastest of them all plus, when editing, you don't have to change parent values: just change the negative margins and the parent element will adjust.&lt;br /&gt;
Hope you liked the article, &lt;strong&gt;don't forget to bookmark&lt;/strong&gt;! :)&lt;/p&gt;
		&lt;hr /&gt;&lt;p&gt;Copyright: &lt;a href="http://cssglobe.com"&gt;Css Globe&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=hiHIMwoaLTI:CyXrChvQUhM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=hiHIMwoaLTI:CyXrChvQUhM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=hiHIMwoaLTI:CyXrChvQUhM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=hiHIMwoaLTI:CyXrChvQUhM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=hiHIMwoaLTI:CyXrChvQUhM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=hiHIMwoaLTI:CyXrChvQUhM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=hiHIMwoaLTI:CyXrChvQUhM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cssglobearticles/~4/hiHIMwoaLTI" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.cssglobe.com/post/6089/3-easy-and-fast-css-techniques-for-faux-image</feedburner:origLink></item><item><title>Simple Way to Random Display or Rotate Content Using JavaScript and CSS</title><link>http://feedproxy.google.com/~r/cssglobearticles/~3/l7pJSzA8IQ4/simple-way-to-random-display-or-rotate-content-using</link><pubDate>Mon, 31 Aug 2009 05:03:00 PDT</pubDate><guid isPermaLink="false">http://www.cssglobe.com/post/6023/simple-way-to-random-display-or-rotate-content-using</guid><description>&lt;p&gt;In a project I did recently there was a need for randomly displayed content in form of one of those &amp;quot;Did you know&amp;quot; tips. There were 8 to 10 paragraphs of text and client wanted to display just one randomly chosen. Since that was the static site I decided to go with front end solution. I am aware that there are many more elegant back-end solutions but read on and you'll see that there are advantages to this as well. &lt;/p&gt;

&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/lab/random_content/random_content.zip"&gt;Download the script files&lt;/a&gt;&lt;/p&gt;
&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/lab/random_content/01.html"&gt;Take a look at the randomly displayed content demo&lt;/a&gt;&lt;/p&gt;
&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/lab/random_content/02.html"&gt;Take a look at randomly rotating content demo&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Let's Get Started&lt;/h3&gt;

&lt;p&gt;So first the markup. I placed all of the &amp;quot;did you know&amp;quot; tips into one unordered list: &lt;/p&gt;

&lt;pre&gt;&amp;lt;ul id=&amp;quot;tips&amp;quot;&amp;gt;
	&amp;lt;li&amp;gt;... if you want to become a better coder you need to eat your vegetables?&amp;lt;/li&amp;gt;
	&amp;lt;li&amp;gt;... it takes more time to code a web page then to make a pizza?&amp;lt;/li&amp;gt;
	&amp;lt;li&amp;gt;... you should validate your code?&amp;lt;/li&amp;gt;
	&amp;lt;li&amp;gt;... jQuery is your friend? For real!&amp;lt;/li&amp;gt;
	&amp;lt;li&amp;gt;... no matter what some people claim, you can't learn CSS in 3 hours?&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;&lt;/pre&gt;
	
&lt;p&gt;The idea is to &lt;strong&gt;HIDE&lt;/strong&gt; all of the tips and then display randomly chosen one using JavaScript.&lt;/p&gt;

&lt;p&gt;So to style and hide the tips we use the following CSS code: &lt;/p&gt;

&lt;pre&gt;#tips, #tips li{
	margin:0;
	padding:0;
	list-style:none;
	}
#tips{
	width:250px;
	font-size:16px;
	line-height:120%;
	}
#tips li{
	padding:20px;
	background:#e1e1e1;
	display:none; /* hide the items at first only */
	}&lt;/pre&gt;
	
&lt;p&gt;The downside to this solution is that initially all of the tips are hidden, so users with disabled JavaScript and enabled CSS will not be able to see them at all while users with disabled JS/CSS (as well as search engines) will see all of them. &lt;/p&gt;

&lt;p&gt;To display one of them randomly we will use small jQuery script. Of course you will have to &lt;a href="http://jquery.com"&gt;download jQuery&lt;/a&gt; put it somewhere on your server and link to it by placing this code inside the head tag of your document (link to your jQuery.js file). &lt;/p&gt;

&lt;pre&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;js/jquery.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;

&lt;p&gt;Below that add the following script:&lt;/p&gt;

&lt;pre&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;

this.randomtip = function(){
	var length = $("#tips li").length;
	var ran = Math.floor(Math.random()*length) + 1;
	$("#tips li:nth-child(" + ran + ")").show();
};

$(document).ready(function(){	
	randomtip();
});

&amp;lt;/script&amp;gt;&lt;/pre&gt;


&lt;p&gt;Short one isn't it. &lt;a href="http://cssglobe.com/lab/random_content/01.html"&gt;Take a look at the demo&lt;/a&gt; (refresh the page couple of times) to see how it works.&lt;/p&gt;

&lt;h3&gt;Taking it One Step Further&lt;/h3&gt;

&lt;p&gt;If this simple functionality doesn't satisfy you, here's more. With modifying the above code a bit we can get fade in/out tips that rotate randomly. Of course the code doesn't allow same tip to display twice in a row.&lt;br /&gt;
	Note that you are able to modify length of the pause between random rotations.&lt;/p&gt;
	
&lt;pre&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;

this.randomtip = function(){

	var pause = 3000; // define the pause for each tip (in milliseconds) 
	var length = $("#tips li").length; 
	var temp = -1;		

	this.getRan = function(){
		// get the random number
		var ran = Math.floor(Math.random()*length) + 1;
		return ran;
	};
	this.show = function(){
		var ran = getRan();
		// to avoid repeating
		while (ran == temp){
			ran = getRan();
		}; 
		temp = ran;
		$("#tips li").hide();	
		$("#tips li:nth-child(" + ran + ")").fadeIn("fast");		
	};
	
	show(); setInterval(show,pause);
	
};

$(document).ready(function(){	
	randomtip();
});

&amp;lt;/script&amp;gt;&lt;/pre&gt;
	
&lt;p&gt;&lt;a href="http://cssglobe.com/lab/random_content/02.html"&gt;Take a look at this demo&lt;/a&gt; to see it in action.&lt;/p&gt;
&lt;p&gt;Thanks for reading this! If you liked the script please remember to bookmark it, share it and subscribe to rss feed using the links below :) Cheers!&lt;/p&gt;

		&lt;hr /&gt;&lt;p&gt;Copyright: &lt;a href="http://cssglobe.com"&gt;Css Globe&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=l7pJSzA8IQ4:V0G6s3SbA30:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=l7pJSzA8IQ4:V0G6s3SbA30:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=l7pJSzA8IQ4:V0G6s3SbA30:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=l7pJSzA8IQ4:V0G6s3SbA30:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=l7pJSzA8IQ4:V0G6s3SbA30:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=l7pJSzA8IQ4:V0G6s3SbA30:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=l7pJSzA8IQ4:V0G6s3SbA30:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cssglobearticles/~4/l7pJSzA8IQ4" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.cssglobe.com/post/6023/simple-way-to-random-display-or-rotate-content-using</feedburner:origLink></item><item><title>Wordpress: Find Page's Top Level Parent ID</title><link>http://feedproxy.google.com/~r/cssglobearticles/~3/0WyIzG9O5fc/wordpress-find-pages-top-level-parent-id</link><pubDate>Fri, 07 Aug 2009 07:07:00 PDT</pubDate><guid isPermaLink="false">http://www.cssglobe.com/post/5812/wordpress-find-pages-top-level-parent-id</guid><description>&lt;p&gt;Here's a short WordPress code that I wanted to share with you. I came across a little problem of displaying 2nd and 3d level of navigation in a sidebar no matter what page am I on. After googling for solution, I put together a pieces of a puzzle and came up with a short code snippet.&lt;/p&gt;

&lt;p&gt;I created a new page in my theme that I'll be using from now on for displaying side navigation from 2nd level downwards. I named it subnav.php and it's included in my sidebar.php&lt;/p&gt;

&lt;pre&gt;&amp;lt;?php include("subnav.php"); ?&amp;gt;&lt;/pre&gt;

&lt;p&gt;Here's the code from my &lt;em&gt;subnav.php&lt;/em&gt;:&lt;/p&gt;

&lt;pre&gt;&amp;lt;?php

if ($post-&gt;post_parent)	{
	$ancestors=get_post_ancestors($post-&gt;ID);
	$root=count($ancestors)-1;
	$parent = $ancestors[$root];
} else {
	$parent = $post-&gt;ID;
}

$children = wp_list_pages("title_li=&amp;child_of=". $parent ."&amp;echo=0");

if ($children) { ?&amp;gt;
&amp;lt;ul id="subnav"&amp;gt;
&amp;lt;?php echo $children; ?&amp;gt;
&amp;lt;/ul&amp;gt;
&amp;lt;?php } ?&amp;gt;
&lt;/pre&gt;

&lt;p&gt;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 &lt;em&gt;get_post_ancestors&lt;/em&gt; is called. It returns an array of all the ancestors' IDs up to the top level (root). &lt;br&gt;
To get the ID of the top level ancestor we need to fetch the last item in that array. &lt;br&gt;
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.&lt;/p&gt;
&lt;p&gt;Once we get the ID of the top level parent we can use it in wp_list_pages function to get its children.&lt;/p&gt;
&lt;p&gt;Short'n'sweet, hope it helps somebody. :) I'll be using it that's for sure!&lt;/p&gt;
		&lt;hr /&gt;&lt;p&gt;Copyright: &lt;a href="http://cssglobe.com"&gt;Css Globe&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=0WyIzG9O5fc:hiAY10iCbIs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=0WyIzG9O5fc:hiAY10iCbIs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=0WyIzG9O5fc:hiAY10iCbIs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=0WyIzG9O5fc:hiAY10iCbIs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=0WyIzG9O5fc:hiAY10iCbIs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=0WyIzG9O5fc:hiAY10iCbIs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=0WyIzG9O5fc:hiAY10iCbIs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cssglobearticles/~4/0WyIzG9O5fc" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.cssglobe.com/post/5812/wordpress-find-pages-top-level-parent-id</feedburner:origLink></item><item><title>Easy Slider 1.7 - Numeric Navigation jQuery Slider</title><link>http://feedproxy.google.com/~r/cssglobearticles/~3/MOY4PE_Gglk/easy-slider-17-numeric-navigation-jquery-slider</link><pubDate>Tue, 04 Aug 2009 08:25:00 PDT</pubDate><guid isPermaLink="false">http://www.cssglobe.com/post/5780/easy-slider-17-numeric-navigation-jquery-slider</guid><description>&lt;p&gt;I got a lot of emails and feedback about my &lt;strong&gt;easySlider&lt;/strong&gt; plugin, thank you all for that. However, I  have to apologize to all of you who sent emails asking for a little help with implementation or small bug fixes. I simply don't have the time to answer all of your emails. I wish I do.&lt;/p&gt;
&lt;p&gt;What I am presenting you today is an &lt;strong&gt;easySlider&lt;/strong&gt; update with 2 new features. When going through  your feedback I noticed 2 feature suggestions appearing very often: &lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;numeric navigation (as an alternative to next/previous buttons)&lt;/li&gt;
	&lt;li&gt;continuous scroll instead of jumping to the first (or last) slide&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, that's what I implemented in this new version. Now you have the option to choose between classic previous/next navigation or to use a numeric "pagination" style navigation. &lt;/p&gt;
&lt;p&gt;Also, your suggestion about continuous scroll made most sense, it is kind of annoying when you have many slides and have to wait for all of them to scroll back to the first one. I had to include it in this version.&lt;/p&gt;
&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/lab/easyslider1.7/easyslider1.7.zip"&gt;Download easySlider 1.7&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I suggest that you read about previous versions in order to understand better how it works:&lt;/p&gt;
&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider"&gt;easySlider version 1.0&lt;/a&gt;&lt;/p&gt;
&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding"&gt;easySlider version 1.5&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Options&lt;/h3&gt;

&lt;p&gt;So, let's go through all of the options. For your convenience I have written the options from previous version of this plugin, so you can have it all in one place. Here they are with their default values:&lt;/p&gt;

&lt;pre&gt;prevId: 		'prevBtn',
prevText: 		'Previous',
nextId: 		'nextBtn',	
nextText: 		'Next',
controlsShow:		true,
controlsBefore:	'',
controlsAfter:		'',	
controlsFade:		true,
firstId: 		'firstBtn',
firstText: 		'First',
firstShow:		false,
lastId: 		'lastBtn',	
lastText: 		'Last',
lastShow:		false,				
vertical:		false,
speed: 		800,
auto:			false,
pause:			2000,
continuous:		false, 
numeric: 		false,
numericId: 		'controls'&lt;/pre&gt;

&lt;h4&gt;prevId&lt;/h4&gt;
&lt;p&gt;Id attribute for &amp;quot;previous&amp;quot; button. Default value is &amp;quot;prevBtn&amp;quot;.&lt;/p&gt;
&lt;h4&gt;prevText&lt;/h4&gt;
&lt;p&gt;Inner text for &amp;quot;previous&amp;quot; button. Default value is &amp;quot;Previous&amp;quot;.&lt;/p&gt;
&lt;h4&gt;nextId&lt;/h4&gt;
&lt;p&gt;Id attribute for &amp;quot;next&amp;quot; button. Default value is &amp;quot;nextBtn&amp;quot;.&lt;/p&gt;
&lt;h4&gt;nextText&lt;/h4&gt;
&lt;p&gt;Inner text for &amp;quot;next&amp;quot; button. Default value is &amp;quot;Next&amp;quot;.&lt;/p&gt;
&lt;h4&gt;orientation&lt;/h4&gt;
&lt;p&gt;Sliding can be &lt;strong&gt;horizontal&lt;/strong&gt; or &lt;strong&gt;vertical&lt;/strong&gt;. Horizontal is default and if you want vertical set this to 'vertical'.&lt;/p&gt;
&lt;h4&gt;speed&lt;/h4&gt;
&lt;p&gt;Animation speed in milliseconds, default value is 800.&lt;/p&gt;
&lt;h4&gt;controlsShow&lt;/h4&gt;
&lt;p&gt;By default set to true, but if set to false it will not add any controls. It can be used with auto scroll when you want to disable user interaction.&lt;/p&gt;
&lt;h4&gt;controlsBefore and controlsAfter&lt;/h4&gt;
&lt;p&gt;In case you want to add some additional markup to gain more control over buttons you can do so by using these parameters. Check out the demo where I use these options. &lt;/p&gt;
&lt;h4&gt;controlsFade&lt;/h4&gt;
&lt;p&gt;By default set to true. If set to false it will disable button hiding when slider reaches the end.&lt;/p&gt;
&lt;h4&gt;firstShow and lastShow&lt;/h4&gt;
&lt;p&gt;These parameters hide (or show) "go to first" and "go to last" buttons.&lt;/p&gt;
&lt;h4&gt;auto&lt;/h4&gt;
&lt;p&gt;This option enables automatic sliding. If you set it to true the sliding will automatically start and continue to perform untill user clicks one of the buttons.&lt;/p&gt;
&lt;h4&gt;pause&lt;/h4&gt;
&lt;p&gt;This option is set in milliseconds and it represent the duration of each slide when plugin is set to auto sliding.&lt;/p&gt;
&lt;h4&gt;continuous&lt;/h4&gt;
&lt;p&gt;If set to true clicking the next button when the slider reached the end will simply continue showing all of the slides again with continuous motion. Combining this option with auto (both set to true) you'll get endless animation.&lt;/p&gt;
&lt;h4&gt;numeric (NEW!)&lt;/h4&gt;
&lt;p&gt;If you set this option to &lt;strong&gt;true&lt;/strong&gt; you will get numeric navigation instead of next/prev buttons. Plugin will create an ordered list just after the slider div. Ordered list will have the exact number of elements as the slider. Clicking on each of the number will make the animation jump to a certain slide.&lt;/p&gt;
&lt;h4&gt;numericId (NEW!)&lt;/h4&gt;
&lt;p&gt;This option defines id attribute for the ordered list. You should use this id to select and style the list with CSS.&lt;/p&gt;

&lt;h3&gt;Demos&lt;/h3&gt;

&lt;p&gt;I have 3 new demos here:&lt;/p&gt;

&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/lab/easyslider1.7/01.html"&gt;Continuous slide&lt;/a&gt;&lt;/p&gt;
&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/lab/easyslider1.7/02.html"&gt;Numeric navigation&lt;/a&gt;&lt;/p&gt;
&lt;p class="imp"&gt;&lt;a href="http://cssglobe.com/lab/easyslider1.7/03.html"&gt;Multiple slides&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here you go. If you have any more suggestions, please send them to me and I will consider of implementing them in the next plugin version!&lt;/p&gt;
		&lt;hr /&gt;&lt;p&gt;Copyright: &lt;a href="http://cssglobe.com"&gt;Css Globe&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=MOY4PE_Gglk:qzNEovDg_4c:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=MOY4PE_Gglk:qzNEovDg_4c:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=MOY4PE_Gglk:qzNEovDg_4c:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=MOY4PE_Gglk:qzNEovDg_4c:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=MOY4PE_Gglk:qzNEovDg_4c:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/cssglobearticles?a=MOY4PE_Gglk:qzNEovDg_4c:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/cssglobearticles?i=MOY4PE_Gglk:qzNEovDg_4c:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cssglobearticles/~4/MOY4PE_Gglk" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.cssglobe.com/post/5780/easy-slider-17-numeric-navigation-jquery-slider</feedburner:origLink></item></channel></rss>
