Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #19757

    Hi – Matthew Woodard posted this solution to sort portfolio items.

    Can anybody explain how/where i implement this code. And does the effect of it mean that the portfolio items is sortable on the actual site, not only in the WP backend ?


    function loop_portfolio_query( $location )

    {

    if ( $location == ‘loop-portfolio’ )

    {

    global $avia_config;

    if(isset($avia_config)) {

    $avia_config = “title”;

    $avia_config = “ASC”;

    query_posts($avia_config);

    }

    }

    }

    add_action( ‘avia_action_query_check’ , ‘loop_portfolio_query’, 10, 1 );


    Secondary – is there anyway randomize the portfolio items shown in frontpage ?

    sorenzen.com

    Best regards

    Stewart ;)

    #104892

    Hi,

    You can place it on functions.php. :)

    If you want to make it random just change

    $avia_config['new_query']['order'] = "ASC";

    to

    $avia_config['new_query']['order'] = "rand";

    Regards,

    Ismael

    #104893

    Thanks Ismael – I´m not a programmer so i´ll ask a few more details.

    Does the code from Matthew make the oder of the portfolio items controllable/sortable ?.

    In functions.php – where do it put in the code or more importantly where not to ?.

    Best regards

    Stewart

    #104894

    Hmmm i checked the “functions.php” file in Komodo Edit, can´t find that exact code line: $avia_config = “ASC”;

    (Neither in functions-eunoia.php)

    What am i doing wrong ?

    :/

    #104895

    Hi,

    Place it at the very bottom of functions.php

    function loop_portfolio_query( $location )
    {
    if ( $location == 'loop-portfolio' )
    {
    global $avia_config;
    if(isset($avia_config['new_query'])) {
    $avia_config['new_query']['orderby'] = "title";
    $avia_config['new_query']['order'] = "ASC";
    query_posts($avia_config['new_query']);
    }
    }
    }
    add_action( 'avia_action_query_check' , 'loop_portfolio_query', 10, 1 );

    These codes control the order of the portfolio items.

    $avia_config['new_query']['orderby'] = "title";
    $avia_config['new_query']['order'] = "ASC";

    You might want to visit this link for reference.

    http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

    Regards,

    Ismael

    #104896

    Hi Ismael – i tried the suggested and put in the code at the very bottom of the functions.php code

    Tried a few variations but the

    $avia_config = “rand”;

    $avia_config = “rand”;

    - Can also be that WP is updating slowly, that is quite common right ?.

    Last functions.php i have uploaded is now set to:

    $avia_config = “title”;

    $avia_config = “rand”;

    Anyway my site looks quite messed up right now take a look: http://sorenzen.com

    #104897

    Hi sorenzen,

    Try to replace:

    $avia_config['new_query']['orderby'] = "title";
    $avia_config['new_query']['order'] = "ASC";

    with just:

    $avia_config['new_query']['orderby'] = "rand";

    Hope this helps. :)

    Regards,

    Ismael

    #104898

    Hmmm tried it, but unless WP is extremely slow, it did not change anything.

    I´m wondering…. I updated to the latest WP version, does euonia support that ?

    Best regards

    Stewart ;)

    #104899

    Urgent Help needed!, my site is completely messed up now and i have been trying to solve that Portfolio Oder thing now for more than two months. I have even asked if somebody from Kriesi would help me with the site, and i would off course pay for that help.

    Anyway – my site is for sure not looking like the Euonia template anymore. If it is due to the functions.php changes (see above correspondence) or if it is because i have updated to the latest WP version i do not now?.

    Any suggestions welcome.

    I have a server backup, but only taken after the WP update. Else it would be back to reset – Not exactly what i had in mind to be honest.

    Got +50 portfolio cases waiting to be worked through and taken online. I am a freelancer and this is starting to hurt just a bit to much.

    #104900

    Okay! i replaced all server content with the backup and the site is running euonia normal again.

    I would thou still like to solve the Portfolio Item order – would Prefer “Random” Sorting – else i take any other method that is not based on “Date”.

    Ismael – I would be most thankful if you could double check the suggested functions.php order alteration – and that it really does work with the Euonia theme.

    Thanks in advance

    Best regards

    Stewart.

    #104902

    Hi,

    I apologized for the delay. Try this instead, I tested this code on my end and it works fine.

    function loop_portfolio_query( $location )
    {
    if ( $location == 'loop-portfolio' )
    {
    global $avia_config;
    if(isset($avia_config['new_query'])) {
    $avia_config['new_query']['orderby'] = "rand";
    query_posts($avia_config['new_query']);
    }
    }
    }
    add_action( 'avia_action_query_check' , 'loop_portfolio_query', 10, 1 );

    This will sort the portfolio on random order. Try to remove browser history and cache.

    Are you using a caching plugin like WP Super Cache? Please disable it.

    Regards,

    Ismael

    #104903

    Thank You – i will try it out ;)

    #104904

    Thank You again – it works now ;D

Viewing 13 posts - 1 through 13 (of 13 total)

The topic ‘Portfolio Items sorting solution, implementation ?’ is closed to new replies.