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
- Responsive Embeds using default embed shortcode
- Creating a short code with php inside
- Shortcode output appearing at the top of the page only [duplicate]
- problem with shortcodes nesting
- OOP and WordPress shortcode
- PHP/WordPress — How do I check if Shortcode returns content?
- Convert my php code into shortcode
- Custom shortcode breaks my page
- Add shortcode with open close function
- Shortcode is not working
- Custom shortcode is causing a WSOD
- Will a shortcode placed inside a paragraph tag still be valid?
- Why can’t I display attachment_image_src with Custom Size?
- Get attributes of nested shortcodes
- Shortcode Strategy
- Enclosing Shortcode is acting like self-closing
- Shortcode into the same shortcode
- How to create a shortcode to let the user add the ID of a YouTube video?
- Change user meta value with shortcode
- Execute shortcodes in PHP
- A shortcode nested inside a shortcode
- How to add shortcode to html widget
- WordPress User ID as Shortcode
- Custom Shortcode + Querying and Ordering Posts using multiple Advanced Custom checkboxes
- Add div on EMED Tag
- Clean way of using ob_start() and ob_end_clean() in wordpress
- Theme Convert PHP code to shortcode
- call other shortcode in the email contactform7 send [closed]
- Putting a space between the buttons [closed]
- Processing a login/register form before shortcodes are rendered?
- Adding a cover image to video shortcode
- Insert First Image into post (full-width)
- Dynamic number within shortcode
- How can i strip shortcode from HTML title tag?
- Need help with creating a simple shortcode
- Returning HTML to Shortcode Block
- WP REST API remove the WordPress shortcodes from the JSON wp/v2/posts content->rendered
- How to display html element and php string in the same line?
- Problem parsing long parameter in shortcode
- How to use multiple (or array) values in $content of shortcode?
- How to display content if user meta data isn’t empty with shortcode
- How to display total user count by specific role in WordPress as statistics?
- User name in referral URLs
- Is there any way to set the Featured image in wordpress post editor, using a Getty images embed code
- How to style inline code in block editor?
- Add Style to text in a PHP block
- How I can add placeholder in shortcode
- I’m using rtMedia and Youzer. Can Shortcodes be used to display a video gallery?
- Help with a function to create a shortcode
- How to use strip_shortcodes() from a spawned process?
- How to add new images to existing shortcode configuration?
- Content included from pagination
- How to completely prevent WordPress from destroying/modifying my shortcode outputs?
- Term Description Echo or Return – display problems
- Same Shortcode not executing second time
- Check if Page=current user page via shortcode
- Is it inefficient to repeat a Shortcode 100 times on a page?
- Shortcode with multiple paramaters
- tinymce custom button
- Running Filter or Shortcode Before Query Prevents Excerpt from Showing
- Replace custom gallery shortcode with default gallery shortcode
- Custom shortcode is not working inside tabs
- WordPress Payment link will not transform PHP vars into values
- Referring to site URL in shortcode argument
- Does a String Replacing script affect shortcode output?
- Shortcode for showing childpages
- How to create shortcode for auto login after registration
- How WordPress Displaying Shortcode In Post Content?
- Shortcode not accepting atts
- the_time function inside HTML dom parser
- Code auto escaping is not working when using short codes
- Shortcodes in Options Panel textareas
- How to Convert Shortcode into a link?
- wp_register_script and wp_register_style when shortcode is used
- Insert shortcode in widget area
- Wpautop stops working after get_the_excerpt
- Good example of a short code +4346? [closed]
- Hook into existing shortcodes to manipulate the attributes?
- How can I hide the ACF shortcode when empty
- How to pass text input data to shortcode
- Using variable as shortcode parameter
- How to handle Ajax Calls, when using same shortcodes (with different parameters, e.g. ‘post-type’)?
- shortcode appears as text in the search result
- How to use Shortcodes?
- What’s the syntax for embedding a Goggle sheet in a shortcode?