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

    (@antoineh)

    The shortcode table has an extra css class ‘shortcode’. Can you use that to hide the avatar?

    Thread Starter sillery4ever

    (@sillery4ever)

    NOTE : i have insatlled your plugin :

    * Plugin Name: Football Pool Avatars
    * Description: Football Pool extension: put the avatars back in the ranking.

    Thread Starter sillery4ever

    (@sillery4ever)

    my first problem was to diplsay avatar so i installed your plugin to show avatar.

    2nd problem it s i want only see avatar in main ranking page, not in ranking displayed by shortcode.

    Plugin Author AntoineH

    (@antoineh)

    Ah, the $type parameter that is passed to the hook contains a value of ‘page’ for the ranking page and ‘shortcode’ for the shortcode.

    You can differentiate the template with this variable.

    Thread Starter sillery4ever

    (@sillery4ever)

    sorry i dont understand what to do :

    here is the code of plugin :

    add_filter( ‘footballpool_ranking_ranking_row_template’, function( $template, $all_user_view, $type ) {
    if ( $all_user_view ) {
    $ranking_template = ‘<tr class=”%css_class%”>
    <td style=”width:3em; text-align: right;”>%rank%.</td>
    <td>%user_avatar%%user_name%</td>
    <td class=”ranking score”>%points%</td>
    <td>%league_image%</td>
    </tr>’;
    } else {
    $ranking_template = ‘<tr class=”%css_class%”>
    <td style=”width:3em; text-align: right;”>%rank%.</td>
    <td>%user_avatar%%user_name%</td>
    <td class=”ranking score”>%points%</td>
    </tr>’;
    }
    return $ranking_template;
    }, null, 3 );

    Plugin Author AntoineH

    (@antoineh)

    I know what the code for the extension plugin is. I wrote it 🙂
    Just add an extra if-statement to check for the $type variable. If it is equal to ‘shortcode’ then use the same code as above, but remove the %avatar% part.

    Thread Starter sillery4ever

    (@sillery4ever)

    sorry antoine, i dont know write php 🙁

    i will ask to my friend to do this, i understand but i dont knwo how to write it !

    TY

    Thread Starter sillery4ever

    (@sillery4ever)

    sorry antoine, i dont know write php 🙁

    i will ask to my friend to do this, i understand but i dont knwo how to write it !

    TY

    Plugin Author AntoineH

    (@antoineh)

    I think this will work (haven’t tested it).

    <?php
    /**
     * Plugin Name: Football Pool Avatars
     * Description: Football Pool extension: put the avatars back in the ranking.
     * Version: 1.0
     * Author: Antoine Hurkmans
     * Author URI: mailto:wordpressfootballpool@gmail.com
     * License: MIT
     */
    
    add_filter( "footballpool_ranking_ranking_row_template", function( $template, $all_user_view, $type ) {
    	$avatar = ( $type == "page" ) ? "%user_avatar%" : "";
    	if ( $all_user_view ) {
    		$ranking_template = "<tr class='%css_class%'>
    								<td style='width:3em; text-align: right;'>%rank%.</td>
    								<td><a href='%user_link%'>{$avatar}%user_name%</a></td>
    								<td class='ranking score'>%points%</td>
    								<td>%league_image%</td>
    								</tr>";
    	} else {
    		$ranking_template = "<tr class='%css_class%'>
    								<td style='width:3em; text-align: right;'>%rank%.</td>
    								<td><a href='%user_link%'>{$avatar}%user_name%</a></td>
    								<td class='ranking score'>%points%</td>
    								</tr>";
    	}
    	return $ranking_template;
    }, null, 3 );
    Thread Starter sillery4ever

    (@sillery4ever)

    you are THE KING

    Thank you !!!!

    Thread Starter sillery4ever

    (@sillery4ever)

    good

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘hide avatar only in shortcode ranking ?’ is closed to new replies.