protected function getWPPages($options = [], $value = 'ID')
    {
        // Build contents
        $contents = [];
        $contents[-1] = Translate::t('wordpress.choose.page', [], 'wordpressfield');

        // Build options
        $args = array_merge([
            'sort_column' => 'post_parent,menu_order'
        ], $options);

        // Build request
        $pages_obj = get_pages($args);

        // Iterate on pages
        if (!empty($pages_obj)) {
            foreach ($pages_obj as $pag) {
                // For Wordpress version < 3.0
                if (empty($pag->ID)) {
                    continue;
                }

                // Check value
                $item = !empty($value) && isset($pag->$value) ? $pag->$value : $pag->ID;

                // Get the id and the name
                $contents[0][$item] = $pag->post_title;
            }
        }

        // Return all values in a well formatted way
        return $contents;
    }
protected function getWPPages($options = [], $value = 'ID')
    {
        // Build contents
        $contents = [];
        $contents[-1] = Translate::t('wordpress.choose.page', [], 'wordpressfield');

        // Build options
        $args = array_merge([
            'sort_column' => 'post_parent,menu_order'
        ], $options);

        // Build request
        $pages_obj = get_pages($args);

        // Iterate on pages
        if (!empty($pages_obj)) {
            foreach ($pages_obj as $pag) {
                // For Wordpress version < 3.0
                if (empty($pag->ID)) {
                    continue;
                }

                // Check value
                $item = !empty($value) && isset($pag->$value) ? $pag->$value : $pag->ID;

                // Get the id and the name
                $contents[0][$item] = $pag->post_title;
            }
        }

        // Return all values in a well formatted way
        return $contents;
    }
protected function getWPPages ( $ options = [ ] , $ value = 'ID' ) { // Build contents $ contents = [ ] ; $ contents [ - 1 ] = Translate :: t ( 'wordpress.choose.page' , [ ] , 'wordpressfield' ) ; // Build options $ args = array_merge ( [ 'sort_column' => 'post_parent,menu_order' ] , $ options ) ; // Build request $ pages_obj = get_pages ( $ args ) ; // Iterate on pages if ( ! empty ( $ pages_obj ) ) { foreach ( $ pages_obj as $ pag ) { // For Wordpress version < 3.0 if ( empty ( $ pag -> ID ) ) { continue ; } // Check value $ item = ! empty ( $ value ) && isset ( $ pag -> $ value ) ? $ pag -> $ value : $ pag -> ID ; // Get the id and the name $ contents [ 0 ] [ $ item ] = $ pag -> post_title ; } } // Return all values in a well formatted way return $ contents ; }
Get WordPress Pages registered.

@uses get_pages()

@param   array  $options     Define options if needed
@param   string $value       Define the value of each select options
@return  array  $wpcontents  Array of WordPress items
Get WordPress Pages registered .