Viewing 1 replies (of 1 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi!

    Using a custom code, it might be possible actually.

    Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

    add_filter('asl_query_add_args', 'asl_query_add_args_add', 10, 3);
    function asl_query_add_args_add($args, $sd, $options) {
      $post_parent_ids = '1, 2, 3, 4';   // Post parent IDs, comma separated
    
      // ---- DO NOT EDIT BELOW ----
      global $wpdb;
      $args = array(
        'fields' => '',
        'join' => '',
        'where' => '',
        'orderby' => '',
        'groupby' => ''
      );
      $parents = explode(',', str_replace(' ', '', $post_parent_ids));
      if ( count($parents) > 0 && !empty($parents[0]) )
        $args['where'] = " AND ( $wpdb->posts.post_parent IN (".implode(',', $parents).") ) ";
        
      return $args;  
    }

    Enter the Parent IDs to the $post_parent_ids variable, comma separated.

    Best,
    Ernest M.

Viewing 1 replies (of 1 total)
  • The topic ‘Display just child pages of a certain page in search results’ is closed to new replies.