WordPress.org

Forums

CSV to SortTable
Addon plugin to only display first X rows on certain pages (1 post)

  1. lsommerer
    Member
    Posted 1 year ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • CSV to SortTable
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.