WordPress.org

Support

Support » Plugins and Hacks » Addon plugin to only display first X rows on certain pages

Addon plugin to only display first X rows on certain pages

  • lsommerer
    Member

    @lsommerer

    Thanks for such a useful plugin. I needed to only display the first X rows of some CSV files on certain pages of my site, and your excellent documentation made it easy for me to adapt one of your example helper plugins. I’ll paste the plugin below just in case anyone else needs to do this. You can see it in action here.

    <?php
    /**
     * Plugin Name: CSV to SortTable: Fewer Rows
     * Plugin URI: https://gist.github.com/sscovil/5919960
     * Description: Only display the first X rows on tables created by CSV to SortTable plugin.
     * Version: 0.1
     * Author: lsommerer
     * Author URI: http://lloydandlauren.com
     * License: GPL2
     */
    
    /**
     * CSV to SortTable: Fewer Rows
     *
     * @param  array $data
     * @return array
     */
    function csv_to_sorttable_fewer_rows( $data ) {
    	if ( is_page( 'home' ) ) {
    		$data = array_slice($data, 0, 6);
    	}
        return $data;
    }
    add_filter( 'csv_to_sorttable_data_array', 'csv_to_sorttable_fewer_rows' );

    http://wordpress.org/plugins/csv-to-sorttable/

  • The topic ‘Addon plugin to only display first X rows on certain pages’ is closed to new replies.