Example #1
0
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)));
    }
}
 /**
  * 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);
 }
Example #3
0
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');
}
Example #4
0
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>';
    }
}
/**
 * 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)));
    }
}
/**
 * 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)));
    }
}
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));
    }
}
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');
}
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)));
}
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)));
    }
}
/**
 * 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)));
    }
}
Example #12
0
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);
        }
    }
}
 /**
  * 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)
 			)
 		);
 	}
 }
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)));
    }
}
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));
    }
}
function next_posts_link($label = 'Next Page &raquo;', $max_page = 0)
{
    global $paged, $wp_query;
    if (!$max_page) {
        $max_page = $wp_query->max_num_pages;
    }
    if (!$paged) {
        $paged = 1;
    }
    $nextpage = intval($paged) + 1;
    if (!is_single() && (empty($paged) || $nextpage <= $max_page)) {
        echo '<a href="';
        next_posts($max_page);
        echo '">' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) . '</a>';
    }
}
Example #17
0
function mpcth_load_more_hook($query, $type = 'blog', $custom = array())
{
    global $mpcth_settings;
    wp_enqueue_script('mpcth-isotope', MPC_THEME_ROOT . '/mpc-wp-boilerplate/js/mpcth-isotope.js', array('jquery'), '1.0');
    $paginationInfo = array('max_pages' => $query->max_num_pages, 'posts_count' => $query->found_posts, 'posts_per_page' => $query->post_count, 'post_type' => $type == 'blog' ? 'post' : $type, 'page' => mpcth_get_paged(), 'next_page_link' => next_posts($query->max_num_pages, false), 'path' => MPC_THEME_ROOT, 'loading_text' => __('Loading...', 'mpcth'), 'load_more_text' => __('Load More', 'mpcth'), 'blog_type' => $mpcth_settings[$type . 'Type'], 'blog_post_columns_number' => $mpcth_settings[$type . 'ColumnsNumber'], 'mpcth_settings' => $mpcth_settings);
    $paginationInfo['custom'] = array();
    if (!empty($custom)) {
        foreach ($custom as $key => $value) {
            $paginationInfo['custom'][$key] = $value;
        }
    }
    wp_localize_script('mpcth-isotope', 'paginationInfo', $paginationInfo);
}
Example #18
0
		<div class="span4 side-right-cont sidebar-blog progressive">
			<div class="sidebar-cont">
				<div class="entry-cont">
					<?php dynamic_sidebar('sidebar-primary'); ?>
				</div>
				<div class="clearfix"></div>
			</div>
		</div>
	</div>

<?php } ?>
<?php if ($wp_query->max_num_pages > 1) : ?>
  <div class="load-more inside hvr progressive">
   	<div class="entry-text-cont">
   		<?php get_next_posts_link(); ?>
  		<a href="#" data-pages="<?php echo $wp_query->max_num_pages; ?>" data-page="<?php echo $paged; ?>" data-link="<?php echo next_posts($wp_query->max_num_pages, false); ?>">More Items...</a>
   	</div>
  </div>
<?php endif; ?>

<?php if (!is_home()) { ?>
<style media="screen" type="text/css">

.isotope-item:nth-child(3) .entry-text-cont{
 display:block !important;
}

</style>

<?php } ?>
			</div>
		</div>

		<?php 
if ($blog_pagination == 'infinite_scroll_blog_pagination') {
    ?>
		
		<div class="infinite-scroll">
			<span class="preloader"></span>
			<p class="end"><?php 
    _e('No More Posts', AZ_THEME_NAME);
    ?>
</p>
			<a id="infinite-link" href="<?php 
    echo next_posts(0, false);
    ?>
"><?php 
    _e('Load More Posts', AZ_THEME_NAME);
    ?>
</a>
		</div>

		<?php 
} else {
    echo az_normal_pagination();
}
?>


	</section>
Example #20
0
function ep_Load_Posts_Init()
{
    // Add some parameters for the JS - blog load more .
    $queryArgsPost = array('post_type' => 'post');
    $query = new WP_Query($queryArgsPost);
    $max = $query->max_num_pages;
    $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
    wp_localize_script('ep_custom', 'paged_data', array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false), 'loadingText' => __('Loading...', 'epicomedia'), 'loadMoreText' => __('More posts', 'epicomedia'), 'noMorePostsText' => __('No More Posts', 'epicomedia')));
    wp_reset_postdata();
}
Example #21
0
/**
 * Add search pagination
 *
 * @uses	paginate_links()
 * @uses	add_query_arg()
 *
 * @since 1.0.0
 */
function bavotasan_search_pagination($query)
{
    $max_page = $query->max_num_pages;
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $type = isset($query->query['post_type']) ? $query->query['post_type'] : 'post';
    $prev_search_post_type = 2 == $paged ? '' : '&#038;search_post_type=' . esc_attr($type);
    $next_post_link = str_replace('&#038;search_post_type=' . esc_attr($type), '', next_posts($max_page, false));
    $prev_post_link = str_replace('&#038;search_post_type=' . esc_attr($type), '', previous_posts(false));
    $prev_label = 2 == $paged ? __('All results &rarr;', 'tienda') : sprintf(__('Next %s results &rarr;', 'tienda'), ucfirst($type . 's'));
    // Don't print empty markup if there's only one page.
    if ($max_page < 2) {
        return;
    }
    $next_posts_link = intval($paged) + 1 <= $max_page ? '<a href="' . esc_url($next_post_link) . '&#038;search_post_type=' . esc_attr($type) . '">' . sprintf(__('&larr; Previous %s results', 'tienda'), ucfirst($type . 's')) . '</a>' : '';
    $prev_posts_link = $paged > 1 ? '<a href="' . esc_url($prev_post_link) . $prev_search_post_type . '">' . $prev_label . '</a>' : '';
    ?>

	<nav class="navigation clearfix" role="navigation">
		<h1 class="sr-only"><?php 
    _e('Posts navigation', 'tienda');
    ?>
</h1>
		<?php 
    if ($next_posts_link) {
        ?>
		<div class="nav-previous"><?php 
        echo $next_posts_link;
        ?>
</div>
		<?php 
    }
    ?>

		<?php 
    if ($prev_posts_link) {
        ?>
		<div class="nav-next"><?php 
        echo $prev_posts_link;
        ?>
</div>
		<?php 
    }
    ?>
	</nav><!-- .navigation -->
	<?php 
    wp_reset_query();
}
			<div class="paging-nav col-xs-12">
							<span class="float-left <?php 
echo $query->max_num_pages > 1 && $paged < $query->max_num_pages ? "" : "paging-disabled";
?>
">
								<span class="paging-inline">
									<a <?php 
print $query->max_num_pages > 1 && $paged < $query->max_num_pages ? 'href="' . next_posts($query->max_num_pages, false) . '"' : "";
?>
 class="btn-arrow">
										<i class="icon-left-open-big"></i>
									</a> 
								</span>
								<span class="paging-text paging-inline">
									<a <?php 
print $query->max_num_pages > 1 && $paged < $query->max_num_pages ? 'href="' . next_posts($query->max_num_pages, false) . '"' : "";
?>
><?php 
_e('Older Post', 'Krypton');
?>
</a>
								</span>
							</span>
							<span class="float-right <?php 
echo $paged > 1 ? "" : "paging-disabled";
?>
">
			
								<span class="paging-text paging-inline">
									<a <?php 
print $paged > 1 ? 'href="' . previous_posts(false) . '"' : "";
Example #23
0
/**
 * Echo posts pagination.
 *
 * @since 1.0.0
 */
function beans_posts_pagination()
{
    /**
     * Filter whether {@see beans_posts_pagination()} should be short-circuit or not.
     *
     * @since 1.0.0
     *
     * @param bool $pre True to short-circuit, False to let the function run.
     */
    if (apply_filters('beans_pre_post_pagination', is_singular())) {
        return;
    }
    global $wp_query;
    if ($wp_query->max_num_pages <= 1) {
        return;
    }
    $current = get_query_var('paged') ? absint(get_query_var('paged')) : 1;
    $count = intval($wp_query->max_num_pages);
    beans_open_markup_e('beans_posts_pagination', 'ul', array('class' => 'uk-pagination uk-grid-margin', 'role' => 'navigation'));
    // Previous.
    if (get_previous_posts_link()) {
        beans_open_markup_e('beans_posts_pagination_item[_previous]', 'li');
        beans_open_markup_e('beans_previous_link[_posts_pagination]', 'a', array('href' => previous_posts(false)), $current);
        beans_open_markup_e('beans_previous_icon[_posts_pagination]', 'i', array('class' => 'uk-icon-angle-double-left uk-margin-small-right'));
        beans_close_markup_e('beans_previous_icon[_posts_pagination]', 'i');
        beans_output_e('beans_previous_text[_posts_pagination]', __('Previous', 'tm-beans'));
        beans_close_markup_e('beans_previous_link[_posts_pagination]', 'a');
        beans_close_markup_e('beans_posts_pagination_item[_previous]', 'li');
    }
    // Links.
    foreach (range(1, $wp_query->max_num_pages) as $link) {
        // Skip if next is set.
        if (isset($next) && $link != $next) {
            continue;
        } else {
            $next = $link + 1;
        }
        $is_separator = array(1 != $link, 1 == $current && 3 == $link ? false : true, $count > 3, $count != $link, $current - 1 != $link, $current != $link, $current + 1 != $link);
        // Separator.
        if (!in_array(false, $is_separator)) {
            beans_open_markup_e('beans_posts_pagination_item[_separator]', 'li');
            beans_output_e('beans_posts_pagination_item_separator_text', '...');
            beans_close_markup_e('beans_posts_pagination_item[_separator]', 'li');
            // Jump.
            if ($link < $current) {
                $next = $current - 1;
            } elseif ($link > $current) {
                $next = $count;
            }
            continue;
        }
        // Integer.
        if ($link == $current) {
            beans_open_markup_e('beans_posts_pagination_item[_active]', 'li', array('class' => 'uk-active'));
            beans_open_markup_e('beans_posts_pagination_item[_active]_wrap', 'span');
            beans_output_e('beans_posts_pagination_item[_active]_text', $link);
            beans_close_markup_e('beans_posts_pagination_item[_active]_wrap', 'span');
            beans_close_markup_e('beans_posts_pagination_item[_active]', 'li');
        } else {
            beans_open_markup_e('beans_posts_pagination_item', 'li');
            beans_open_markup_e('beans_posts_pagination_item_link', 'a', array('href' => get_pagenum_link($link)), $link);
            beans_output_e('beans_posts_pagination_item_link_text', $link);
            beans_close_markup_e('beans_posts_pagination_item_link', 'a');
            beans_close_markup_e('beans_posts_pagination_item', 'li');
        }
    }
    // Next.
    if (get_next_posts_link()) {
        beans_open_markup_e('beans_posts_pagination_item[_next]', 'li');
        beans_open_markup_e('beans_next_link[_posts_pagination]', 'a', array('href' => next_posts($count, false)), $current);
        beans_output_e('beans_next_text[_posts_pagination]', __('Next', 'tm-beans'));
        beans_open_markup_e('beans_next_icon[_posts_pagination]', 'i', array('class' => 'uk-icon-angle-double-right uk-margin-small-left'));
        beans_close_markup_e('beans_next_icon[_posts_pagination]', 'i');
        beans_close_markup_e('beans_next_link[_posts_pagination]', 'a');
        beans_close_markup_e('beans_posts_pagination_item[_next]', 'li');
    }
    beans_close_markup_e('beans_posts_pagination', 'ul');
}
Example #24
0
 /**
  * Get portfolio objects for portfolio module
  *
  * @param array  arguments that affect et_pb_portfolio query
  * @param array  passed conditional tag for update process
  * @param array  passed current page params
  * @return array portfolio item data
  */
 static function get_portfolio_item($args = array(), $conditional_tags = array(), $current_page = array())
 {
     $defaults = array('posts_number' => 10, 'include_categories' => 0, 'fullwidth' => 'on');
     $args = wp_parse_args($args, $defaults);
     // Native conditional tag only works on page load. Data update needs $conditional_tags data
     $is_front_page = et_fb_conditional_tag('is_front_page', $conditional_tags);
     $is_search = et_fb_conditional_tag('is_search', $conditional_tags);
     // Prepare query arguments
     $query_args = array('posts_per_page' => (int) $args['posts_number'], 'post_type' => 'project', 'post_status' => 'publish');
     // Conditionally get paged data
     if (defined('DOING_AJAX') && isset($current_page['paged'])) {
         $et_paged = intval($current_page['paged']);
     } else {
         $et_paged = $is_front_page ? get_query_var('page') : get_query_var('paged');
     }
     if ($is_front_page) {
         $paged = $et_paged;
     }
     if (!is_search()) {
         $query_args['paged'] = $et_paged;
     }
     // Passed categories parameter
     if ('' !== $args['include_categories']) {
         $query_args['tax_query'] = array(array('taxonomy' => 'project_category', 'field' => 'id', 'terms' => explode(',', $args['include_categories']), 'operator' => 'IN'));
     }
     // Get portfolio query
     $query = new WP_Query($query_args);
     // Format portfolio output, and add supplementary data
     $width = 'on' === $args['fullwidth'] ? 1080 : 400;
     $width = (int) apply_filters('et_pb_portfolio_image_width', $width);
     $height = 'on' === $args['fullwidth'] ? 9999 : 284;
     $height = (int) apply_filters('et_pb_portfolio_image_height', $height);
     $classtext = 'on' === $args['fullwidth'] ? 'et_pb_post_main_image' : '';
     $titletext = get_the_title();
     // Loop portfolio item data and add supplementary data
     if ($query->have_posts()) {
         $post_index = 0;
         while ($query->have_posts()) {
             $query->the_post();
             $categories = array();
             $categories_object = get_the_terms(get_the_ID(), 'project_category');
             if (!empty($categories_object)) {
                 foreach ($categories_object as $category) {
                     $categories[] = array('id' => $category->term_id, 'label' => $category->name, 'permalink' => get_term_link($category));
                 }
             }
             // Get thumbnail
             $thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
             // Append value to query post
             $query->posts[$post_index]->post_permalink = get_permalink();
             $query->posts[$post_index]->post_thumbnail = print_thumbnail($thumbnail['thumb'], $thumbnail['use_timthumb'], $titletext, $width, $height, '', false, true);
             $query->posts[$post_index]->post_categories = $categories;
             $query->posts[$post_index]->post_class_name = get_post_class('', get_the_ID());
             $post_index++;
         }
         $query->posts_next = array('label' => esc_html__('&laquo; Older Entries', 'et_builder'), 'url' => next_posts($query->max_num_pages, false));
         $query->posts_prev = array('label' => esc_html__('Next Entries &raquo;', 'et_builder'), 'url' => $et_paged > 1 ? previous_posts(false) : '');
         // Added wp_pagenavi support
         $query->wp_pagenavi = function_exists('wp_pagenavi') ? wp_pagenavi(array('query' => $query, 'echo' => false)) : false;
     }
     wp_reset_postdata();
     return $query;
 }
Example #25
0
		<?php 
    get_template_part('inc/loop/notfound');
    ?>
	<?php 
}
?>
</section>
<?php 
if (get_next_posts_link() || get_previous_posts_link()) {
    ?>
<div class="blog_nav row no-padding">
	<?php 
    if (get_next_posts_link()) {
        ?>
		<a href="<?php 
        echo next_posts();
        ?>
" class="next"><?php 
        _e('Older', THB_THEME_NAME);
        ?>
</a>
	<?php 
    }
    ?>

	<?php 
    if (get_previous_posts_link()) {
        ?>
		<a href="<?php 
        echo previous_posts();
        ?>
Example #26
0
/**
 * Description here.
 *
 * @see get_next_posts_link
 */
function dt_get_next_posts_link($label = null, $max_page = 0, $attr = '')
{
    global $paged, $wp_query;
    if (!$max_page) {
        $max_page = $wp_query->max_num_pages;
    }
    if (!$paged) {
        $paged = 1;
    }
    $nextpage = intval($paged) + 1;
    if (null === $label) {
        $label = '';
    }
    if (!is_single() && $nextpage <= $max_page) {
        $attr = apply_filters('dt_next_posts_link_attributes', $attr, $nextpage, $max_page);
        return '<a href="' . next_posts($max_page, false) . "\" {$attr}>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
    }
    return '';
}
Example #27
0
/**
 * Get next post url.
 *
 */
function dt_get_next_posts_url( $max_page = 0 ) {
	global $paged, $wp_query;

	if( !$paged = intval(get_query_var('page'))) {
		$paged = intval(get_query_var('paged'));
	}

	if ( !$max_page ) {
		$max_page = $wp_query->max_num_pages;
	}

	if ( !$paged ) {
		$paged = 1;
	}

	$nextpage = intval($paged) + 1;

	if ( !is_single() && ( $nextpage <= $max_page ) ) {
		return next_posts( $max_page, false );
	}

	return false;
}
function next_posts_link($label = 'Next Page &raquo;', $max_page = 0)
{
    global $p, $paged, $result, $request, $posts_per_page, $what_to_show, $wpdb, $wp_id;
    if ($what_to_show == 'paged') {
        if (!$max_page) {
            $nxt_request = $request;
            //if the query includes a limit clause, call it again without that
            //limit clause!
            if ($pos = strpos(strtoupper($request), 'LIMIT')) {
                $nxt_request = substr($request, 0, $pos);
            }
            $nxt_result = $wpdb->query($nxt_request);
            $numposts = $wpdb->num_rows;
            $max_page = ceil($numposts / $posts_per_page);
        }
        if (!$paged) {
            $paged = 1;
        }
        $nextpage = intval($paged) + 1;
        if (empty($p) && (empty($paged) || $nextpage <= $max_page)) {
            echo '<a href="';
            next_posts($max_page);
            echo '">' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) . '</a>';
        }
    }
}
Example #29
0
/**
 * Return the next posts page link.
 *
 * @since 2.7.0
 *
 * @global int      $paged
 * @global WP_Query $wp_query
 *
 * @param string $label    Content for link text.
 * @param int    $max_page Optional. Max pages.
 * @return string|void HTML-formatted next posts page link.
 */
function get_next_posts_link($label = null, $max_page = 0)
{
    global $paged, $wp_query;
    if (!$max_page) {
        $max_page = $wp_query->max_num_pages;
    }
    if (!$paged) {
        $paged = 1;
    }
    $nextpage = intval($paged) + 1;
    if (null === $label) {
        $label = __('Next Page &raquo;');
    }
    if (!is_single() && $nextpage <= $max_page) {
        /**
         * Filter the anchor tag attributes for the next posts page link.
         *
         * @since 2.7.0
         *
         * @param string $attributes Attributes for the anchor tag.
         */
        $attr = apply_filters('next_posts_link_attributes', '');
        return '<a href="' . next_posts($max_page, false) . "\" {$attr}>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
    }
}
Example #30
0
function mts_load_footer_scripts()
{
    $mts_options = get_option(MTS_THEME_NAME);
    // Parallax pages and posts
    if (is_singular()) {
        if (basename(mts_get_post_template()) == 'singlepost-parallax.php' || basename(get_page_template()) == 'page-parallax.php') {
            wp_register_script('jquery-parallax', get_template_directory_uri() . '/js/parallax.js');
            wp_enqueue_script('jquery-parallax');
        }
    }
    //Lightbox
    if (!empty($mts_options['mts_lightbox'])) {
        wp_register_script('prettyPhoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', true);
        wp_enqueue_script('prettyPhoto');
    }
    //Sticky Nav
    if (!empty($mts_options['mts_sticky_nav'])) {
        wp_register_script('StickyNav', get_template_directory_uri() . '/js/sticky.js', true);
        wp_enqueue_script('StickyNav');
    }
    // Ajax Load More and Search Results
    wp_register_script('mts_ajax', get_template_directory_uri() . '/js/ajax.js', true);
    if (!empty($mts_options['mts_pagenavigation_type']) && $mts_options['mts_pagenavigation_type'] >= 2 && !is_singular()) {
        wp_enqueue_script('mts_ajax');
        wp_register_script('historyjs', get_template_directory_uri() . '/js/history.js', true);
        wp_enqueue_script('historyjs');
        // Add parameters for the JS
        global $wp_query;
        $max = $wp_query->max_num_pages;
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        $autoload = $mts_options['mts_pagenavigation_type'] == 3;
        wp_localize_script('mts_ajax', 'mts_ajax_loadposts', array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false), 'autoLoad' => $autoload, 'i18n_loadmore' => __('Load More', 'mythemeshop'), 'i18n_loading' => __('Loading...', 'mythemeshop'), 'i18n_nomore' => __('No more posts.', 'mythemeshop')));
    }
    if (!empty($mts_options['mts_ajax_search'])) {
        wp_enqueue_script('mts_ajax');
        wp_localize_script('mts_ajax', 'mts_ajax_search', array('url' => admin_url('admin-ajax.php'), 'ajax_search' => '1'));
    }
}