Archive for August, 2012

wordpress: back to (grand)parent

was challenged at work and couldn’t think of a proper solution. i knew it was possible, but didn’t know how to execute it

this is what happens when you don’t know all the tools you have available to you…

thank god for the wordpress community


this makes absolutely no sense without any background! essentially i have a splash page that goes to several sub-sites. when you get to a sub-site, i want each sub-site’s home to go back to its own home location, not the splash page, which would be

< ?php echo get_option('home'); ?>


< ?php //parent variables
	$parent = get_post($post->post_parent);
	$parent_title = get_the_title($parent);
	$grandparent = $parent->post_parent;
	$grandparent_title = get_the_title($grandparent);?>

	< ?php // is the homepage the granparent?
	if ($grandparent == is_page('0')) { ?>
	<li><a href="/<?php echo get_permalink($grandparent); ?>">Back to < ?php echo $grandparent_title; ?></a></li>
	<li><a href="<?php echo get_permalink($post->post_parent); ?>">Back to < ?php echo $parent_title; ?></a></li>

	< ?php // is the homepage the parent?
	} elseif ($post->post_parent ==is_page('0')) {?>
   <li> <a href="<?php echo get_permalink($post->post_parent) ?>">Back to < ?php echo $parent_title; ?></a></li>

    < ?php // I must be a top level page!
	} else { ?> <!-- no parent to show -->
< ?php }?>

hilarious: john mulaney

josh got me listening to this comic — john mulaney [tumblr]… he is friggin’ hilarious and his pandora station is awesome too! check him out

“i am a proud asian-american woman”

“f*ck da police!”

home alone 2 – “ya simple bitch”

bonus: patton oswalt

“i want all the ham”

this friggin cracked me up in the car… i nearly flew off the road in a fit of laughter

Sorry, but there aren't any posts with this date.