%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/gachan/www/wp-content/themes/jekas/inc/
Upload File :
Create Path :
Current File : /home/gachan/www/wp-content/themes/jekas/inc/jekas_pagination.php

<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 3/08/15
 * Time: 15:14
 */

if(!function_exists('jekas_pagination')) {

    function jekas_pagination(){

        global $wp_query, $wp_rewrite;

        $total = func_num_args() > 0  ? func_get_arg(0) : $wp_query->max_num_pages;

        if ( $total < 2 ) {
            return;
        }

        $paged        = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;

        $pagenum_link = html_entity_decode( get_pagenum_link() );
        $query_args   = array();
        $url_parts    = explode( '?', $pagenum_link );

        if ( isset( $url_parts[1] ) ) {
            wp_parse_str( $url_parts[1], $query_args );
        }

        $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
        $pagenum_link = trailingslashit( $pagenum_link ) . '%_%';

        $format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
        $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';

        // Set up paginated links.
        $links = paginate_links( array(
            'base'     => $pagenum_link,
            'format'   => $format,
            'total'    => $total,
            'current'  => $paged,
            'mid_size' => 1,
            'add_args' => array_map( 'urlencode', $query_args ),
            'prev_text' =>  '&laquo;',
            'next_text' =>  '&raquo;',
            'type'    => 'array',

        ) );

        print '<ul class="pagination">'."\n\t";

        foreach($links as $page => $link){

            $active = ( ($paged == 1 && $page ==0) || ($paged > 1 && $page == $paged) ) ? 'active': '';

            print '<li class="'.$active.'">'.$link."</li>\n\t";

        }

        print "</ul>\n\t";

    }

}

if(!function_exists('jekas_comments_pagination')){

    function jekas_comments_pagination(){
    
         
    $max_page = func_num_args() > 0  ? func_get_arg(0) : get_comment_pages_count();
    
    $arg = array('total' => $max_page,'type' => 'array','echo' => false);
    
    
        // Set up paginated links.
        $links = paginate_comments_links($arg);

        print '<ul class="pagination">'."\n\t";

        foreach($links as $page => $link){

            $active = ( ($paged == 1 && $page ==0) || ($paged > 1 && $page == $paged) ) ? 'active': '';

            print '<li class="'.$active.'">'.$link."</li>\n\t";

        }

        print "</ul>\n\t";


    }
}

if(!function_exists('jekas_list_cats')){

    function jekas_list_cats($cat_name){

        return '<i class="fa fa-check"></i> '.$cat_name;
    }
}

add_filter('list_cats','jekas_list_cats');


if(!function_exists('jekas_archives_args')){

    function jekas_archives_args($arg){

        if(!isset($arg['before']))
            $arg['before'] = '<i class="fa fa-check"></i> ';

        return $arg;
    }
}

add_filter('widget_archives_args','jekas_archives_args');

Zerion Mini Shell 1.0