WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Prediction form pagination

[Resolved] Prediction form pagination

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author AntoineH
    Participant

    @antoineh

    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.

    @spinrag

    If you manage to make this work please share:)

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

    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)?

    Plugin Author AntoineH
    Participant

    @antoineh

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Prediction form pagination’ is closed to new replies.