• Resolved JD85

    (@jd85)


    On our website we have the player list set up to be organised by position but this sorts in from A-Z.

    For American Football, we need to be able to group players together based on their position but also decide the order in which the positions are listed.

    If you visit our website page here http://www.oxfordsaints.com/roster/, you will see that it begins with the position ‘Cornerback’ then ‘Defensive Lineman’ etc.

    Is there a way we can determine which order they are displayed in? To make it fit for purpose, we would need to have all the ‘offensive’ positions grouped together and then all the ‘defensive’ positions grouped together.

    If the functionality does not exist, this would be a worthwhile improvement so users can have better control over the layout of their player lists.

    https://wordpress.org/plugins/sportspress/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Roch

    (@rochesterj)

    Hi!

    We could do that with a JS adjustment, so that won’t be easily managed. If that’s ok for you, please let me know the exact order you need for those pages.

    Kind Regards,
    -Roch

    Thread Starter JD85

    (@jd85)

    Thanks Roch that would be a great help.

    The ideal ordering is as below.

    Quarterback
    Running back
    Full back
    Wide receiver
    Tight end
    Center
    Offensive Guard
    Offensive Tackle
    Offensive Lineman

    Middle Linebacker
    Outside Linebacker
    Corner back
    Safety
    Defensive tackle
    Defensive end
    Defensive Lineman

    Plugin Contributor Roch

    (@rochesterj)

    Hi!

    Some are missing from your page, but I’ve created a function to handle this quite neatly so you can even add custom order for different pages.

    Please add this plugin https://wordpress.org/plugins/custom-code/ , then add this code in it and let us know how it works:

    <script>
    jQuery(window).load(function(){
    setTimeout( function() {
    
    var sections = jQuery('.page-id-239 .entry-content .sportspress section'), parent = jQuery('.page-id-239 .entry-content .sportspress'), bkp = '';
    
    bkp = sections;
    
    sections.remove();
    
    bkp.eq(6).appendTo(parent);
    bkp.eq(7).appendTo(parent);
    bkp.eq(2).appendTo(parent);
    bkp.eq(10).appendTo(parent);
    bkp.eq(9).appendTo(parent);
    bkp.eq(4).appendTo(parent);
    bkp.eq(3).appendTo(parent);
    bkp.eq(5).appendTo(parent);
    bkp.eq(0).appendTo(parent);
    bkp.eq(8).appendTo(parent);
    bkp.eq(1).appendTo(parent);
    
    /*
    Current list:
    1. Cornerback
    2. Defensive Lineman
    3. Full Back
    4. Middle Linebacker
    5. Offensive Lineman
    6. Outside Linebacker
    7. Quarterback
    8. Running back
    9. Safety
    10. Tight end
    11. Wide receiver
    
    Desired:
    1. Quarterback
    2. Running back
    3. Full back
    4. Wide receiver
    5. Tight end
    6. Center
    7. Offensive Guard
    8. Offensive Tackle
    9. Offensive Lineman
    10. Middle Linebacker
    11. Outside Linebacker
    12. Corner back
    13. Safety
    14. Defensive tackle
    15. Defensive end
    16. Defensive Lineman
    
    */
    
    }, 500);
    });
    </script>

    Kind Regards,
    -Roch

    Thread Starter JD85

    (@jd85)

    So having a little trouble using this as i can’t seem to get my player list shortcode [player_list 583] to display on any page properly.

    My work around has been to have a direct link on my website’s menu taking the user straight to the player list – http://www.oxfordsaints.com/list/2015-roster/

    Is it possible i tweak your custom code to work still? Though it seems like it relies on having a page ID to function correctly

    Plugin Contributor Roch

    (@rochesterj)

    Hi!

    Actually that code doesn’t need to be in one page to work. I just used this one as a reference: http://www.oxfordsaints.com/roster/ but can be added to any page or Sporspress generated page.

    But here I can see that the page is empty now, have you edited the JS code?

    Kind Regards,
    -Roch

    Thread Starter JD85

    (@jd85)

    Hi Roch

    The page does indeed blank but it shouldn’t do. When i edit the page, i can confirm that i have the shortcode [player_list 583] in the page so i’m expecting that player list to show, but it’s not. Any ideas why the player list is not displaying on http://www.oxfordsaints.com/roster/ even though the shortcode is present?

    The work around i currently have is i have a link on our menu directing users straight to the player list http://www.oxfordsaints.com/list/2015-roster/

    But that doesn’t seem to be impacted by the code you gave me.

    Thread Starter JD85

    (@jd85)

    Hi Roch

    I tried enabling the custom code plugin again and it seems to be having a detrimental effect on my website. When enabled, all page content suddenly becomes blank…

    I had disable all my plugins and re-activate them one by one to find the culprit and it turns out to be the custom code plugin. Once de-activated again, my content on all pages returns.

    Do you know why this might happen, and what we can do to resolve the initial query i raised above?

    Thanks

    Plugin Contributor Roch

    (@rochesterj)

    Hi!

    The current page structure is quite different now from what we’ve had in the beginning so the code won’t work indeed. That code is tied to only one type of structure unfortunately so whenever one occurs it will stop working.

    To apply it to this page: http://www.oxfordsaints.com/list/2015-roster/

    This is the JS code:

    <script>
    jQuery(window).load(function(){
    setTimeout( function() {
    
    var sections = jQuery('body.postid-583 #content > div > section'),
        parent = jQuery('body.postid-583 #content > div'),
        bkp = '',
        additional = jQuery('body.postid-583 #content > div > h3,body.postid-583 #content > div > p, body.postid-583 #content > div > .fb-comments');
    
    bkp = sections;
    
    sections.remove();
    
    bkp.eq(6).appendTo(parent);
    bkp.eq(7).appendTo(parent);
    bkp.eq(2).appendTo(parent);
    bkp.eq(10).appendTo(parent);
    bkp.eq(9).appendTo(parent);
    bkp.eq(4).appendTo(parent);
    bkp.eq(3).appendTo(parent);
    bkp.eq(5).appendTo(parent);
    bkp.eq(0).appendTo(parent);
    bkp.eq(8).appendTo(parent);
    bkp.eq(1).appendTo(parent);
    
    additional.appendTo(parent);
    
    }, 500);
    });
    </script>

    Thread Starter JD85

    (@jd85)

    Hi Roch

    Does the plugin you suggested still work? I have activated it (not placed in any custom code yet) and it’s caused none of my page content throughout my website to be shown.

    When i deactivate the plugin, all the content returns?

    Thread Starter JD85

    (@jd85)

    Hi Roch, i’ve sorted this out now. I used a different custom code plugin and it worked successfully.

    I’ve reverted the roster back to the previous location (so i used the JS you provided in your earlier post) and as you can see the positions are now sorted as requested.

    http://www.oxfordsaints.com/roster/

    Plugin Contributor Roch

    (@rochesterj)

    Hi!

    That’s awesome! I’m glad it’s resolved! 🙂

    Kind Regards,
    -Roch

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘American Football: change the order positions are listed for player list’ is closed to new replies.