-1

Say I have a page domain.com/jibbly_bits and domain.com/jibbly_bits/small

I'm trying to make a conditional statement where if it is a certain page or that page with a subpage after it. I've tried using just the parent slug, the parent slug with a "/" after it and also tried a wild card after it like so "/*"

The following attempts were unsuccessful.... any ideas ?

<?php if (is_page('jibbly_bits')) : ?>

<?php if (is_page('jibbly_bits/')) : ?>

<?php if (is_page('jibbly_bits/*')) : ?>
3

1 Answer 1

1

Solved, this is what I was looking for:

<?php elseif (preg_match( '#^any-page-with-this-text-in-slug(/.+)?$#', $wp->request)) : ?>  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.