本文整理汇总了PHP中get_all_page_ids函数的典型用法代码示例。如果您正苦于以下问题:PHP get_all_page_ids函数的具体用法?PHP get_all_page_ids怎么用?PHP get_all_page_ids使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_all_page_ids函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_test_menus
/**
* create optional test nav menu
*
* At least two custom menus should be created in order to test a theme
* The standard Theme data file now ships with optimal menus built-in
* This method actually makes sense with custom WXR files only
*
* @since 0.2
*/
private function create_test_menus()
{
$pages = get_all_page_ids();
$items = array();
foreach ($pages as $page_ID) {
$info = get_page($page_ID);
$items[$info->post_title] = get_permalink($page_ID);
}
# pick three random entries
$random = array_rand($items, 3);
# build menus
$menus = array('Full Menu' => array('slug' => 'full-menu', 'menu_items' => $items), 'Short Menu' => array('slug' => 'short-menu', 'menu_items' => array($items[$random[0]], $items[$random[1]], $items[$random[2]])));
# register menus
foreach ($menus as $title => $data) {
register_nav_menu($data['slug'], $title);
if (false == is_nav_menu($title)) {
$menu_ID = wp_create_nav_menu($title);
foreach ($data['menu_items'] as $name => $url) {
$add_item = array('menu-item-type' => 'custom', 'menu-item-url' => $url, 'menu-item-title' => $name);
wp_update_nav_menu_item($menu_ID, 0, $add_item);
}
WP_CLI::success('Created menu ' . $title);
}
}
}
示例2: ep_addVCCustomCss
function ep_addVCCustomCss()
{
$shortcodes_custom_css = '';
//if is main-page
if (is_page_template('main-page.php')) {
$page_ids = get_all_page_ids();
$current_page_id = get_the_ID();
if (count($page_ids) > 0) {
foreach ($page_ids as $page_id) {
$separate_page = get_post_meta($page_id, "page-position-switch", true);
if ($separate_page !== "0" && $page_id != $current_page_id) {
$shortcodes_custom_css .= get_post_meta($page_id, '_wpb_shortcodes_custom_css', true);
}
}
if ($shortcodes_custom_css != '') {
echo '<style type="text/css" data-type="vc_shortcodes-custom-css">';
echo $shortcodes_custom_css;
echo '</style>';
}
}
} else {
if (function_exists("is_shop")) {
$shortcodes_custom_css = get_post_meta(woocommerce_get_page_id('shop'), '_wpb_shortcodes_custom_css', true);
if (is_shop() && $shortcodes_custom_css != '') {
echo '<style type="text/css" data-type="vc_shortcodes-custom-css">';
echo $shortcodes_custom_css;
echo '</style>';
}
}
}
}
示例3: widget
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages', 'lespaul_domain_adm' ) : $instance['title'], $instance, $this->id_base);
$sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
$exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];
if ( $sortby == 'menu_order' )
$sortby = 'menu_order, post_title';
$pageIDs = get_all_page_ids();
foreach ( $pageIDs as $pageID ) {
if ( ! wm_restriction_page( $pageID ) ) {
$exclude .= ( $exclude ) ? ( ',' . $pageID ) : ( $pageID );
}
}
$out = wp_list_pages( apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) );
if ( !empty( $out ) ) {
echo $before_widget;
if ( $title)
echo $before_title . $title . $after_title;
?>
<ul>
<?php echo $out; ?>
</ul>
<?php
echo $after_widget;
}
}
示例4: retro_sanitize_pages
function retro_sanitize_pages($input)
{
$pages = get_all_page_ids();
if (in_array($input, $pages)) {
return $input;
} else {
return '';
}
}
示例5: getPagesFromCurrentLanguage
/**
* @return array
*/
public static function getPagesFromCurrentLanguage()
{
$page_ids = get_all_page_ids();
$pages = array();
foreach ($page_ids as $id) {
//Check if WPML is installed and activated
if (function_exists('icl_object_id')) {
//Get page id from de current language and translations
$current_lang_page_id = icl_object_id($id, 'page', true, ICL_LANGUAGE_CODE);
//Check if $current_lang_page_id is original page (not a tranlated page) and status publish
if ($id == $current_lang_page_id && get_post_status($id) == 'publish') {
$pages[$id] = get_the_title($id);
}
} else {
$pages[$id] = get_the_title($id);
}
}
return $pages;
}
示例6: handle
public function handle($sql)
{
$sql->table('pages', function () {
$ids = get_all_page_ids();
$pages = array();
foreach ($ids as $id) {
$pages[] = get_page($id);
}
return $pages;
});
$sql->table('posts', function () {
return get_posts(array('numberposts' => 10000));
});
$sql->table('menu', function () {
return wp_get_nav_menus();
});
$sql->table('users', function () {
return get_users();
});
}
示例7: array
//.........这里部分代码省略.........
if ( (int) $q['year'] ) {
$q['year'] = '' . intval($q['year']);
$where .= " AND YEAR(post_date)='" . $q['year'] . "'";
}
if ( (int) $q['monthnum'] ) {
$q['monthnum'] = '' . intval($q['monthnum']);
$where .= " AND MONTH(post_date)='" . $q['monthnum'] . "'";
}
if ( (int) $q['day'] ) {
$q['day'] = '' . intval($q['day']);
$where .= " AND DAYOFMONTH(post_date)='" . $q['day'] . "'";
}
// Compat. Map subpost to attachment.
if ( '' != $q['subpost'] )
$q['attachment'] = $q['subpost'];
if ( '' != $q['subpost_id'] )
$q['attachment_id'] = $q['subpost_id'];
if ('' != $q['name']) {
$q['name'] = sanitize_title($q['name']);
$where .= " AND post_name = '" . $q['name'] . "'";
} else if ('' != $q['pagename']) {
$q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
$page_paths = '/' . trim($q['pagename'], '/');
$q['pagename'] = sanitize_title(basename($page_paths));
$q['name'] = $q['pagename'];
$page_paths = explode('/', $page_paths);
foreach($page_paths as $pathdir)
$page_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
$all_page_ids = get_all_page_ids();
$reqpage = 0;
if (is_array($all_page_ids)) { foreach ( $all_page_ids as $page_id ) {
$page = get_page($page_id);
if ( $page->fullpath == $page_path ) {
$reqpage = $page_id;
break;
}
} }
$where .= " AND (ID = '$reqpage')";
} elseif ('' != $q['attachment']) {
$q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
$attach_paths = '/' . trim($q['attachment'], '/');
$q['attachment'] = sanitize_title(basename($attach_paths));
$q['name'] = $q['attachment'];
$where .= " AND post_name = '" . $q['attachment'] . "'";
}
if ( (int) $q['w'] ) {
$q['w'] = ''.intval($q['w']);
$where .= " AND WEEK(post_date, 1)='" . $q['w'] . "'";
}
if ( intval($q['comments_popup']) )
$q['p'] = intval($q['comments_popup']);
// If a attachment is requested by number, let it supercede any post number.
if ( ($q['attachment_id'] != '') && (intval($q['attachment_id']) != 0) )
$q['p'] = (int) $q['attachment_id'];
// If a post number is specified, load that post
if (($q['p'] != '') && intval($q['p']) != 0) {
示例8: form
function form($instance)
{
//Defaults
$instance = wp_parse_args((array) $instance, array('sortby' => 'post_title', 'title' => '', 'exclude' => ''));
$title = esc_attr($instance['title']);
$exclude = esc_attr($instance['exclude']);
?>
<p><label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title', 'wpdance');
?>
:</label> <input class="widefat" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" type="text" value="<?php
echo $title;
?>
" /></p>
<p>
<label for="<?php
echo $this->get_field_id('sortby');
?>
"><?php
_e('Sort by', 'wpdance');
?>
:</label>
<select name="<?php
echo $this->get_field_name('sortby');
?>
" id="<?php
echo $this->get_field_id('sortby');
?>
" class="widefat">
<option value="post_title"<?php
selected($instance['sortby'], 'post_title');
?>
><?php
_e('Page title', 'wpdance');
?>
</option>
<option value="menu_order"<?php
selected($instance['sortby'], 'menu_order');
?>
><?php
_e('Page order', 'wpdance');
?>
</option>
<option value="ID"<?php
selected($instance['sortby'], 'ID');
?>
><?php
_e('Page ID', 'wpdance');
?>
</option>
</select>
</p>
<p>
<?php
$page_ids = get_all_page_ids();
$page_select = empty($instance['include']) ? array() : $instance['include'];
?>
<select multiple="multiple" SIZE=5 name="<?php
echo $this->get_field_name('include');
?>
[]" class="widefat" style="height:auto;">
<?php
foreach ($page_ids as $p) {
?>
<?php
if (get_post_status($p) == 'private' || get_post_status($p) == 'publish' || get_post_status($p) == 'inherit') {
?>
<?php
if (in_array($p, $page_select)) {
?>
<option value="<?php
echo esc_attr($p);
?>
" selected ><?php
echo get_the_title($p);
?>
</option>
<?php
} else {
?>
<option value="<?php
echo esc_attr($p);
?>
"><?php
echo get_the_title($p);
?>
</option>
<?php
}
//.........这里部分代码省略.........
示例9: vc_map
<?php
/*------------------------------------------------------*/
/* BUTTON
/*------------------------------------------------------*/
vc_map(array("name" => __("Button", "js_composer"), "base" => 'vc_button', "icon" => "icon-wpb-ui-button", "category" => __('WPC Elements', 'js_composer'), "description" => __('Eye catching button', 'js_composer'), "save_always" => true, "params" => array(array('type' => 'textfield', 'heading' => __('Text on the button', 'js_composer'), 'holder' => 'button', 'class' => 'wpb_button', 'param_name' => 'title', 'value' => __('Text on the button', 'js_composer'), 'description' => __('Text on the button.', 'js_composer')), array('type' => 'vc_link', 'heading' => __('URL (Link)', 'js_composer'), 'param_name' => 'link', 'description' => __('Button link.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Button Color', 'js_composer'), 'param_name' => 'color', 'description' => __('Button color.', 'js_composer'), 'value' => array(__("Light", "js_composer") => "light", __("Ghost", "js_composer") => "ghost", __("Dark", "js_composer") => "dark", __("Primary Color", "js_composer") => "primary", __("Secondary Color", "js_composer") => "secondary", __("Custom BG Color", "js_composer") => "custom")), array("type" => "colorpicker", "class" => "", "heading" => __("Custom Button BG Color", "js_composer"), "param_name" => "button_custom_color", "value" => "", "dependency" => array('element' => "color", 'value' => array('custom'))), array('type' => 'dropdown', 'heading' => __('Size', 'js_composer'), 'param_name' => 'size', 'description' => __('Button size.', 'js_composer'), 'value' => array(__("Regular Size", "js_composer") => "regular", __("Large Size", "js_composer") => "large", __("Small Size", "js_composer") => "small")), array('type' => 'dropdown', 'heading' => __('Position', 'js_composer'), 'param_name' => 'button_position', 'description' => __('Button Position.', 'js_composer'), 'value' => array(__("Left", "js_composer") => "left", __("Center", "js_composer") => "center", __("Right", "js_composer") => "right")), array("type" => "textfield", "class" => "", "heading" => __("Custom Margin Top", "js_composer"), "param_name" => "margin_top", "value" => "", "description" => "Don't include \"px\" in your string. e.g \"50\""), array("type" => "textfield", "class" => "", "heading" => __("Custom Margin Bottom", "js_composer"), "param_name" => "margin_bottom", "value" => "", "description" => "Don't include \"px\" in your string. e.g \"50\""), array("type" => "textfield", "class" => "", "heading" => __("Custom Margin Left", "js_composer"), "param_name" => "margin_left", "value" => "", "description" => "Don't include \"px\" in your string. e.g \"50\""), array("type" => "textfield", "class" => "", "heading" => __("Custom Margin Right", "js_composer"), "param_name" => "margin_right", "value" => "", "description" => "Don't include \"px\" in your string. e.g \"50\""), array('type' => 'textfield', 'heading' => __('Extra class name', 'js_composer'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'js_composer'))), 'js_view' => 'VcButtonView'));
/*------------------------------------------------------*/
/* CHILD PAGE
/*------------------------------------------------------*/
$page_ids = get_all_page_ids();
$pages = array();
for ($i = 0; $i < count($page_ids); $i++) {
$pages[get_the_title($page_ids[$i])] = $page_ids[$i];
}
vc_map(array("name" => __("Page Children", "js_composer"), "base" => 'wpc_childpage', "category" => __('WPC Elements', 'js_composer'), "description" => __('Display list page children', 'js_composer'), 'save_always' => true, 'save_always' => true, "params" => array(array('type' => 'textarea', 'holder' => 'h2', 'heading' => __('Widget Title', 'js_composer'), 'param_name' => 'widget_title', 'value' => '', 'description' => __('What text use as widget title. Leave blank if no title is needed.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Select your parent Page', 'js_composer'), 'param_name' => 'parrent_page_id', 'description' => __('The builder item will use parrent page ID to get page childen of that page.', 'js_composer'), 'value' => $pages), array('type' => 'dropdown', 'heading' => __('Order', 'js_composer'), 'param_name' => 'order', 'description' => __('Ascending or descending order', 'js_composer'), 'default' => 'DESC', 'value' => array(__("DESC", "js_composer") => "DESC", __("ASC", "js_composer") => "ASC")), array('type' => 'dropdown', 'heading' => __('Orderby', 'js_composer'), 'param_name' => 'orderby', 'description' => __('Sort retrieved posts/pages by parameter', 'js_composer'), 'default' => 'none', 'value' => array(__("None", "js_composer") => "none", __("ID", "js_composer") => "ID", __("Title", "js_composer") => "title", __("Name", "js_composer") => "name", __("Date", "js_composer") => "date", __("Page Order", "js_composer") => "menu_order")), array("type" => "textfield", "class" => "", "heading" => __("Specify page NOT to retrieve", "js_composer"), "param_name" => "exclude", "value" => "", "description" => "Use post ids, e.g: 16, 28"), array("type" => "textfield", "class" => "", "heading" => __("Number of posts", "js_composer"), "param_name" => "number", "value" => "9", "description" => "How many post to show?"), array('type' => 'dropdown', 'heading' => __('Display Mode', 'js_composer'), 'param_name' => 'layout', 'description' => __('The layout your page children being display', 'js_composer'), 'value' => array(__("Grid", "js_composer") => "grid", __("Carousel", "js_composer") => "carousel")), array('type' => 'dropdown', 'heading' => __('Column', 'js_composer'), 'param_name' => 'column', 'description' => __('How many column will be display on a row?', 'js_composer'), 'default' => '3', 'value' => array(__("2 Columns", "js_composer") => "2", __("3 Columns", "js_composer") => "3", __("4 Columns", "js_composer") => "4", __("5 Columns", "js_composer") => "5")), array("type" => "textfield", "class" => "", "heading" => __("Read More text", "js_composer"), "param_name" => "readmore_text", "value" => "Read More", "description" => "Custom your read more text, e.g. Read More, View Profile ..."), array('type' => 'textfield', 'heading' => __('Extra class name', 'js_composer'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'js_composer')))));
function wpc_shortcode_childpage($atts, $content = null)
{
// extract(shortcode_atts(array(
// 'widget_title' => '',
// 'parrent_page_id' => '',
// 'order' => '',
// 'orderby' => '',
// 'exclude' => '',
// 'layout' => '',
// 'column' => '',
// 'number' => '',
// 'readmore_text' => '',
// 'el_class' => ''
// ), $atts));
$atts = vc_map_get_attributes('wpc_childpage', $atts);
extract($atts);
示例10: cth_create_section_for_list_pages_select
function cth_create_section_for_list_pages_select($value)
{
$all_page_ids = get_all_page_ids();
cth_create_opening_tag($value);
if (!empty($all_page_ids)) {
echo "<select id='" . $value['id'] . "' class='post_form' name='" . $value['id'] . "'>\n";
foreach ($all_page_ids as $key => $p_id) {
$p_p = get_post($p_id);
if ($p_p->post_status == 'publish') {
$selected = ' ';
if (get_option($value['id']) == $p_id) {
$selected = ' selected="selected" ';
} else {
if (get_option($value['id']) === FALSE && $value['default_title'] == $p_p->post_title) {
$selected = ' selected="selected" ';
}
}
echo '<option value="' . $p_id . '" ' . $selected . '/>' . $p_p->post_title . "</option>\n";
}
}
echo "</select>\n </div>";
}
cth_create_closing_tag($value);
}
示例11: aft_plgn_options
function aft_plgn_options()
{
global $aft_options_array, $aft_options_by_array, $aft_themes_array;
$cat_id = get_all_category_ids();
$page_id = get_all_page_ids();
$post_value = 0;
$options_category = array();
$options_page = array();
if ($cat_id) {
foreach ($cat_id as $id) {
$options_category[get_cat_name($id)] = $post_value;
}
}
if ($page_id) {
foreach ($page_id as $id) {
$page_data = get_page($id);
$options_page[$page_data->post_title] = $post_value;
}
}
// Default setup for option variable
$aft_options_list = array('aft_is_enable' => 'true', 'aft_location' => 'bottom', 'aft_insertion' => 'all-article', 'rtp_is_custom_label' => 'false', 'rtp_custom_labels' => array(), 'rtp_custom_hints' => 0, 'rtp_theme' => 'default', 'rtp_can_rate' => 3, 'rtp_logged_by' => 3, 'rtp_use_shortcode' => 0);
if (!get_option('aft_options_array')) {
add_option('aft_options_array', $aft_options_list, '', 'yes');
}
$options_by_category = array(array($options_category));
$options_by_page = array(array($options_page));
$aft_options_by_list = array('category' => array($options_by_category), 'page' => array($options_by_page));
if (!get_option('aft_options_by_array')) {
add_option('aft_options_by_array', $aft_options_by_list, '', 'yes');
}
/* TODO: star images also will be changeable in the future */
$theme_lists = array('default' => 'Default', 'couture_white' => 'Couture White', 'dark_red' => 'Dark Red', 'steel' => 'Steel', 'neutral_blue' => 'Neutral Blue');
if (!get_option('aft_themes_array')) {
add_option('aft_themes_array', $theme_lists, '', 'yes');
} else {
update_option('aft_themes_array', $theme_lists);
}
$aft_options_array = get_option('aft_options_array');
$aft_options_by_array = get_option('aft_options_by_array');
$aft_themes_array = get_option('aft_themes_array');
}
示例12: getPages
/**
* Return all pages.
* (Post type page)
*
* @return array<Post>
*/
public static function getPages($withoutEmpty = true)
{
foreach (get_all_page_ids() as $id) {
$p = Post::find($id);
if ($p->ID) {
$pages[] = $p;
}
}
if ($withoutEmpty) {
$pages = array_filter($pages, function ($page) {
return strlen($page->getContent());
});
}
/*
* Sort by title
*/
/** @var Post $a */
/** @var Post $b */
usort($pages, function ($a, $b) {
strcmp($a->getTitle(), $b->getTitle());
});
return $pages;
}
示例13: themeum_startup_idea_settings
//.........这里部分代码省略.........
}
?>
value="USD"><?php
_e('U.S. Dollar($)', 'themeum-startup-idea');
?>
</option>
</select>
</td>
</tr>
<tr>
<th><label for="donate_page_percentage"><?php
_e('Per Project Commission', 'themeum-startup-idea');
?>
</label></th>
<td>
<input type="text" id="donate_page_percentage" class="regular-text" name="donate_page_percentage" value="<?php
echo esc_attr(get_option('donate_page_percentage'));
?>
" />%
<p class="description"><small>Set project fee in percentage.</small></p>
</td>
</tr>
<!--Profile page setting -->
<tr>
<th scope="row"><label for="profile_page_id"><?php
_e('Profile/Dashboard Page', 'themeum-startup-idea');
?>
</label></th>
<td>
<?php
$profile_page_id = '<select name="profile_page_id" id="profile_page_id">';
foreach (get_all_page_ids() as $value) {
$page_title_all = get_post($value);
if (get_option('profile_page_id') == $value) {
$profile_page_id .= '<option selected="selected" value="' . $value . '">' . $page_title_all->post_title . '</option>';
} else {
$profile_page_id .= '<option value="' . $value . '">' . $page_title_all->post_title . '</option>';
}
}
$profile_page_id .= '</select>';
echo $profile_page_id;
?>
</td>
</tr>
<tr>
<th scope="row"><label for="paypal_payment_checkout_page_id"><?php
_e('Fund/Checkout Page', 'themeum-startup-idea');
?>
</label></th>
<td>
<?php
$paypal_payment_checkout_page_id = '<select name="paypal_payment_checkout_page_id" id="paypal_payment_checkout_page_id">';
foreach (get_all_page_ids() as $value) {
$page_title_all = get_post($value);
if (get_option('paypal_payment_checkout_page_id') == $value) {
$paypal_payment_checkout_page_id .= '<option selected="selected" value="' . $value . '">' . $page_title_all->post_title . '</option>';
} else {
$paypal_payment_checkout_page_id .= '<option value="' . $value . '">' . $page_title_all->post_title . '</option>';
}
}
$paypal_payment_checkout_page_id .= '</select>';
echo $paypal_payment_checkout_page_id;
?>
示例14: get_theme_urls
//.........这里部分代码省略.........
}
break;
/**
* Handle attachment.php
*/
/**
* Handle attachment.php
*/
case $template == 'attachment':
$attachments = get_posts(array('post_type' => 'attachment', 'numberposts' => 1, 'orderby' => 'rand'));
if (is_array($attachments) && count($attachments)) {
$link = get_attachment_link($attachments[0]->ID);
}
break;
/**
* Handle single.php
*/
/**
* Handle single.php
*/
case $template == 'single':
$posts = get_posts(array('numberposts' => 1, 'orderby' => 'rand'));
if (is_array($posts) && count($posts)) {
$link = get_permalink($posts[0]->ID);
}
break;
/**
* Handle page.php
*/
/**
* Handle page.php
*/
case $template == 'page':
$pages_ids = get_all_page_ids();
if (is_array($pages_ids) && count($pages_ids)) {
$link = get_page_link($pages_ids[0]);
}
break;
/**
* Handle comments-popup.php
*/
/**
* Handle comments-popup.php
*/
case $template == 'comments-popup':
$posts = get_posts(array('numberposts' => 1, 'orderby' => 'rand'));
if (is_array($posts) && count($posts)) {
$link = sprintf('%s/?comments_popup=%d', $home_url, $posts[0]->ID);
}
break;
/**
* Handle paged.php
*/
/**
* Handle paged.php
*/
case $template == 'paged':
global $wp_rewrite;
if ($wp_rewrite->using_permalinks()) {
$link = sprintf('%s/page/%d/', $home_url, 1);
} else {
$link = sprintf('%s/?paged=%d', 1);
}
break;
/**
* Handle author-id.php or author-nicename.php
示例15: wiziapp_generate_latest_content
/**
* Called from the install method, to install the base content
* that will be used at first for the simulator and for building the cms
* profile
*
* After the initial processing the user will be able to trigger the processing
* via his plugin control panel or when a post is requested for the first time
*/
function wiziapp_generate_latest_content()
{
global $wpdb;
$done = false;
$GLOBALS['WiziappLog']->write('info', "Parsing the latest content", "content");
// Parse the latest posts
$number_recents_posts = WiziappConfig::getInstance()->post_processing_batch_size;
$recent_posts = wp_get_recent_posts($number_recents_posts);
$last_post = -1;
foreach ($recent_posts as $post) {
$post_id = $post['ID'];
$GLOBALS['WiziappLog']->write('info', "Processing post: {$post_id}", 'content.wiziapp_generate_latest_content');
wiziapp_save_post($post_id);
$last_post = $post_id;
}
$GLOBALS['WiziappLog']->write('info', "Processing all pages", 'content');
$pages = get_all_page_ids();
for ($p = 0, $total = count($pages); $p < $total; ++$p) {
wiziapp_save_page($pages[$p]);
}
// Save the fact that we processed $number_recents_posts and if the number of posts
// in the blog is bigger, we need to continue
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_status = 'publish'");
if ($numposts <= $number_recents_posts) {
$last_post = -1;
}
add_option("wiziapp_last_processed", $last_post);
$GLOBALS['WiziappLog']->write('info', "Finished parsing initial content", 'content');
return $done;
}