blackbookdesign
Member
Posted 3 years ago #
Hi guys & gals,
First: thanks for reading this!
Secondly: My question
I am building a site that has a page showing all children of that last one.
On that page, I don't want to show the comments template but on the children yes.
so i am using conditional tags like this:
<?php if (XXXXXXXX) { ?>
<?php comments_template(); ?>
<?php } else { }?>
Where the XXXX are, I don't know what to write.
Using $post->post_parent=="6" still makes the comments show on parent.
Is their some kind of child_of I can use?
Thanks heaps!
There probably are ways to do this using coding tricks to work out whether the page has children etc, but there might be an easier way around this unless I'm misunderstanding your requirement.
1. Create a page template which doesn't use the comments template. On the parent page use this page template.
2. Just untick the Allow Comments option on the parent page
Am I being overly simple?
blackbookdesign
Member
Posted 3 years ago #
lol.
great thinking. I was trying to hack this one but wasn't able.
Thats what I did:
used
<?php if ( is_page ('productions') || $post->post_parent=="6" ) { ?>
<?php comments_template(); ?>
<?php } else {} ?>
"production" page being my parent, I just created a duplicate of the template for this last one, took the code out and used it as template for the parent. works like a charm but will have to think about updating one and the other if I make changes.
Cheers :)
I still would welcome the code trick if its doable!