sted elements. * * Given an array of hierarchical elements, the maximum depth, a specific page number, * and number of elements per page, this function first determines all top level root elements * belonging to that page, then lists them and all of their children in hierarchical order. * * $max_depth = 0 means display all levels. * $max_depth > 0 specifies the number of display levels. * * @since 2.7.0 * @since 5.3.0 Formalized the existing `...$args` parameter by adding it * to the function signature. * * @param array $elements An array of elements. * @param int $max_depth The maximum hierarchical depth. * @param int $page_num The specific page number, beginning with 1. * @param int $per_page Number of elements per page. * @param mixed ...$args Optional additional arguments. * @return string XHTML of the specified page of elements. */ public function paged_walk( $elements, $max_depth, $page_num, $per_page, ...$args ) { if ( empty( $elements ) || $max_depth < -1 ) { return ''; } $output = ''; $parent_field = $this->db_fields['parent']; $count = -1; if ( -1 == $max_depth ) { $total_top = count( $elements ); } if ( $page_num < 1 || $per_page < 0 ) { // No paging. $paging = false; $start = 0; if ( -1 == $max_depth ) { $end = $total_top; } $this->max_pages = 1; } else { $paging = true; $start = ( (int) $page_num - 1 ) * (int) $per_page; $end = $start + $per_page; if ( -1 == $max_depth ) { $this->max_pages = (int) ceil( $total_top / $per_page ); } } // Flat display. if ( -1 == $max_depth ) { if ( ! empty( $args[0]['reverse_top_level'] ) ) { $elements = array_reverse( $elements ); $oldstart = $start; $start = $total_top - $end; $end = $total_top - $oldstart; } $empty_array = array(); foreach ( $elements as $e ) { ++$count; if ( $count < $start ) { continue; } if ( $count >= $end ) { break; } $this->display_element( $e, $empty_array, 1, 0, $args, $output ); } return $output; } /* * Separate elements into two buckets: top level and children elements. * Children_elements is two dimensional array, e.g. * $children_elements[10][] contains all sub-elements whose parent is 10. */ $top_level_elements = array(); $children_elements = array(); foreach ( $elements as $e ) { if ( empty( $e->$parent_field ) ) { $top_level_elements[] = $e; } else { $children_elements[ $e->$parent_field ][] = $e; } } $total_top = count( $top_level_elements ); if ( $paging ) { $this->max_pages = (int) ceil( $total_top / $per_page ); } else { $end = $total_top; } if ( ! empty( $args[0]['reverse_top_level'] ) ) { $top_level_elements = array_reverse( $top_level_elements ); $oldstart = $start; $start = $total_top - $end; $end = $total_top - $oldstart; } if ( ! empty( $args[0]['reverse_children'] ) ) { foreach ( $children_elements as $parent => $children ) { $children_elements[ $parent ] = array_reverse( $children ); } } foreach ( $top_level_elements as $e ) { ++$count; // For the last page, need to unset earlier children in order to keep track of orphans. if ( $end >= $total_top && $count < $start ) { $this->unset_children( $e, $children_elements ); } if ( $count < $start ) { continue; } if ( $count >= $end ) { break; } $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output ); } if ( $end >= $total_top && count( $children_elements ) > 0 ) { $empty_array = array(); foreach ( $children_elements as $orphans ) { foreach ( $orphans as $op ) { $this->display_element( $op, $empty_array, 1, 0, $args, $output ); } } } return $output; } /** * Calculates the total number of root elements. * * @since 2.7.0 * * @param array $elements Elements to list. * @return int Number of root elements. */ public function get_number_of_root_elements( $elements ) { $num = 0; $parent_field = $this->db_fields['parent']; foreach ( $elements as $e ) { if ( empty( $e->$parent_field ) ) { ++$num; } } return $num; } /** * Unsets all the children for a given top level element. * * @since 2.7.0 * * @param object $element The top level element. * @param array $children_elements The children elements. */ public function unset_children( $element, &$children_elements ) { if ( ! $element || ! $children_elements ) { return; } $id_field = $this->db_fields['id']; $id = $element->$id_field; if ( ! empty( $children_elements[ $id ] ) && is_array( $children_elements[ $id ] ) ) { foreach ( (array) $children_elements[ $id ] as $child ) { $this->unset_children( $child, $children_elements ); } } unset( $children_elements[ $id ] ); } } and the plugin ecosystem. * * The workaround below ensures that the loop is started even for those singular templates. The while loop will by * definition only go through a single iteration, i.e. `do_blocks()` is only called once. Additional safeguard * checks are included to ensure the main query loop has not been tampered with and really only encompasses a * single post. * * Even if the block template contained a `core/query` and `core/post-template` block referencing the main query * loop, it would not cause errors since it would use a cloned instance and go through the same loop of a single * post, within the actual main query loop. * * This special logic should be skipped if the current template does not come from the current theme, in which case * it has been injected by a plugin by hijacking the block template loader mechanism. In that case, entirely custom * logic may be applied which is unpredictable and therefore safer to omit this special handling on. */ if ( $_wp_current_template_id && str_starts_with( $_wp_current_template_id, get_stylesheet() . '//' ) && is_singular() && 1 === $wp_query->post_count && have_posts() ) { while ( have_posts() ) { the_post(); $content = do_blocks( $content ); } } else { $content = do_blocks( $content ); } $content = wptexturize( $content ); $content = convert_smilies( $content ); $content = wp_filter_content_tags( $content, 'template' ); $content = str_replace( ']]>', ']]>', $content ); // Wrap block template in .wp-site-blocks to allow for specific descendant styles // (e.g. `.wp-site-blocks > *`). return '
' . $content . '
'; } /** * Renders a 'viewport' meta tag. * * This is hooked into {@see 'wp_head'} to decouple its output from the default template canvas. * * @access private * @since 5.8.0 */ function _block_template_viewport_meta_tag() { echo '' . "\n"; } /** * Strips .php or .html suffix from template file names. * * @access private * @since 5.8.0 * * @param string $template_file Template file name. * @return string Template file name without extension. */ function _strip_template_file_suffix( $template_file ) { return preg_replace( '/\.(php|html)$/', '', $template_file ); } /** * Removes post details from block context when rendering a block template. * * @access private * @since 5.8.0 * * @param array $context Default context. * * @return array Filtered context. */ function _block_template_render_without_post_block_context( $context ) { /* * When loading a template directly and not through a page that resolves it, * the top-level post ID and type context get set to that of the template. * Templates are just the structure of a site, and they should not be available * as post context because blocks like Post Content would recurse infinitely. */ if ( isset( $context['postType'] ) && 'wp_template' === $context['postType'] ) { unset( $context['postId'] ); unset( $context['postType'] ); } return $context; } /** * Sets the current WP_Query to return auto-draft posts. * * The auto-draft status indicates a new post, so allow the the WP_Query instance to * return an auto-draft post for template resolution when editing a new post. * * @access private * @since 5.9.0 * * @param WP_Query $wp_query Current WP_Query instance, passed by reference. */ function _resolve_template_for_new_post( $wp_query ) { if ( ! $wp_query->is_main_query() ) { return; } remove_filter( 'pre_get_posts', '_resolve_template_for_new_post' ); // Pages. $page_id = isset( $wp_query->query['page_id'] ) ? $wp_query->query['page_id'] : null; // Posts, including custom post types. $p = isset( $wp_query->query['p'] ) ? $wp_query->query['p'] : null; $post_id = $page_id ? $page_id : $p; $post = get_post( $post_id ); if ( $post && 'auto-draft' === $post->post_status && current_user_can( 'edit_post', $post->ID ) ) { $wp_query->set( 'post_status', 'auto-draft' ); } }
Fatal error: Uncaught Error: Class 'Walker' not found in /home/arasetne/public_html/wp-includes/class-walker-page.php:17 Stack trace: #0 /home/arasetne/public_html/wp-settings.php(211): require() #1 /home/arasetne/public_html/wp-config.php(188): require_once('/home/arasetne/...') #2 /home/arasetne/public_html/wp-load.php(50): require_once('/home/arasetne/...') #3 /home/arasetne/public_html/wp-blog-header.php(13): require_once('/home/arasetne/...') #4 /home/arasetne/public_html/index.php(17): require('/home/arasetne/...') #5 {main} thrown in /home/arasetne/public_html/wp-includes/class-walker-page.php on line 17

Fatal error: Uncaught Error: Call to a member function set() on null in /home/arasetne/public_html/wp-includes/l10n.php:854 Stack trace: #0 /home/arasetne/public_html/wp-includes/l10n.php(957): load_textdomain('default', '/home/arasetne/...', 'fa_IR') #1 /home/arasetne/public_html/wp-includes/class-wp-fatal-error-handler.php(49): load_default_textdomain() #2 [internal function]: WP_Fatal_Error_Handler->handle() #3 {main} thrown in /home/arasetne/public_html/wp-includes/l10n.php on line 854