For now I was able to achieve it by adding this to my function:
$slug_to_check = 'my-child-slug';
// go through each child page we found
foreach( $child_pages as $child_page ) {
// get the slug of this child page we found
$child_slug = $child_page->post_name;
// get the link of this child page we found
$child_link = get_page_link( $child_page->ID );
// if the child page we found has the slug we want
if($child_slug === $slug_to_check) {
// output the child page link
$response="Yes, this parent has a child page that we are looking for.";
}
}
Related Posts:
- Do not show child pages of child pages
- Passing attributes to shortcode dynamically
- Remove HTML content if attribute is not set / variable attributes
- Shortcodes and a list of IDs?
- Turning variable into a value set in shortcode
- Substite Category Slug in a Shortcode
- Query to list all galleries under a parent post?
- Variable inside shortcode or shortcode inside shortcode
- Multiple values for one variable
- Add audio file to post using custom term meta field as link [closed]
- Display list of pages that contain a certain string within the slug
- Class variables in shortcodes
- Display title of child pages in shortcode
- Shortcode with multiple variables
- About redundant code when I use shortcode to output the HTML from a variable
- Custom shortcode being executed when saving page in wp-admin
- Change appearance of shortcode text inside editor
- Shortcode output always showing at top of page
- How to detect if a Shortcode is being called on a page?
- shortcode inside another shortcode
- How can I just get content inside a shortcode or just outside
- Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]
- WordPress gallery ‘post_gallery’ filter doesn’t work with feeds?
- shortcode to create dynamic dropdown box form shortcode attributes
- Ajax not returning anything on form submit
- How do I add my own custom shortcodes?
- Can’t seem to get [shortcode]s to work
- nested Shortcode doesn’t work
- Simple contact form with field validation
- Slow page loading when using a simple shortcode on the same page multiple times
- Does WordPress automatically redirect url without parent slug?
- TinyMCE get selected text and underlying HTML
- Remove and restore one shortcode
- Rewriting WordPress Gallery Shortcode with Bootstrap Carousel
- Using do_shortcode with variables?
- Using ACF field in do_shortcode()
- Display content from another site page using a shortcode
- Remove hyperlink on gallery shortcode
- Remove wpautop from specific shortcodes only
- Custom page slug without creating a WP page
- Combining similar shortcode functions?
- Creating a shortcode based on users preferences
- Get a post’s thumbnail url or display default image in shortcode
- Convert HTML Script to Shortcode [closed]
- How to build a shortcode which can insert a query string into a DB table
- What is the Correct way to pass parameters in function
- Shortcode – Getting Categories appears on top of website
- Visual Composer integration [closed]
- How to Modify WordPress Default Image Gallery Shortcode
- Passing html tags as shortcode parameters
- Registration Form Shortcode
- Button Shortcode
- Conditionally Loading JavaScript/CSS for Shortcodes
- Placing tags on wordpress visual editor using shortcodes
- Default Attributes in Shortcode Not Working
- Replacement for gallery_shortcode function not taking all attributes
- Create a WordPress shortcode using PHP [duplicate]
- how can i pass this attribute in this shortcode?
- How to add a same div on every page
- WordPress Shortcode / Only works in classic editor, gutenberg error / invalid json response
- Display a form partially with a shortcode
- Modifying the wordpress login page and then referencing it with a shortcode problem
- Pass instance number to shortcode child
- Render shortcodes with get_post_custom
- Pass a comma separated shortcode attribute to a function
- how to write short code in word press
- hard code shortcode only on specific category
- Set redirect for need login
- make user_id in a shortcode dynamic based on who’s logged in
- Image Caption Shortcode Broken upon update
- Is the WP audio shortcode still relevant?
- Third-Party API – PHP Fatal Errors Paired with http_request_failed / cURL error 28
- If statement shortcode
- Using within a shortcode
- Shortcode not working when I output data from wpdb html table row
- How do I point bloginfo(‘stylesheet_directory’) to my parent theme?
- Gallery shortcode is empty but magically creates a gallery
- How to avoid one code multiple times instead do that through some function? Shortcode, but I think shortcode is not used in main theme’s core files?
- Add a shortcode in woo-function.php
- Get current category and place it in shortcode
- Woocommerce products shortcode specific order
- Modify Blog Module layout in Child theme
- php string inside shortcode does not work
- Output html source tags inside shortcode
- How can I define the output of shortcode attribute value?
- Using shortcodes that wrap around code
- Shortcode for Admin Theme Option?
- What is the best way to include a template file within a shortcode?
- What makes a placeholder resizable in Tinymce?
- Shortcode templates
- Why My slider shortcode display above header
- Does anyone recognize shortcode ig_special_heading?
- How to scroll to a shortcode-generated anchor
- add post type pram to wp shortcode
- Shotcode error on functions
- Shortcode for displaying the user’s first name?
- Can I prevent wordpress adding and tags to autoembeds
- Shortcode – Display inline icon before text [closed]
- Why does my shortcode query not working with search term
- How to use multiple values in “Shortcode”? [closed]