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


PHP next_posts函数代码示例

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


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

示例1: kb_scripts

function kb_scripts()
{
    wp_enqueue_style('Google-Fonts', 'https://fonts.googleapis.com/css?family=Roboto:300,400|Open+Sans:400,600,700');
    wp_enqueue_style('Normalizer', get_template_directory_uri() . '/normalize.css');
    wp_enqueue_style('Chosen', get_template_directory_uri() . '/chosen/chosen.css');
    wp_enqueue_style('Dropzone', get_template_directory_uri() . '/css/dropzone.css');
    wp_enqueue_style('Main', get_stylesheet_uri(), array(), '1.01', false);
    wp_enqueue_script('bx-js', get_template_directory_uri() . '/js/jquery.bxslider.min.js', array('jquery'), '1.0.1', true);
    wp_enqueue_script('easing-js', get_template_directory_uri() . '/js/jquery.easing.1.3.js', array('jquery'), '1.0.1', true);
    wp_enqueue_script('chosen-js', get_template_directory_uri() . '/js/chosen.jquery.min.js', array('jquery'), '1.0.1', true);
    wp_enqueue_script('custom-js', get_template_directory_uri() . '/js/custom.js', array('jquery'), '1.0.1', true);
    if (is_page_template(array('page-create-basic-listing.php', 'page-edit-basic-listing.php', 'page-create-paid-listing.php', 'page-edit-paid-listing.php', 'page-create-basic-listing-fr.php', 'page-edit-basic-listing-fr.php', 'page-create-paid-listing-fr.php', 'page-edit-paid-listing-fr.php'))) {
        wp_enqueue_script('dropzone', get_template_directory_uri() . '/js/dropzone.js', array('jquery'), '1.0.1', 'true');
    }
    //		if(is_page_template(array('page-create-paid-listing.php', 'page-edit-paid-listing.php'))) {
    //			wp_enqueue_script('stripejs', 'https://js.stripe.com/v2/', array(''), '1.0.1', 'false');
    //		}
    if (is_page_template('page-paid-listing.php')) {
        wp_register_script('googlemap', 'https://maps.google.com/maps/api/js?sensor=false', 'jquery');
        wp_enqueue_script('googlemap');
    }
    if (!is_admin()) {
        wp_localize_script('custom-js', 'my_ajax', array('ajaxurl' => admin_url('admin-ajax.php')));
    }
    if (is_home() || is_category() || is_archive()) {
        wp_enqueue_script('blog-js', get_template_directory_uri() . '/js/ajax-blog.js', array('jquery'), '1.0.1', true);
        global $wp_query;
        // What page are we on? And what is the pages limit?
        $max = $wp_query->max_num_pages;
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        // Add some parameters for the JS.
        wp_localize_script('blog-js', 'pbd_alp', array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false)));
    }
}
开发者ID:altim,项目名称:kallababy,代码行数:34,代码来源:functions.php

示例2: moove_localize_script

 /**
  * Register global variables to head, AJAX, Form validation messages
  *
  * @param  string $ascript Localize function name.
  */
 public function moove_localize_script($ascript)
 {
     global $wp_query;
     $max = $wp_query->max_num_pages;
     $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
     $this->loc_data = array('ajaxurl' => admin_url('admin-ajax.php'), 'startpage' => $paged, 'maxpages' => $max, 'nextlink' => next_posts($max, false), 'validationoptions' => get_option('moove_protection-validation'));
     wp_localize_script($ascript, 'moove_front_end_scripts', $this->loc_data);
 }
开发者ID:MooveAgency,项目名称:Post-Protection-and-Registration-Wall,代码行数:13,代码来源:moove-actions.php

示例3: voidx_enqueue_scripts

function voidx_enqueue_scripts()
{
    $script_name = '';
    // Empty by default, may be populated by conditionals below
    $script_vars = array();
    // An empty array that can be filled with variables to send to front-end scripts
    $script_handle = 'voidx';
    // A generic script handle
    $suffix = '.min';
    // The suffix for minified scripts
    $ns = 'wp';
    // Namespace for scripts
    // Load original scripts when debug mode is on; this allows for easier local development
    if (WP_DEBUG === true) {
        $suffix = '';
    }
    // Figure out which script bundle to load based on various options set in `src/functions-config-defaults.php`
    // Note: bundles require less HTTP requests at the expense of addition caching hits when different scripts are requested
    // You could also load one main bundle on every page with supplementary scripts as needed (e.g. for commenting or a contact page)
    // An example integration using WP AJAX Page Loader; this script requires a bit more setup as outlined in the documentation: https://github.com/synapticism/wp-ajax-page-loader
    $script_vars_page_loader = '';
    // This conditional establishes whether the page loader bundle is loaded or not; you can turn this off completely from the theme configuration file if you wish (or just remove the code)
    if (VOIDX_SCRIPTS_PAGELOAD && (is_archive() || is_home() || is_search())) {
        $script_name .= '-pageloader';
        // This is used to generate the filename that the theme will serve to the user; it is additive to allow for multiple features that can be toggled in the theme configuration
        global $wp_query;
        // This chunk of code provisions the script with some important information it needs: What page are we on? And what is the page limit?
        $max = $wp_query->max_num_pages;
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        // Prepare script variables; note that these are separate from the rest of the script variables as this script requires everything in an object named `PG8Data`
        $script_vars_page_loader = array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false));
    }
    // WP AJAX Page Loader configuration ends
    // Default script name
    if (empty($script_name)) {
        $script_name = '-core';
    }
    // Load theme-specific JavaScript bundles with versioning based on last modified time; http://www.ericmmartin.com/5-tips-for-using-jquery-with-wordpress/
    // The handle is the same for each bundle since we're only loading one script; if you load others be sure to provide a new handle
    wp_enqueue_script($script_handle, get_stylesheet_directory_uri() . '/js/' . $ns . $script_name . $suffix . '.js', array('jquery'), filemtime(get_template_directory() . '/js/' . $ns . $script_name . $suffix . '.js'), true);
    wp_enqueue_script('egiis-script', get_stylesheet_directory_uri() . '/js/' . 'wp-core.min.js');
    // Pass variables to JavaScript at runtime; see: http://codex.wordpress.org/Function_Reference/wp_localize_script
    $script_vars = apply_filters('voidx_script_vars', $script_vars);
    if (!empty($script_vars)) {
        wp_localize_script($script_handle, 'voidxVars', $script_vars);
    }
    // Script variables for WP AJAX Page Loader (these are separate from the main theme script variables due to the naming requirement; the object must be `PG8Data`)
    if (!empty($script_vars_page_loader)) {
        wp_localize_script($script_handle, 'PG8Data', $script_vars_page_loader);
    }
    // Register and enqueue our main stylesheet with versioning based on last modified time
    wp_register_style('voidx-style', get_stylesheet_uri(), $dependencies = array(), filemtime(get_template_directory() . '/style.css'));
    wp_enqueue_style('voidx-style');
    wp_enqueue_style('fancySelect', get_stylesheet_directory_uri() . '/fancySelect.css');
}
开发者ID:romainbellande,项目名称:egiis,代码行数:55,代码来源:assets.php

示例4: my_get_next_posts_link

function my_get_next_posts_link($label = 'Next Page »', $max_page = 0)
{
    global $paged, $wp_query;
    if (!$paged) {
        $paged = 1;
    }
    $nextpage = intval($paged) + 1;
    if (!is_single() && (empty($paged) || $nextpage <= $max_page)) {
        $attr = apply_filters('next_posts_link_attributes', '');
        return '<a href="' . next_posts($max_page, false) . "\" {$attr}>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&$1', $label) . '</a>';
    }
}
开发者ID:shimia90,项目名称:management,代码行数:12,代码来源:functions.php

示例5: salp_init

/**
 * Initialization. Add our script if needed on this page.
 */
function salp_init()
{
    global $wp_query;
    if (!is_singular()) {
        wp_enqueue_style('salp-style', plugin_dir_url(__FILE__) . 'css/style.css', false, '1.0', 'all');
        wp_enqueue_script('salp-script', plugin_dir_url(__FILE__) . 'js/load-posts.js', array('jquery'), '1.0', false);
        $max = $wp_query->max_num_pages;
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        // Add some parameters for the JS.
        wp_localize_script('salp-script', 'salp', array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false)));
    }
}
开发者ID:eiffelqiu,项目名称:simple-ajax-load-posts,代码行数:15,代码来源:simple-ajax-load-posts.php

示例6: pbd_alp_init

/**
 * Initialization. Add our script if needed on this page.
 */
function pbd_alp_init()
{
    global $wp_query;
    // Add code to index pages.
    if (!is_singular()) {
        // Queue JS and CSS
        // What page are we on? And what is the pages limit?
        $max = $wp_query->max_num_pages;
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        // Add some parameters for the JS.
        wp_localize_script('pbd-alp-load-posts', 'pbd_alp', array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false)));
    }
}
开发者ID:WackoMako,项目名称:stonedape,代码行数:16,代码来源:pbd-ajax-load-posts.php

示例7: tm_alp_init

function tm_alp_init()
{
    global $wp_query;
    $num_page = 0;
    // Add code to index pages.
    if (!is_singular() || is_page_template('page-templates/tpl-video-listing.php') || is_page_template('page-templates/tpl-blog-listing.php') || $wp_query->post->ID == 605) {
        // Queue JS and CSS
        wp_enqueue_script('pbd-alp-load-posts', plugin_dir_url(__FILE__) . 'js/load-posts.js', array('jquery'), '1.0', true);
        wp_enqueue_style('pbd-alp-style', plugin_dir_url(__FILE__) . 'css/style.css', false, '1.0', 'all');
        // What page are we on? And what is the pages limit?
        if (is_page_template('page-templates/tpl-video-listing.php')) {
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
            $args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => $paged, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-video'), 'operator' => 'IN')));
            $listing_query = new WP_Query($args);
            $num_page = $listing_query->max_num_pages;
        }
        if (is_page_template('page-templates/tpl-blog-listing.php')) {
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
            $args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => $paged, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-video'), 'operator' => 'NOT IN')));
            $listing_query = new WP_Query($args);
            $num_page = $listing_query->max_num_pages;
        }
        if ($wp_query->post->ID == 605) {
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
            $arg = array('cat' => '1', 'post_type' => 'post', 'posts_per_page' => 15, 'paged' => $paged, 'meta_key' => 'event_begin', 'orderby' => 'meta_value', 'order' => 'DESC');
            // DATES
            $meta_query = array(array('key' => 'event_end', 'value' => '', 'compare' => '!='), array('key' => 'event_begin', 'value' => '', 'compare' => '!='));
            $meta_query[] = array('key' => 'event_end', 'value' => date('Y-m-d'), 'compare' => '<');
            $arg['meta_query'] = $meta_query;
            $listing_query = new WP_Query($arg);
            $num_page = $listing_query->max_num_pages;
        }
        if (isset($_GET['orderby']) && $_GET['orderby'] == 'resumen') {
            $arg = array('post_type' => 'post', 'posts_per_page' => 8, 'paged' => $paged, 'cat' => 177);
            $list_query = new WP_Query($arg);
            $num_page = $list_query->max_num_pages;
        }
        if ($num_page != 0) {
            $max = $num_page;
        } else {
            $max = $wp_query->max_num_pages;
        }
        $q_v = get_template_directory_uri() . '/js/html5lightbox.js';
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        $text_lb1 = __('More', 'cactusthemes');
        $text_lb2 = __('Loading posts', 'cactusthemes');
        // Add some parameters for the JS.
        $ot_permali = get_option('permalink_structure');
        wp_localize_script('pbd-alp-load-posts', 'pbd_alp', array('startPage' => $paged, 'maxPages' => $max, 'textLb1' => $text_lb1, 'textLb2' => $text_lb2, 'ot_permali' => $ot_permali, 'nextLink' => next_posts($max, false), 'quick_view' => $q_v));
    }
}
开发者ID:venamax,项目名称:trixandtrax-cl,代码行数:51,代码来源:tm-ajax-load-posts.php

示例8: voidx_enqueue_scripts

function voidx_enqueue_scripts()
{
    $script_name = '';
    // Empty by default, may be populated by conditionals below; this is used to generate the script filename
    $script_vars = array();
    // An empty array that can be filled with variables to send to front-end scripts
    $script_handle = 'voidx';
    // A generic script handle used internally by WordPress
    $ns = 'wp';
    // Namespace for scripts; this should match what is specified in your `gulpconfig.js` (and it's safe to leave alone)
    // Figure out which script bundle to load based on various options set in `src/functions-config-defaults.php`
    // Note: bundles require fewer HTTP requests at the expense of addition caching hits when different scripts are requested on different pages of your site
    // You could also load one main bundle on every page with supplementary scripts as needed (e.g. for commenting or a contact page); it's up to you!
    // == EXAMPLE INTEGRATION == //
    // An example integration using WP AJAX Page Loader; this script requires a bit more setup as outlined in the documentation: https://github.com/synapticism/wp-ajax-page-loader
    $script_vars_page_loader = '';
    // This conditional establishes whether the page loader bundle is loaded or not; you can turn this off completely from the theme configuration file if you wish (or just remove the code)
    if (VOIDX_SCRIPTS_PAGELOAD && (is_archive() || is_home() || is_search())) {
        // The script name is used to specify the file that the theme will serve to users
        // Script names are designed to be additive (meaning you can append more script names to the end in other conditional blocks using `.= '-anotherscript'` etc.) to allow for multiple feature toggles in the theme configuration
        $script_name .= '-pageloader';
        // This chunk of code provisions the WP AJAX Page Loader script with some important information it needs: What page are we on? And what is the page limit?
        global $wp_query;
        $max = $wp_query->max_num_pages;
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        // Prepare script variables; note that these are separate from the rest of the script variables as the WP AJAX Page Loader script requires everything in a specific object named `PG8Data`
        $script_vars_page_loader = array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false));
    }
    // WP AJAX Page Loader configuration ends
    // Default script name; used when conditional blocks (above) aren't triggered
    if (empty($script_name)) {
        $script_name = '-core';
    }
    // Load theme-specific JavaScript bundles with versioning based on last modified time; http://www.ericmmartin.com/5-tips-for-using-jquery-with-wordpress/
    // The handle is the same for each bundle since we're only loading one script; if you load others be sure to provide a new handle
    wp_enqueue_script($script_handle, get_stylesheet_directory_uri() . '/js/' . $ns . $script_name . '.js', array('jquery'), filemtime(get_template_directory() . '/js/' . $ns . $script_name . '.js'), true);
    // Pass variables to JavaScript at runtime; see: http://codex.wordpress.org/Function_Reference/wp_localize_script
    $script_vars = apply_filters('voidx_script_vars', $script_vars);
    if (!empty($script_vars)) {
        wp_localize_script($script_handle, 'voidxVars', $script_vars);
    }
    // Script variables specific to WP AJAX Page Loader (these are separate from the main theme script variables due to the naming requirement; the object *must* be `PG8Data`)
    // This appears here and NOT in the conditional block (above) because these variables will be attached to the main script handle (which may be modified after the page loader block)
    if (!empty($script_vars_page_loader)) {
        wp_localize_script($script_handle, 'PG8Data', $script_vars_page_loader);
    }
    // Register and enqueue our main stylesheet with versioning based on last modified time
    wp_register_style('voidx-style', get_stylesheet_uri(), $dependencies = array(), filemtime(get_template_directory() . '/style.css'));
    wp_enqueue_style('voidx-style');
}
开发者ID:vespertines,项目名称:wordpress-gulp-bower-sass,代码行数:50,代码来源:assets.php

示例9: vntd_ajax_pagination

function vntd_ajax_pagination($query = null)
{
    global $wp_query;
    // Add code to index pages.
    wp_enqueue_script('ajax-load-posts', get_template_directory_uri() . '/js/jquery.load-posts.js', array('jquery'));
    if (!$query) {
        $query = $wp_query;
    }
    // What page are we on? And what is the pages limit?
    $max = $query->max_num_pages;
    $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
    // Add some parameters for the JS.
    wp_localize_script('ajax-load-posts', 'pbd_alp', array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false)));
}
开发者ID:ericsoncardosoweb,项目名称:agatha-wp,代码行数:14,代码来源:general-functions.php

示例10: posts_alp_init

function posts_alp_init()
{
    global $wp_query;
    // Add code to index pages.
    if (!is_singular()) {
        // Queue JS file
        wp_enqueue_script('posts-alp-load-posts', plugin_dir_url(__FILE__) . 'load-posts.js', array('jquery'), '1.0', true);
        // Grab page from query and max number of pages
        $max = $wp_query->max_num_pages;
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        // Add some parameters for the JS.
        wp_localize_script('posts-alp-load-posts', 'posts_alp', array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false)));
    }
}
开发者ID:steveferrar,项目名称:60degrees.com,代码行数:14,代码来源:ajax-load-posts.php

示例11: pbd_alp_init

/**
 * Initialization. Add our script if needed on this page.
 */
function pbd_alp_init()
{
    $args = array('post_type' => 'post', 'showposts' => 3, 'paged' => $paged);
    $wp_query = null;
    $wp_query = new WP_Query();
    $wp_query->query($args);
    // Add code to index pages.
    if (is_page_template('category.php')) {
        // Queue JS and CSS
        wp_enqueue_script('pbd-alp-load-posts', get_template_directory_uri() . '/inc/pbd-ajax-load-posts/js/load-posts.js', array('jquery'), '1.0', true);
        wp_enqueue_style('pbd-alp-style', get_template_directory_uri() . '/inc/pbd-ajax-load-posts/css/style.css', false, '1.0', 'all');
        // What page are we on? And what is the pages limit?
        $max = $wp_query->max_num_pages;
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        // Add some parameters for the JS.
        wp_localize_script('pbd-alp-load-posts', 'pbd_alp', array('startPage' => $paged, 'maxPages' => $wp_query->max_num_pages, 'nextLink' => next_posts($max, false)));
    }
}
开发者ID:vee879,项目名称:wordpress_4_3_1,代码行数:21,代码来源:pbd-ajax-load-posts.php

示例12: voidx_assets_footer

function voidx_assets_footer()
{
    // Initialize variables
    $name = 'voidx-footer';
    // This is the script handle
    $file = 'x';
    // The beginning of the filename; "x" is the namespace set in `gulpconfig.js`
    $vars = array();
    // An empty array that may be populated by script variables for output with `wp_localize_script` after the footer script is enqueued
    // This approach allows for conditional loading of various script bundles based on options set in `src/functions-config-defaults.php`
    // Note: bundles require fewer HTTP requests at the expense of addition caching hits when different scripts are requested on different pages of your site
    // You could also load one main bundle on every page with supplementary scripts as needed (e.g. for commenting or a contact page); it's up to you!
    // Example integraton: WP AJAX Page Loader (similar to Infinite Scroll); this script is only loaded when the conditions below are met
    // This script must be provisioned with some extra data via the `wp_localize_script` function as outlined in the documentation: https://github.com/synapticism/wp-ajax-page-loader
    if (VOIDX_SCRIPTS_PAGELOAD && (is_archive() || is_home() || is_search())) {
        // Script filenames are designed to be additive (meaning you can append more script names to the end in other conditional blocks using `.= '-anotherscript'` etc.) to allow for multiple feature toggles in the theme configuration
        // Have a look at `gulpconfig.js` to see where these script names are defined
        $file .= '-pageloader';
        // This chunk of code provisions the script with vital info: What page are we on? And what is the page limit?
        global $wp_query;
        $max = $wp_query->max_num_pages;
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        // Prepare script variables that will be output after the footer script is enqueued
        $vars['PG8Data'] = array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false));
    }
    // If none of the conditons were matched (above) let's output the default script name
    if ($file === 'x') {
        $file .= '-footer';
    }
    // Load theme-specific JavaScript bundles with versioning based on last modified time; http://www.ericmmartin.com/5-tips-for-using-jquery-with-wordpress/
    // The handle is the same for each bundle since we're only loading one script; if you load others be sure to provide a new handle
    wp_enqueue_script($name, get_stylesheet_directory_uri() . '/js/' . $file . '.js', array('jquery'), filemtime(get_template_directory() . '/js/' . $file . '.js'), true);
    // This last `true` is what loads the script in the footer
    // Pass variables to scripts at runtime; must be triggered after the script is enqueued; see: http://codex.wordpress.org/Function_Reference/wp_localize_script
    if (!empty($vars)) {
        foreach ($vars as $var => $data) {
            wp_localize_script($name, $var, $data);
        }
    }
}
开发者ID:shoetten,项目名称:bedrock-gulp,代码行数:40,代码来源:assets.php

示例13: pcode_init

 /**
  * Initialization. Add our script if needed on this page.
  */
 function pcode_init() {
 	global $wp_query;
 
 	// Add code to index pages.
 	if( !is_singular() ) {	
 		// Queue JS and CSS
 		wp_enqueue_script(
 			'pcode-load-posts',
 			plugin_dir_url( __FILE__ ) . 'js/load-posts.js',
 			array('jquery'),
 			'1.0',
 			true
 		);
 		
 		wp_enqueue_style(
 			'pcode-style',
 			plugin_dir_url( __FILE__ ) . 'css/style.css',
 			false,
 			'1.0',
 			'all'
 		);
 		
 		// What page are we on? And what is the pages limit?
 		$max = $wp_query->max_num_pages;
    $numPosts = $wp_query->$found_posts;
 		$paged = ( get_query_var('paged') > 1 ) ? get_query_var('paged') : 1;
 		
 		// Add some parameters for the JS.
 		wp_localize_script(
 			'pcode-load-posts',
 			'pcode',
 			array(
 				'startPage' => $paged,
 				'maxPages' => $max,
        'numPosts' => $numPosts,
 				'nextLink' => next_posts($max, false)
 			)
 		);
 	}
 }
开发者ID:nvminhtu,项目名称:Wordpress_plugin,代码行数:43,代码来源:pbd-ajax-load-posts.php

示例14: wp_load_more_posts_init

function wp_load_more_posts_init()
{
    global $wp_query;
    // Add code to index and archive pages.
    if (is_home() || is_archive() || is_tax()) {
        // Queue JS and CSS
        wp_enqueue_script('wp-load-more-posts-js', plugin_dir_url(__FILE__) . 'library/js/load-more.js', array('jquery'), '1.0');
        // What page are we on?
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        // How many pages of posts do we have to display?
        $max = $wp_query->max_num_pages;
        // Here we set values from the plugin options page
        $content_selector = wp_lmp_get_option('content_selector');
        $post_class_selector = wp_lmp_get_option('post_class_selector');
        $pager_selector = wp_lmp_get_option('pager_selector');
        $btn_class = wp_lmp_get_option('btn_class');
        $load_more_text = wp_lmp_get_option('load_more_text');
        $loading_text = wp_lmp_get_option('loading_text');
        $no_posts_text = wp_lmp_get_option('no_posts_text');
        // Add some parameters for the JS.
        wp_localize_script('wp-load-more-posts-js', 'wpLoadMorePosts', array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false), 'contentSelector' => sanitize_text_field($content_selector), 'postClassSelector' => sanitize_text_field($post_class_selector), 'pagerSelector' => sanitize_text_field($pager_selector), 'btnClass' => sanitize_html_class($btn_class), 'loadMoreText' => esc_html($load_more_text), 'loadingText' => esc_html($loading_text), 'noPostsText' => esc_html($no_posts_text)));
    }
}
开发者ID:RachelleLortie,项目名称:transitapp,代码行数:23,代码来源:wp-load-more-posts.php

示例15: tm_alp_init

function tm_alp_init()
{
    global $wp_query;
    $num_page = 0;
    // Add code to index pages.
    if (!is_singular() || is_page_template('page-templates/tpl-video-listing.php') || is_page_template('page-templates/tpl-blog-listing.php')) {
        // Queue JS and CSS
        wp_enqueue_script('pbd-alp-load-posts', plugin_dir_url(__FILE__) . 'js/load-posts.js', array('jquery'), '1.0', true);
        wp_enqueue_style('pbd-alp-style', plugin_dir_url(__FILE__) . 'css/style.css', false, '1.0', 'all');
        // What page are we on? And what is the pages limit?
        if (is_page_template('page-templates/tpl-video-listing.php')) {
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
            $args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => $paged, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-video'), 'operator' => 'IN')));
            $listing_query = new WP_Query($args);
            $num_page = $listing_query->max_num_pages;
        }
        if (is_page_template('page-templates/tpl-blog-listing.php')) {
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
            $args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => $paged, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-video'), 'operator' => 'NOT IN')));
            $listing_query = new WP_Query($args);
            $num_page = $listing_query->max_num_pages;
        }
        if ($num_page != 0) {
            $max = $num_page;
        } else {
            $max = $wp_query->max_num_pages;
        }
        $q_v = get_template_directory_uri() . '/js/colorbox/jquery.colorbox-min.js';
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        $text_lb1 = __('MORE', 'cactusthemes');
        $text_lb2 = __('LOADING POSTS', 'cactusthemes');
        // Add some parameters for the JS.
        $ot_permali = get_option('permalink_structure');
        wp_localize_script('pbd-alp-load-posts', 'pbd_alp', array('startPage' => $paged, 'maxPages' => $max, 'textLb1' => $text_lb1, 'textLb2' => $text_lb2, 'ot_permali' => $ot_permali, 'nextLink' => next_posts($max, false), 'quick_view' => $q_v));
    }
}
开发者ID:aljeicks,项目名称:streamtube,代码行数:36,代码来源:tm-ajax-load-posts.php


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