• Resolved jack.koppa

    (@jackkoppa)


    Hi Huge IT,

    First, thanks again for your help previously, in adding custom fields to your plugin. I have a much easier question this time: on page load, I would like the portfolio to be automatically sorted by “Symbol” (which I have already set equal to a custom parameter, and sorting by “Symbol” works well when I click the “Symbol” sort button). In the final version, I will not be including sorting buttons, but I want the automatic/default sorting to be by “Symbol”. I’m assuming this might be doable in the jQuery portion of portfolio_front_end_view.php, but I can’t find the appropriate function anywhere.

    Hopefully this is just a code snippet I could add? Thanks so much for any help.

    https://www.ads-software.com/plugins/portfolio-gallery/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello
    that is possible. Please tell me which view you need. And sorting by what? (date, name or..)

    Thread Starter jack.koppa

    (@jackkoppa)

    I need VIEW 2 Popup (which is called “Gallery Content-Popup” on the admin panel). I’d like to default sort by “Symbol”, which for each element, I’ve already assigned the attribute of data-symbol="<?php echo $row->lastname; ?>", where $row->lastname calls one of my custom parameters that each portfolio element now has. Sorting by this already works when using the “Symbol” sort button – I’d just like for that to be the default sort, without using any buttons.

    Thanks so much for your help.

    Ok
    In front_end_view find this: /////////////////////////////// VIEW 2 Popup /////////////////////////////
    That is our content popup view codes, several rows below you can find this tag: <script> where there is jQuery(function(){ …. here is written jQuery codes. In that codes you should find this: var $optionSets = jQuery(‘#huge_it_portfolio_options_<?php echo $portfolioID; ?> .option-set’),
    and one row above insert this:
    jQuery(window).load(function(){
    jQuery(“#huge_it_portfolio_options_<?php echo $portfolioID; ?> #sort-by li a[href=’#sortBy=symbol’]”).click();
    });

    Thread Starter jack.koppa

    (@jackkoppa)

    Fantastic. Thank you so much for the code – the jQuery function makes a lot of sense. I tried adding the code where you told me to, but unfortunately, it doesn’t work there (even though when I add console.log, I can tell that the function is firing). I took the function and put it outside the original <script> tag (I actually made a separate <script> tag at the beginning of this View), and now it works! The only problem is that the portfolio first loads in the default sort, and then resorts, which is a little distracting. You can see that issue here. Is there any way to prevent the portfolio from first loading in the default sort, and only load when that .click function you gave me fires?

    If not, that’s OK. The current state of the site that I linked above is better than the default. Thanks again!

    You welcome)
    Dear that is jQuery functionality. jQuery is made so it waits until all your site components will be loaded and then in loads itself. So that is very difficult to lead jQuery at once.

    Thread Starter jack.koppa

    (@jackkoppa)

    Sounds good, Huge IT. Thanks again for the help.

    goremented

    (@goremented)

    Hello, how can i do this for

    /////////////////////////////// VIEW 0 Toggle Up/Down Blocks /////////////////////////////////////////

    support-huge-it

    (@support-huge-it)

    Hi goremented
    90% it’s the same.
    I don’t think that the code will not work on all other views
    So please try

    Thank you

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Changing Default Sort Behavior (Automatically Sort by "Symbol" on Page Load)’ is closed to new replies.