WordPress.org

Forums

Football Pool
[resolved] Prediction form pagination (5 posts)

  1. Spinrag
    Member
    Posted 1 year ago #

    Hi there,

    I'm using the plugin for the prediction of the Dutch soccer competition. But after a few rounds, the list of predicted matches and matches to be predicted gets very long. Is there a way to paginate this?

    http://wordpress.org/plugins/football-pool/

  2. AntoineH
    Member
    Plugin Author

    Posted 1 year ago #

    There's no built in pagination for these pages. But there are some things you can do:

    1. Don't use the built in pages, but make your own pages with the shortcodes for the prediction form and/or the predictions. That way you can show what you want.
    2. Wait for the next release (v2.3.6). That release will have some hooks (filters and actions) that can be used to alter the behavior of several parts of the plugin. There is already a pagination class in the plugin that handles basic pagination; this class can be used in the hooks. But this requires some PHP knowledge.
    3. Group matches in match types and hide those match types (match types have a visibility option) when all matches are finished/no longer relevant.
    4. Hide closed matches via jQuery (this is a bit ugly because the entire set is still send to the visitor).

    Hope this helps.

  3. Joepiooo
    Member
    Posted 1 year ago #

    @Spinrag

    If you manage to make this work please share:)

    I really want to paginate the ranking page but no luck so far..

  4. Spinrag
    Member
    Posted 1 year ago #

    I don't have the expertise to build this.

    Isn't it possible to display only the games to predict on the prediction page (and hide the games the games in the past)?

  5. AntoineH
    Member
    Plugin Author

    Posted 1 year ago #

    I found a jQuery code snippet I made for another user some time ago. This jQuery hides the closed matches:

    // jQuery function to hide closed matches on the prediction form
    
    jQuery( document ).ready( function() {
    	// iterate through all input forms
    	jQuery( 'table.matchinfo.input' ).each( function() {
    		var matchtype_row, matchdate_row;
    		var matchtype_closed = true, matchdate_closed = true;
    		// iterate through all the rows
    		jQuery( this ).find( 'tr' ).each( function() {
    			row = jQuery( this );
    			if ( row.hasClass( 'closed' ) ) {
    				row.hide();
    				matchdate_closed = true;
    			} else if ( row.hasClass( 'open' ) ) {
    				matchdate_closed = false;
    				matchtype_closed = false;
    			} else if ( row.find( 'td:first' ).hasClass( 'matchtype' ) ) {
    				if ( matchtype_closed && matchtype_row ) matchtype_row.hide();
    				matchtype_row = row;
    				matchtype_closed = true;
    			} else if ( row.find( 'td:first' ).hasClass( 'matchdate' ) ) {
    				if ( matchdate_closed && matchdate_row ) matchdate_row.hide();
    				matchdate_row = row;
    				matchdate_closed = true;
    			}
    		} );
    		if ( matchtype_closed && matchtype_row ) matchtype_row.hide();
    		if ( matchdate_closed && matchdate_row ) matchdate_row.hide();
    	} );
    } );

    As mentioned above, a more elegant approach will be possible in release v2.3.6. I'll add an example in the help file for this release.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Football Pool
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.