WordPress Development Asked by StefsterNYC on February 5, 2021
I’m attempting to show a Contact Form 7 form using a shortcode with Modern Tribe’s Event Calendar on their single event page only. I’ve tried using the following, but none are working.
<?php
if (is_page('specific-page')) { //this page is where the calendar sits
echo do_shortcode('Error: Contact form not found.
');
} else {
//do nothing else
}
?>
And then I tried this. Custom Post Type. Although Event Calendar is a CPT I’m not sure their parent page is and or the children beneath the parent.
<?php
$page = get_post();
if ( is_singular('What_Goes_Here?') && $page->post_parent > 0 ) {
// This is a custom post type subpage
echo do_shortcode('Error: Contact form not found.
');
} else {
// This is not a custom post type subpage
}
?>
Neither works. And I’m not 100% sure on the Custom_Post_Type one. I did change the default page name from Events to Custom Events for calendar page and Custom-Event for single event page. So the url is example.com/custom-event/whatever-is-going-on-that-day.
I need the form to only show on any sub page of custom-event. Not sure how to go about this. Thanks.
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP