« A Change of Direction for LongCountdown Put Code Snippets in a Wordpress Blog »
Nick Ramsay on August 23rd, 2008

What did I do today?

I made a math worksheet about bus timetables, then I spent the rest of the day babysitting Rikuto while his mum was at work. We watched some Olympic volleyball, then played in the street on his little Thomas the Tank Engine train.

Rikuto is suffering from diarrhea at the moment which means after holding him for a while, my arms smell of poo.

What did I learn today?

global $post;
if(is_page() && $post->post_parent) {
     echo "do something";
}

That little conditional works on Wordpress. If you paste it into a page template, you can determine whether or not the page is a parent or child. It’s really saying, “If this is a page and it has a parent, it must be a child so (do something)”.

What did you learn today?

If you liked this post, please submit it to JapanSoc, StumbleUpon, or Digg, and if you haven't already, please subscribe to my RSS feed. Thanks!

RSS feed | Trackback URI

12 Responses »

Trackback responses »

Comments on this post »

Comment by Mike Subscribed to comments via email
2008-08-23 14:17:46

OK so your title sounded promising, i.e. “poo” but then I read it and it kind of made no sense. Well maybe it makes sense but the code is kind of wacky. Have you been smoking wacky tabacky???

Comment by Nick Ramsay
2008-08-23 17:16:19

The title accurately matched the content of the post. I wrote about child and parent Wordpress pages, and how my son has diarrhea. Though, for you, I’ll make the titles more obvious from now on.

The code is PHP. There’s nothing wacky about it. I happened to find it very useful and wanted to share it.

Comment by Nick Ramsay
2008-08-23 17:31:48

All right, the title was a bit misleading. I’ll go with plain and obvious titles from now on.

(Comments wont nest below this level)
Comment by Nick Ramsay
2008-08-23 18:22:14

I’ve changed the title from “Children, Parents and Poo” to “Wordpress Pages and Babysitting Rikuto”.

 
 
 
 
Comment by Mike Subscribed to comments via email
2008-08-24 00:19:12

Thanks bra, it makes me happy to have a more representative title.

Comment by Nick Ramsay
2008-08-24 00:41:41

Definition of “bra”:

The shortened word for brassiere. A woman’s close-fitting undergarment which is worn to support and give contour to the breasts.

You’re either calling me a support garment, or this is some new bizarre Canadian slang.

 
 
Comment by Mike Subscribed to comments via email
2008-08-24 04:55:40

Dude, you being in Japan has really distanced you from all of the cool expressions from tv shows such as “Dog, the bounty hunter.” Instead of saying bro, as in “brother,” he says “bra.” OK bra???

 
Comment by Mum
2008-08-24 23:18:28

Poor Rikuto! Why has he got diarrhoea? I hope he feels better soon.

Comment by Nick Ramsay
2008-08-24 23:28:07

Thanks for asking, Mum. I don’t have an answer for you, but we’ll take him to the doctor if it continues.

 
 
Comment by Tori Subscribed to comments via email
2008-08-26 04:10:37

Hi Nick!
I like this post (and I liked the original name, but either way…)

I am glad to see you blogging about php code and other things that only the truly nerd (i.e. us) care about.
So now if I start to ramble on DailyJ about the early history of the internet, linux, and other nerd-fare I won’t feel so bad. Nick started it :)

Comment by Nick Ramsay
2008-08-26 09:22:15

Go for it! Write about what you want to write about. Isn’t that what blogging is all about? :)

 
 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line=""> in your comment.