当前位置: 首页>>代码示例>>PHP>>正文


PHP get_pages函数代码示例

本文整理汇总了PHP中get_pages函数的典型用法代码示例。如果您正苦于以下问题:PHP get_pages函数的具体用法?PHP get_pages怎么用?PHP get_pages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_pages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render_content

 public function render_content()
 {
     $llorix_one_all_pages_array = array();
     // new array with all pages
     $llorix_one_all_pages = get_pages();
     // get all pages
     if (!empty($llorix_one_all_pages)) {
         $llorix_one_all_pages_array[0] = "-- Select --";
         foreach ($llorix_one_all_pages as $llorix_one_page) {
             if (!empty($llorix_one_page->ID) && !empty($llorix_one_page->post_title)) {
                 $llorix_one_all_pages_array[$llorix_one_page->ID] = $llorix_one_page->post_title;
             }
         }
     }
     if (!empty($llorix_one_all_pages_array)) {
         // change the frontpage control with the new array
         echo '<label>';
         echo '<span class="customize-control-title">' . esc_html($this->label) . '</span>';
         echo '<select data-customize-setting-link="page_on_front" name="_customize-dropdown-pages-page_on_front" id="_customize-dropdown-pages-page_on_front">';
         foreach ($llorix_one_all_pages_array as $llorix_one_all_pages_array_k => $llorix_one_all_pages_array_v) {
             $llorix_one_page_template = get_page_template_slug($llorix_one_all_pages_array_k);
             if (!empty($llorix_one_page_template)) {
                 echo '<option value="' . $llorix_one_all_pages_array_k . '" template="' . $llorix_one_page_template . '">' . $llorix_one_all_pages_array_v . '</option>';
             } else {
                 echo '<option value="' . $llorix_one_all_pages_array_k . '" template="default">' . $llorix_one_all_pages_array_v . '</option>';
             }
         }
         echo '</select>';
         echo '</label>';
     }
 }
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:31,代码来源:llorix-one-lite-text-control.php

示例2: form_membership_level

 public function form_membership_level($id)
 {
     ob_start();
     $id = $_POST['id'];
     $wpm_levels = $this->wlm->GetOption('wpm_levels');
     $level = $wpm_levels[$id];
     $pages = get_pages('exclude=' . implode(',', $this->wlm->ExcludePages(array(), true)));
     $pages_options = '';
     foreach ((array) $pages as $page) {
         $pages_options .= '<option value="' . $page->ID . '">' . $page->post_title . '</option>';
     }
     $roles = $GLOBALS['wp_roles']->roles;
     $caps = array();
     foreach ((array) $roles as $key => $role) {
         if ($role['capabilities']['level_10'] || $role['capabilities']['level_9'] || $role['capabilities']['level_8']) {
             unset($roles[$key]);
         } else {
             list($roles[$key]) = explode('|', $role['name']);
             $caps[$key] = count($role['capabilities']);
         }
     }
     array_multisort($caps, SORT_ASC, $roles);
     include $this->wlm->pluginDir . '/resources/forms/edit_membership_level.php';
     $str = ob_get_clean();
     echo $str;
     //return $str;
     die;
 }
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:28,代码来源:WishListXhr.php

示例3: optionsframework_options

/**
 * Defines an array of options that will be used to generate the settings page and be saved in the database.
 * When creating the "id" fields, make sure to use all lowercase and no spaces.
 *  
 */
function optionsframework_options()
{
    // Test data
    $test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five");
    // Multicheck Array
    $multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle");
    // Multicheck Defaults
    $multicheck_defaults = array("one" => "1", "five" => "1");
    // Background Defaults
    $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll');
    // Pull all the categories into an array
    $options_categories = array();
    $options_categories_obj = get_categories();
    foreach ($options_categories_obj as $category) {
        $options_categories[$category->cat_ID] = $category->cat_name;
    }
    // Pull all the pages into an array
    $options_pages = array();
    $options_pages_obj = get_pages('sort_column=post_parent,menu_order');
    $options_pages[''] = 'Select a page:';
    foreach ($options_pages_obj as $page) {
        $options_pages[$page->ID] = $page->post_title;
    }
    // If using image radio buttons, define a directory path
    $imagepath = get_bloginfo('stylesheet_directory') . '/admin/images/';
    $options_menu_page = array('name' => 'general', 'pagename' => 'general-options', 'title' => 'General Settings');
    $options = array();
    $options = array(array("name" => "Basic Settings", "type" => "heading"), array("name" => "Input Text Mini", "desc" => "A mini text input field.", "id" => "example_text_mini", "std" => "Default", "class" => "mini", "type" => "text"), array("name" => "Input Text", "desc" => "A text input field.", "id" => "example_text", "std" => "Default Value", "type" => "text"), array("name" => "Textarea", "desc" => "Textarea description.", "id" => "example_textarea", "std" => "Default Text", "type" => "textarea"), array("name" => "Input Select Small", "desc" => "Small Select Box.", "id" => "example_select", "std" => "three", "type" => "select", "class" => "mini", "options" => $test_array), array("name" => "Input Select Wide", "desc" => "A wider select box.", "id" => "example_select_wide", "std" => "two", "type" => "select", "options" => $test_array), array("name" => "Select a Category", "desc" => "Passed an array of categories with cat_ID and cat_name", "id" => "example_select_categories", "type" => "select", "options" => $options_categories), array("name" => "Select a Page", "desc" => "Passed an pages with ID and post_title", "id" => "example_select_pages", "type" => "select", "options" => $options_pages), array("name" => "Input Radio (one)", "desc" => "Radio select with default options 'one'.", "id" => "example_radio", "std" => "one", "type" => "radio", "options" => $test_array), array("name" => "Example Info", "desc" => "This is just some example information you can put in the panel.", "type" => "info"), array("name" => "Input Checkbox", "desc" => "Example checkbox, defaults to true.", "id" => "example_checkbox", "std" => "1", "type" => "checkbox"), array("name" => "Advanced Settings", "type" => "heading"), array("name" => "Check to Show a Hidden Text Input", "desc" => "Click here and see what happens.", "id" => "example_showhidden", "type" => "checkbox"), array("name" => "Hidden Text Input", "desc" => "This option is hidden unless activated by a checkbox click.", "id" => "example_text_hidden", "std" => "Hello", "class" => "hidden", "type" => "text"), array("name" => "Uploader Test", "desc" => "This creates a full size uploader that previews the image.", "id" => "example_uploader", "type" => "upload"), array("name" => "Example Image Selector", "desc" => "Images for layout.", "id" => "example_images", "std" => "2c-l-fixed", "type" => "images", "options" => array('1col-fixed' => $imagepath . '1col.png', '2c-l-fixed' => $imagepath . '2cl.png', '2c-r-fixed' => $imagepath . '2cr.png')), array("name" => "Example Background", "desc" => "Change the background CSS.", "id" => "example_background", "std" => $background_defaults, "type" => "background"), array("name" => "Multicheck", "desc" => "Multicheck description.", "id" => "example_multicheck", "std" => $multicheck_defaults, "type" => "multicheck", "options" => $multicheck_array), array("name" => "Colorpicker", "desc" => "No color selected by default.", "id" => "example_colorpicker", "std" => "", "type" => "color"), array("name" => "Typography", "desc" => "Example typography.", "id" => "example_typography", "std" => array('size' => '12px', 'face' => 'verdana', 'style' => 'bold italic', 'color' => '#123456'), "type" => "typography"));
    return $options;
}
开发者ID:nathanielks,项目名称:options-framework-theme,代码行数:35,代码来源:options.php

示例4: get_pages

 public function get_pages($pages, $args)
 {
     $language = empty($args['lang']) ? $this->curlang : $this->model->get_language($args['lang']);
     if (empty($language) || empty($pages) || !$this->model->is_translated_post_type($args['post_type'])) {
         return $pages;
     }
     static $once = false;
     // obliged to redo the get_pages query if we want to get the right number
     if (!empty($args['number']) && !$once) {
         $once = true;
         // avoid infinite loop
         $r = array('lang' => 0, 'numberposts' => -1, 'nopaging' => true, 'post_type' => $args['post_type'], 'fields' => 'ids', 'tax_query' => array(array('taxonomy' => 'language', 'field' => 'term_taxonomy_id', 'terms' => $language->term_taxonomy_id, 'operator' => 'NOT IN')));
         $args['exclude'] = array_merge($args['exclude'], get_posts($r));
         $pages = get_pages($args);
     }
     $ids = wp_list_pluck($pages, 'ID');
     // filters the queried list of pages by language
     if (!$once) {
         $ids = array_intersect($ids, $this->model->get_objects_in_language($language));
         foreach ($pages as $key => $page) {
             if (!in_array($page->ID, $ids)) {
                 unset($pages[$key]);
             }
         }
     }
     // not done by WP but extremely useful for performance when manipulating taxonomies
     update_object_term_cache($ids, $args['post_type']);
     $once = false;
     // in case get_pages is called another time
     return $pages;
 }
开发者ID:WordPressArt,项目名称:conisia,代码行数:31,代码来源:filters.php

示例5: oblivion_pg

 function oblivion_pg()
 {
     $pages = get_pages(array('meta_key' => '_wp_page_template', 'meta_value' => 'tmp-blog.php'));
     foreach ($pages as $page) {
         return $page->post_name;
     }
 }
开发者ID:CamionCiterne,项目名称:wordpress_fbpc,代码行数:7,代码来源:functions.php

示例6: angp_get_template_content

/**
 * This code generates the angularjs html views templates
 * It uses HTTP-API with  wp_remote_get()
 * */
function angp_get_template_content($new_status, $old_status)
{
    global $post;
    if (isset($post->post_name)) {
        $post_slug = $post->post_name;
        $file = get_template_directory() . '/library/views/pages/' . $post_slug . '.html';
        if ($old_status != 'trash' && $new_status == 'trash') {
            if (file_exists($file)) {
                unlink($file);
            }
        }
    }
    if ($old_status != 'publish' && $new_status == 'publish' || did_action('wp_insert_post') === 1) {
        angp_get_page_http_api(site_url(), 'newsloop');
        $pages = get_pages(array('sort_order' => 'asc'));
        if (!empty($pages)) {
            foreach ($pages as $page) {
                $slug = $page->post_name;
                $url = get_page_link($page->ID);
                angp_set_session('index.php', 'template_req');
                angp_get_page_http_api($url, $slug);
            }
        }
    }
}
开发者ID:patlegris,项目名称:angularpresstheme,代码行数:29,代码来源:get-templates.php

示例7: wpbss_main_menu_fallback

function wpbss_main_menu_fallback()
{
    global $post;
    $args = array('post_type' => 'page', 'post_status' => 'publish', 'hierarchical' => 0);
    $pages = get_pages($args);
    //var_dump($pages);
    ?>
	<ul class="nav navbar-nav">
		<?php 
    foreach ($pages as $post) {
        setup_postdata($post);
        ?>
			<li>
				<a href="<?php 
        the_permalink();
        ?>
"><?php 
        echo $post->post_title;
        ?>
</a>
			</li>
		<?php 
    }
    wp_reset_postdata();
    ?>
	</ul>
<?php 
}
开发者ID:tanzoor,项目名称:wpbss,代码行数:28,代码来源:menu-fullwidth.php

示例8: theme_get_excluded_pages

function theme_get_excluded_pages()
{
    $excluded_pages = theme_get_option('general', 'excluded_pages');
    $home = theme_get_option('homepage', 'home_page');
    if (!empty($excluded_pages)) {
        //Exclude a parent and all of that parent's child Pages
        $excluded_pages_with_childs = '';
        foreach ($excluded_pages as $parent_page_to_exclude) {
            if ($excluded_pages_with_childs) {
                $excluded_pages_with_childs .= ',' . $parent_page_to_exclude;
            } else {
                $excluded_pages_with_childs = $parent_page_to_exclude;
            }
            $descendants = get_pages('child_of=' . $parent_page_to_exclude);
            if ($descendants) {
                foreach ($descendants as $descendant) {
                    $excluded_pages_with_childs .= ',' . $descendant->ID;
                }
            }
        }
        if ($home) {
            $excluded_pages_with_childs .= ',' . $home;
        }
    } else {
        $excluded_pages_with_childs = $home;
    }
    return $excluded_pages_with_childs;
}
开发者ID:blocher,项目名称:oneholyname,代码行数:28,代码来源:common.php

示例9: getChildPagesList

function getChildPagesList($id)
{
    // Get the child pages of the current page.
    $args = array('child_of' => $id, 'sort_column' => 'menu_order', 'echo' => 0);
    $pages = get_pages($args);
    // Build the page list
    $class = '';
    $option = '<ul class="sub nav">';
    foreach ($pages as $pagg) {
        if (is_page($pagg->ID)) {
            $class = ' class="active"';
        }
        $option .= '<li' . $class . '>';
        $pageRedirect = get_field('redirect', $pagg->ID);
        if ($pageRedirect && $pageRedirect != 'no') {
            $option .= '<a href="' . $pageRedirect . '">' . $pagg->post_title . '</a>';
        } else {
            $option .= '<a href="' . get_page_link($pagg->ID) . '">' . $pagg->post_title . '</a>';
        }
        $option .= '</li>';
        $class = '';
    }
    $option .= '</ul>';
    // Return list
    return $option;
}
开发者ID:ndimatteo,项目名称:occasions,代码行数:26,代码来源:actions.php

示例10: widget

    public function widget($args, $instance)
    {
        extract($args);
        $id = $this->get_post_top_ancestor_id();
        if (!count(get_pages("child_of={$id}"))) {
            return;
        }
        $title = '<a href="' . get_permalink($id) . '" title="' . esc_attr(strip_tags(get_the_title($id))) . '">' . get_the_title($id) . '</a>';
        $depth = isset($instance['depth']) ? $instance['depth'] : 1;
        echo $before_widget;
        ?>

    <?php 
        echo $before_title . $title . $after_title;
        ?>
    <?php 
        echo '<ul class="menu">';
        ?>
    <?php 
        wp_list_pages(array('title_li' => '', 'depth' => $depth, 'child_of' => $id));
        ?>
    <?php 
        echo '</ul>';
        ?>
    <?php 
        echo $after_widget;
    }
开发者ID:uw-sop,项目名称:htdocs,代码行数:27,代码来源:subpage-menu.php

示例11: get_cf7_pages

 public function get_cf7_pages()
 {
     $args = array('sort_order' => 'ASC', 'sort_column' => 'post_title', 'post_type' => 'page', 'post_status' => 'publish');
     // get the list of pages
     $pages = get_pages($args);
     return $pages;
 }
开发者ID:naveenchander1909,项目名称:consult1,代码行数:7,代码来源:settings_model.php

示例12: has_children

function has_children()
{
    global $post;
    //get the array of pages which are the child of given post
    $pages = get_pages('child_of=' . $post->ID);
    return count($pages);
}
开发者ID:SergM2014,项目名称:wordpress,代码行数:7,代码来源:functions.php

示例13: wdp_options

 function wdp_options()
 {
     // VARIABLES
     $theme_data = get_theme_data(STYLESHEETPATH . '/style.css');
     $themename = $theme_data['Name'];
     $themeversion = $theme_data['Version'];
     $shortname = "tz";
     // Populate option in array for use in theme
     global $wdp_options;
     $wdp_options = get_option('wdp_options');
     $GLOBALS['template_path'] = wdp_DIRECTORY;
     //Access the WordPress Categories via an Array
     $wdp_categories = array();
     $wdp_categories_obj = get_categories('hide_empty=0');
     foreach ($wdp_categories_obj as $wdp_cat) {
         $wdp_categories[$wdp_cat->cat_ID] = $wdp_cat->cat_name;
     }
     $categories_tmp = array_unshift($wdp_categories, "Select a category:");
     //Access the WordPress Pages via an Array
     $wdp_pages = array();
     $wdp_pages_obj = get_pages('sort_column=post_parent,menu_order');
     foreach ($wdp_pages_obj as $wdp_page) {
         $wdp_pages[$wdp_page->ID] = $wdp_page->post_name;
     }
     $wdp_pages_tmp = array_unshift($wdp_pages, "Select a page:");
     // Image Alignment radio box
     $options_thumb_align = array("alignleft" => "Left", "alignright" => "Right", "aligncenter" => "Center");
     // Image Links to Options
     $options_image_link_to = array("image" => "The Image", "post" => "The Post");
     //Stylesheets Reader
     $alt_stylesheet_path = wdp_FILEPATH . '/css/';
     $alt_stylesheets = array();
     if (is_dir($alt_stylesheet_path)) {
         if ($alt_stylesheet_dir = opendir($alt_stylesheet_path)) {
             while (($alt_stylesheet_file = readdir($alt_stylesheet_dir)) !== false) {
                 if (stristr($alt_stylesheet_file, ".css") !== false) {
                     $alt_stylesheets[] = $alt_stylesheet_file;
                 }
             }
         }
     }
     //More Options
     $uploads_arr = wp_upload_dir();
     $all_uploads_path = '';
     if (isset($uploads_arr['path'])) {
         $all_uploads_path = $uploads_arr['path'];
     }
     $all_uploads = get_option('wdp_uploads');
     $other_entries = array("Select a number:", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19");
     // Set the Options Array
     $options = array();
     $options[] = array("name" => __('Background Images', 'framework'), "type" => "heading");
     $options[] = array("name" => "", "message" => __('Here, you can change the background images. Use an image resolution of 1280px X 800px ~ 200 KB, if possible.', 'framework'), "type" => "intro");
     $options[] = array("name" => __('Background Image 1', 'framework'), "desc" => __('Upload a logo for your theme, or specify the image address of your online logo. (http://example.com/logo.png)', 'framework'), "id" => $shortname . "_bg_image_1", "std" => "", "type" => "upload");
     $options[] = array("name" => __('Background Image 2', 'framework'), "desc" => __('Upload a logo for your theme, or specify the image address of your online logo. (http://example.com/logo.png)', 'framework'), "id" => $shortname . "_bg_image_2", "std" => "", "type" => "upload");
     $options[] = array("name" => __('Background Image 3', 'framework'), "desc" => __('Upload a logo for your theme, or specify the image address of your online logo. (http://example.com/logo.png)', 'framework'), "id" => $shortname . "_bg_image_3", "std" => "", "type" => "upload");
     update_option('wdp_template', $options);
     update_option('wdp_themename', $themename);
     update_option('wdp_shortname', $shortname);
 }
开发者ID:lokenxo,项目名称:familygenerator,代码行数:60,代码来源:theme-options.php

示例14: child_nav_pagination

 public function child_nav_pagination($parent = null)
 {
     global $post;
     if ($post->post_parent == 0) {
         $children = get_pages(array('sort_column' => 'menu_order', 'sort_order' => 'asc', 'post__in' => array(12, 14, 10, 8, 5)));
         $pages = array();
         foreach ($children as $page) {
             $pages[] += $page->ID;
         }
         $prev = "";
         $next = array_key_exists(0, $pages) ? $pages[0] : "";
         return array('next' => $next, 'prev' => $prev);
     } else {
         $child = $post->ID;
         $parent = null !== $parent ? $parent : $post->post_parent;
         $children = get_pages(array('sort_column' => 'menu_order', 'sort_order' => 'ASC', 'post__in' => array(12, 14, 10, 8, 5)));
         $pages = array($parent);
         foreach ($children as $page) {
             $pages[] += $page->ID;
         }
         if (!in_array($child, $pages) && !is_page($parent)) {
             return;
         }
         $current = array_search($child, $pages);
         $prev = array_key_exists($current - 1, $pages) ? $pages[$current - 1] : "";
         $next = array_key_exists($current + 1, $pages) ? $pages[$current + 1] : "";
         return array('next' => $next, 'prev' => $prev);
     }
 }
开发者ID:plusplusminus,项目名称:thelab,代码行数:29,代码来源:thelab-functions.php

示例15: walk_page

function walk_page($page_id)
{
    global $page_depth;
    $args = array();
    $page_lists = array();
    if ($page_depth == 0) {
        $page_lists[] = __('-Select-');
    }
    if ($page_id > 0) {
        $args['child_of'] = $page_id;
    } else {
        $args['parent'] = 0;
    }
    $pages = get_pages($args);
    $str = str_repeat('&rarr;', $page_depth);
    if ($pages && !is_wp_error($pages)) {
        foreach ($pages as $page) {
            $page_lists[$page->ID] = $str . $page->post_title;
            $child = walk_page($page->ID);
            $child = array_filter($child);
            foreach ($child as $kid_id => $kid_title) {
                $page_lists[$kid_id] = $kid_title;
            }
        }
    }
    if ($page_id > 0 && count($page_lists) > 0 && $page_depth == 0) {
        $page_depth++;
    }
    return $page_lists;
}
开发者ID:AllFamous,项目名称:singapore-wine-vault,代码行数:30,代码来源:customizer.php


注:本文中的get_pages函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。