get_pages example

<?php echo esc_html( $title ); ?></h1> <form method="post" action="options.php"> <?php settings_fields( 'reading' );

if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ) ) {
    add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
}
?> <?php if ( ! get_pages() ) : ?> <input name="show_on_front" type="hidden" value="posts" /> <table class="form-table" role="presentation"> <?php     if ( 'posts' !== get_option( 'show_on_front' ) ) :
        update_option( 'show_on_front', 'posts' );
    endif;

else :
    if ( 'page' === get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) ) {
        update_option( 'show_on_front', 'posts' );
    }
    
$setting = $this->get_setting( 'nav_menus_created_posts' );
        if ( $setting ) {
            foreach ( $setting->value() as $post_id ) {
                if ( 'page' === get_post_type( $post_id ) ) {
                    return true;
                }
            }
        }

        return 0 !== count(
            get_pages(
                array(
                    'number'       => 1,
                    'hierarchical' => 0,
                )
            )
        );
    }

    /** * Adds settings from the POST data that were not added with code, e.g. dynamically-created settings for Widgets * * @since 4.2.0 * * @see add_dynamic_settings() */

function render_block_core_page_list( $attributes$content$block ) {
    static $block_id = 0;
    ++$block_id;

    $parent_page_id = $attributes['parentPageID'];
    $is_nested      = $attributes['isNested'];

    $all_pages = get_pages(
        array(
            'sort_column' => 'menu_order,post_title',
            'order'       => 'asc',
        )
    );

    // If there are no pages, there is nothing to show.     if ( empty( $all_pages ) ) {
        return;
    }

    
$classes[]   = 'attachmentid-' . $post_id;
            $classes[]   = 'attachment-' . str_replace( $mime_prefix, '', $mime_type );
        } elseif ( is_page() ) {
            $classes[] = 'page';

            $page_id = $wp_query->get_queried_object_id();

            $post = get_post( $page_id );

            $classes[] = 'page-id-' . $page_id;

            if ( get_pages(
                array(
                    'parent' => $page_id,
                    'number' => 1,
                )
            ) ) {
                $classes[] = 'page-parent';
            }

            if ( $post->post_parent ) {
                $classes[] = 'page-child';
                $classes[] = 'parent-pageid-' . $post->post_parent;
            }

    private function _display_rows_hierarchical( $pages$pagenum = 1, $per_page = 20 ) {
        global $wpdb;

        $level = 0;

        if ( ! $pages ) {
            $pages = get_pages( array( 'sort_column' => 'menu_order' ) );

            if ( ! $pages ) {
                return;
            }
        }

        /* * Arrange pages into two parts: top level pages and children_pages. * children_pages is two dimensional array. Example: * children_pages[10][] contains all sub-pages whose parent is 10. * It only takes O( N ) to arrange this and it takes O( 1 ) for subsequent lookup operations * If searching, ignore hierarchy and treat everything as top level */
Home | Imprint | This part of the site doesn't use cookies.