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 like, you can find me on Twitter at @nick_ramsay. I'd love to hear from you!
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???
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.
All right, the title was a bit misleading. I’ll go with plain and obvious titles from now on.
I’ve changed the title from “Children, Parents and Poo” to “WordPress Pages and Babysitting Rikuto”.
Thanks bra, it makes me happy to have a more representative title.
Definition of “bra”:
You’re either calling me a support garment, or this is some new bizarre Canadian slang.
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???
Poor Rikuto! Why has he got diarrhoea? I hope he feels better soon.
Thanks for asking, Mum. I don’t have an answer for you, but we’ll take him to the doctor if it continues.
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 🙂
Go for it! Write about what you want to write about. Isn’t that what blogging is all about? 🙂