Plugin Directory

Changeset 2281540


Ignore:
Timestamp:
04/11/2020 03:48:35 PM (6 years ago)
Author:
Knighthawk
Message:

fix: offset now works as expected. offset is for a starting offset value, also works internally with the pageination.

fix: typo - paginate is now spelled correctly. Backward compatible.

Location:
vi-include-post-by/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vi-include-post-by/trunk/readme.txt

    r2278601 r2281540  
    33Tags: get, params, shortcode, vars
    44Requires at least: 4.0
    5 Tested up to: 5.2.3
    6 Version: 0.4.200403
     5Tested up to: 5.4
     6Version: 0.4.200411
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    99
    10 Shortcodes allowing you to display any post basically anywhere... hopefully anywhere
    1110
    1211== Description ==
    1312
    14 Version 8 Plugin: Include Post By - provides your pages and posts with shortcodes allowing you to display other pages and posts inside them either by their ID or by category.
     13VI: Include Post By - provides your pages and posts with shortcodes allowing you to display other pages and posts inside them either by their ID or by post category. Options to display title,meta,content,thumbnail,excerpt,footer.
     14
     15== Coming Soon ==
     16
     17More display options. Bootstrap Cards option. Custom class names with a header/body/footer element.
    1518
    1619
    1720== Changelog ==
     21
     22= 0.4.200411 =
     23* Fixed: offset now works as expected.
     24* Was previously only working for pageination, it now works with both pageination AND a starting offset.
     25
    1826
    1927= 0.4.200403 =
  • vi-include-post-by/trunk/vi_include_post_by.php

    r2278601 r2281540  
    33Plugin Name: VI: Include Post By
    44Plugin URI: http://neathawk.com
    5 Description: A collection of shortcodes to include posts inside other posts, etc
    6 Version: 0.4.200403
     5Description: Ability to include posts inside other posts/pages, etc, with a shortcode.
     6Version: 0.4.200411
    77Author: Joseph Neathawk
    88Author URI: http://Neathawk.com
     
    5656        pageinate = true/false
    5757        perpage = items per page. -1 = all
    58         offset = how many to skip, useful if you are combining multiple of these
     58        offset = how many posts to skip, useful if you are combining multiple includes
    5959        display = from include-post-by-id
    6060        class= custom-class-name used in the internal element
     
    565565            }
    566566
    567             //offest
     567            //offest + offset_by_page
    568568            $page_current = 1;
    569             $offset = 0;
     569            $offset = intval($offset);
     570            $offset_by_page = 0;
    570571            if( isset( $_GET['pn'] ) && is_numeric( $_GET['pn'] ) )
    571572            {
    572573                $page_current = intval( $_GET['pn'] );
    573                 $offset = ( $page_current - 1 ) * $perpage;
    574                 if( $offset < 0 )
     574                $offset_by_page = ( $page_current - 1 ) * $perpage;
     575                if( $offset_by_page < 0 )
    575576                {
    576                     $offset = 0;
     577                    $offset_by_page = 0;
    577578                }
    578579            }
    579             else
    580             {
    581                 $page_current = 1;
    582             }
     580            $offset += $offset_by_page;
    583581
    584582            $class = sanitize_text_field( $class );
     
    590588            //count all posts
    591589            $post_count = 0;
    592             $transient_name = 'v8_' . md5( $intput_string ) . '_c';
     590            $transient_name = 'vi_' . md5( $intput_string ) . '_c';
    593591            if( false === ( $post_count = get_transient( $transient_name ) ) )
    594592            {
     
    607605            }
    608606            //get content for just the current page of posts
    609             $transient_name = 'v8_' . md5( $intput_string ) . '_' . $page_current;
     607            $transient_name = 'vi_' . md5( $intput_string ) . '_' . $page_current;
    610608            if( false === ( $post_array = get_transient( $transient_name ) ) )
    611609            {
Note: See TracChangeset for help on using the changeset viewer.