Ordering of home blocks

Support Area Forums Selfie Ordering of home blocks

Viewing 7 posts - 1 through 7 (of 7 total)
URL to the page in question: http://imagnry.com
  • Author
    Posts
  • #30036
    Peter Hedrich
    Participant

    Hi Bill,

    although I altered in the page-potfolio-group.php the order from ASC to DESC, the order didn’t change at all. Tried it also vice versa from DESC to ASC- the ordering isn’t affected at all.
    example is here : http://imagnry.com/in/simplicity. (The white gif with the intro text should come first, the lizard is the latest element)

    regards
    Peter

    #30041
    Bill Robbins
    Moderator

    Hello Peter,

    Good question. The home blocks are set in order by the “order number” which defaults to zero for all of them. The best way to set the order is by using the Simple Page Ordering plugin (https://wordpress.org/plugins/simple-page-ordering/) which will let you drag and drop the items to set them in order.

    Another option would be to switch that page template to use date instead of menu_order to set the order. To do that you would change this:

    
    menu_order
    

    to this:

    
    date
    

    That should switch the order from being based on the order number to the publication date.

    Let me know if you have any questions.

    Take care,
    Bill

    #30071
    Peter Hedrich
    Participant

    Hi Bill,

    ordering by date works in page-home-template.php ( http://imagnry.com ), but not in page-potfolio-group.php (all other pages).
    Both templates are set to orderby ‘date’ and order ‘ASC’.

    best regards
    Peter

    #30072
    Bill Robbins
    Moderator

    Hey Peter,

    The best reference I have to offer you is at https://codex.wordpress.org/Class_Reference/WP_Query

    There is a section on ordering there that shows the options for ordering wp_query

    If you need to change the ordering of a portfolio group not using the page template you’ll need to edit the queries.php file in the theme.

    Take care,
    Bill

    #30074
    Peter Hedrich
    Participant

    Unfortunately these suggested steps exceed my knowledge. Don’t want to order not using the template.
    The order function is quite important because there will be in each portfolio group around 50-60 slides.

    So the question is, why can the home-page-template be ordered and the portfolio-group-template not ?

    What I can see is that both templates are almost identical except this part:

    in home-page-template

    <?php $home_blocks = new WP_Query(
    array(
    ‘post_type’ => ‘block’,
    ‘posts_per_page’ => ‘120’,
    ‘orderby’ => ‘date’,
    ‘order’ => ‘ASC’,
    ‘no_found_rows’ => true
    )
    ); ?>

    compared to portfolio-group-template:

    <?php

    $portfolio_group = get_post_meta($post->ID, “portfolio_group_select”, $single = true);

    $home_blocks = new WP_Query(

    array(
    ‘post_type’ => ‘block’,
    ‘posts_per_page’ => ‘120’,
    ‘orderby’ => ‘date’,
    ‘order’ => ‘ASC’,
    ‘no_found_rows’ => true,
    ‘tax_query’ => array(
    array(
    ‘taxonomy’ => ‘portfolio-group’,
    ‘field’ => ‘term_id’,
    ‘terms’ => $portfolio_group,
    ),
    ),
    )
    ); ?>

    Why does the orderly and order show no results in the portfolio-page-template ?

    #30075
    Peter Hedrich
    Participant

    Hi Bill,

    here is my mistake. I was calling the taxonomy directly like in http:imagery.com/in/light instead of creating a page like http://imagnry.com/light. Of course for the taxonomy alone the portfolio-page-template doesn’t apply.

    Sometimes seeing the very simple solution is blocked by one’s own stupidity like a fingernail in front of the eye can block the view to the sun.

    regards
    P.

    #30082
    Bill Robbins
    Moderator

    Peter,

    Glad you spotted what’s happening there. You can add the taxonomy directly to the navigation if you need to. To change the order of those you’ll need to edit the queries.php file to alter those. If you have any other questions, let me know.

    Have a great weekend,
    Bill

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Ordering of home blocks’ is closed to new replies.