Plugin Directory

Changeset 1453562


Ignore:
Timestamp:
07/12/2016 03:37:33 PM (10 years ago)
Author:
sachin8600
Message:

add pagination and code grid theme

Location:
post-shortcode
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • post-shortcode/trunk/inc/pcs-menu.php

    r1430941 r1453562  
    9494                    }
    9595                }
     96                if( isset($_POST['pagedvar']) && !empty($_POST['pagedvar'])){
     97                    $shortcode .= " pagedvar='".$_POST['pagedvar']."'";
     98                }
    9699                $shortcode .= "]";
    97100                echo "<h3>Generated Shortcode :</h3><textarea readonly class='pcs-ta'>". $shortcode."</textarea>";
     
    150153/* pcs style for Grid Widget Style as gws and Inverse Grid Widget Style as igws*/
    151154
    152 .gws .pcs-body,.igws .pcs-body{width: 100%;}
    153 .gws .pcs-img,.igws .pcs-img{width: 100%}
    154 
     155.gws .pcs-body,.igws .pcs-body,.gcore .pcs-body{width: 100%;}
     156.gws .pcs-img,.igws .pcs-img,.gcore .pcs-img{width: 100%}
     157
     158/* pcs style for pagination */
     159
     160.pcs-pagination{display: block;clear:both;overflow: hidden;}
     161.pcs-pagination ul {display: inline-block;padding: 0;margin: 10px 1px;border-radius: 50%;list-style-type: none;}
     162.pcs-pagination ul li {float: left}
     163.pcs-pagination ul li a,.pcs-pagination ul li span{float: left;padding: 10px 15px;line-height: 1.5;color: #0275d8;text-decoration: none;background-color: #fff;border: 1px solid #ddd;display: block;margin-left: -1px}
     164.pcs-pagination ul li a:hover,.pcs-pagination ul li span.current{background-color: #0275d8;color: #fff;}
    155165                <?php } ?></textarea>
    156166                <?php wp_nonce_field( $nonceval, 'nonce_of_pcs' ); ?>
     
    328338        <p class="submit">
    329339            <?php wp_nonce_field( $nonceval, 'nonce_of_pcs' ); ?>
     340            <input type="hidden" name="pagedvar" value="<?php echo uniqid(); ?>" />
    330341            <input type="submit" name="pcs-code" id="submit" class="button button-primary" value="Generate Shortcode">
    331342        </p>
  • post-shortcode/trunk/inc/pcs-shortcode.php

    r1430941 r1453562  
    2424        'post__not_in'          => '',
    2525        'post_name__in'         => '',
     26        'pagedvar'              => 'paged',
    2627    ), $atts );
    2728    if(function_exists('pcs_get_custom_post_output')){
     
    4950        $args['post_type'] = explode(",", 'post');
    5051    }
     52    $showfield = (isset($showfield) && !empty($showfield)) ? $showfield : "title,thumbnail,excerpt";
     53    $ashowfield =explode(",", $showfield);
    5154    $args['post_status'] = array( 'publish' );
    5255    $args['posts_per_page'] = (isset($postcount) && !empty($postcount)) ? $postcount : 3;
     
    5457    $taxrel = (isset($taxrel) && !empty($taxrel)) ? $taxrel : 'OR';
    5558    $args['paged'] = (int) $paged;
     59    $pagedvar = (isset($pagedvar) && !empty($pagedvar)) ? $pagedvar : "paged";
     60    if(in_array("pagination", $ashowfield)){
     61        $args['paged'] = 1;
     62        if(isset($_GET['pagedvar']) && $_GET['pagedvar'] == $pagedvar ){
     63            $args['paged'] =  ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
     64        }
     65    }
    5666    if(!empty($categories)):
    5767        $acat = explode(",", $categories);
     
    8393    $order = (isset($order) && !empty($order)) ? $order : "DESC";
    8494    $args['order']   = $order;
    85     $showfield = (isset($showfield) && !empty($showfield)) ? $showfield : "title,thumbnail,excerpt";
    86     $ashowfield =explode(",", $showfield);
    8795    $tsize = (isset($tsize) && !empty($tsize)) ? $tsize : "thumbnail";
    8896    $excerptl = (isset($excerptl) && !empty($excerptl)) ? $excerptl : 55;
     
    93101        }
    94102    }
    95    //print_r($args);
    96103    query_posts($args);
    97104    // The Loop
     
    185192        </div>
    186193        <?php
     194        /**
     195        * @version 2.0.7
     196        * pagination code for query post
     197        */
     198        if(in_array("pagination", $ashowfield)){ ?>
     199            <nav class="pcs-pagination pcs-reset" >
     200                <?php global $wp_query;
     201                $big = 999999999; // need an unlikely integer
     202                $asearch   = array( $big, '#038;' );
     203                $areplace = array( '%#%', '&' );
     204                echo paginate_links( array(
     205                    'base' => str_replace( $asearch, $areplace, esc_url( get_pagenum_link( $big ) ) ),
     206                    'format' => '?paged=%#%',
     207                    'current' => max( 1, get_query_var('paged') ),
     208                    'total' => $wp_query->max_num_pages,
     209                    'type' => 'list',
     210                    'prev_text' => '&laquo;',
     211                    'next_text' => '&raquo;',
     212                    'add_args' => array( "pagedvar" => $pagedvar),
     213                ) );
     214                ?>
     215            </nav>     
     216        <?php
     217        }
    187218    endif;
    188219    $output = ob_get_contents();
  • post-shortcode/trunk/inc/pcs-widget.php

    r1430941 r1453562  
    4747        if( isset($instance['paged']) && !empty($instance['paged']) ) $shortcode .= " paged='".$instance['paged']."'";
    4848        if( isset($instance['taxrel']) && !empty($instance['taxrel']) ) $shortcode .= " taxrel='".$instance['taxrel']."'";
     49        if( isset($instance['pagedvar']) && !empty($instance['pagedvar']) ) $shortcode .= " pagedvar='".$instance['pagedvar']."'";
    4950        /* old version support code upto 2.0.5 */
    5051        $readmoretitle = (isset($instance['readmoretitle']) && !empty($instance['readmoretitle'])) ? $instance['readmoretitle'] : "" ;
     
    100101        $paged =  (isset($instance['paged']) && ! empty( $instance['paged'] ) )? $instance['paged'] : 1;
    101102        $taxrel =  (isset($instance['taxrel']) && ! empty( $instance['taxrel'] ) )? $instance['taxrel'] : "OR";
     103        $pagedvar =  (isset($instance['pagedvar']) && ! empty( $instance['pagedvar'] ) )? $instance['pagedvar'] : "";
    102104
    103105        foreach ($aft as $aftvalue => $aftkey ) {
     
    275277            });
    276278        </script>
     279        <input class="widefat" id="<?php echo $this->get_field_id( 'pagedvar' ); ?>" name="<?php echo $this->get_field_name( 'pagedvar' ); ?>" type="hidden" value="<?php if(!empty($pagedvar)){ echo esc_attr( $pagedvar );}else{ echo uniqid();} ?>">
    277280        <?php
    278281    }
     
    305308        $instance['paged'] = ( ! empty( $new_instance['paged'] ) ) ? strip_tags( $new_instance['paged'] ) : 1;
    306309        $instance['taxrel'] = ( ! empty( $new_instance['taxrel'] ) ) ? strip_tags( $new_instance['taxrel'] ) : 'OR';
     310        $instance['pagedvar'] = ( ! empty( $new_instance['pagedvar'] ) ) ? strip_tags( $new_instance['pagedvar'] ) : '';
    307311        foreach ($aft as $aftvalue => $aftkey ) {
    308312            if(isset($new_instance[$aftvalue]) && !empty($new_instance[$aftvalue])){
  • post-shortcode/trunk/post-shortcode.php

    r1430941 r1453562  
    44 * Plugin URI:
    55 * Description: This plugin is used for display posts in widget as well as shortcode.
    6  * Version: 2.0.6
     6 * Version: 2.0.7
    77 * Author: Sachin Jadhav
    88 * Author URI: http://sachin8600.wordpress.com/
    99 * Requires at least: 3.8
    10  * Tested up to: 4.5.2
     10 * Tested up to: 4.5.3
    1111 *
    1212 * Text Domain: pcs
     
    4545                            "rand"          => "Random order",
    4646                            "comment_count" => "Order by number of comments",
    47                             "menu_order"    => "Order by Page Order (menu_order) ",                         
     47                            "menu_order"    => "Order by page order (menu_order) ",                         
    4848                        );
    4949    /**
     
    5757                            "igws"  => "Inverse Grid Widget Style",
    5858                            "core"  => "Core Widget Style",
     59                            "gcore" => "Core Grid Widget Style",
    5960                        );
    6061    /**
     
    7273                            "readme"    => "Show read more link",
    7374                            "category"  => "Show post categories",
    74                             "tag"       => "Show post tags",                           
     75                            "tag"       => "Show post tags",           
     76                            "pagination" => "Show pagination"               
    7577                        );
    7678    /**
     
    198200        $this->define( 'PCS_IMG_URL',PCS_URL."images/" );
    199201        $this->define( 'PCS_VERSION', $this->version );
    200 
     202        // array of text field of post parameter
    201203        $this->aft['post_parent__in'] = __( 'Post Parent In ( eg: 10,1,89 ) :', 'pcs'  );
    202204        $this->aft['post_parent__not_in'] = __( 'Post Parent Not In ( eg: 10,1,89 ) :', 'pcs'  );
     
    204206        $this->aft['post__not_in'] = __( 'Post Not In ( eg: 10,1,89 ) :', 'pcs'  );
    205207        $this->aft['post_name__in'] = __( 'Post Name In ( eg: hello-world,sample-page ) :', 'pcs'  );
    206 
     208        // array of select field of related post
    207209        $this->ars['excerptl'] = __( 'Excerpt Length ( In words, eg: 55 ) :', 'pcs' );
    208210        $this->ars['readmoretitle'] = __( 'Read More Title ( eg: Read more ) :', 'pcs'  );
     
    278280                .iws a:hover,.igws a:hover{color: #fff !important;}
    279281                /* pcs style for gws nad igws*/
    280                 .gws .pcs-body,.igws .pcs-body{width: 100%;}
    281                 .gws .pcs-img,.igws .pcs-img{width: 100%}
     282                .gws .pcs-body,.igws .pcs-body,.gcore .pcs-body{width: 100%;}
     283                .gws .pcs-img,.igws .pcs-img,.gcore .pcs-img{width: 100%}
     284                /* pcs style for pagination */
     285                .pcs-pagination{display: block;clear:both;overflow: hidden;}
     286                .pcs-pagination ul {display: inline-block;padding: 0;margin: 10px 1px;border-radius: 50%;list-style-type: none;}
     287                .pcs-pagination ul li {float: left}
     288                .pcs-pagination ul li a,.pcs-pagination ul li span{float: left;padding: 10px 15px;line-height: 1.5;color: #0275d8;text-decoration: none;background-color: #fff;border: 1px solid #ddd;display: block;margin-left: -1px}
     289                .pcs-pagination ul li a:hover,.pcs-pagination ul li span.current{background-color: #0275d8;color: #fff;}
    282290            </style>
    283291            <?php
  • post-shortcode/trunk/readme.txt

    r1430941 r1453562  
    22Contributors: sachin8600
    33Donate link:
    4 Tags: posts, post, shortcode, widget, custom, taxonomy, pages, page, css, layout, recent, thumbnail, themes
     4Tags: posts, post, shortcode, widget, custom, taxonomy, pages, page, css, layout, recent, thumbnail, themes, pagination
    55Requires at least: 3.8
    6 Tested up to: 4.5.2
     6Tested up to: 4.5.3
    77Stable tag: trunk
    88License: GPLv2 or later
     
    2020Display post widget with selection tools ( like grid view or listing view )
    2121
    22 Customize display output without editing plugin
     22Customize plugin output using functions.php
    2323
    2424Display post as well as custome post type
     
    2626Display post with perticuler Taxonomy, Term, Category, Tag
    2727
    28 Display post with selection like: Title, Image, Category, Tag, Cutome Field, Excerpt, Read More
     28Display post with selection like: Title, Image, Category, Tag, Cutome Field, Excerpt, Read More, Pagination
    2929
    3030Easy to change plugin css from backend plugin page.
     
    4343*   "Requires at least" 3.8
    4444
    45 *   "Tested up to" 4.5.2
     45*   "Tested up to" 4.5.3
    4646
    4747
     
    9494= showfield =
    9595showfield=title,thumbnail,excerpt //default showfield
    96 other are: date,author,cc,content,readme,category,tag
     96other are: date,author,cc,content,readme,category,tag, pagination
    9797
    9898= excerptl =
    9999excerptl=55 //default excerpt length
    100100
    101 == readmoretitle ==
     101= readmoretitle =
    102102readmoretitle=Read more //Read more readmoretitle
    103103
     
    130130post_name__in= //default is empty
    131131
     132= pagedvar =
     133pagedvar= //default is paged, check uniqid().
     134
    132135== Screenshots ==
    133136
     
    137140
    138141== Changelog ==
     142
     143= 2.0.7 =
     144Adding pagination parameter in showfield, add core grid theme. (Note : if you change css from backend then please reset css for updating css. )
     145
    139146= 2.0.6 =
    140147Adding page parameters like post_parent__in, post_parent__not_in, post__in, post__not_in, post_name__in
     
    166173
    167174== Upgrade Notice ==
     175
     176= 2.0.7 =
     177Adding pagination parameter in showfield, add core grid theme. (Note : if you change css from backend then please reset css for updating css. )
     178
    168179= 2.0.6 =
    169180Adding page parameter like post_parent__in, post_parent__not_in, post__in, post__not_in, post_name__in
     
    176187Improve backend and add css edit option.
    177188
    178 = 2.0.3 =n
     189= 2.0.3 =
    179190Improve layout and css.
    180191
Note: See TracChangeset for help on using the changeset viewer.