Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #1970752
Random posts for Archive pages and Mega Menu
Closed

Comments

  • free20art started the conversation

    Hello,

    I need to have the Category Archive pages and Mega Menus show random ordered posts each time someone goes to a page instead of the newest post first. How can I do this?

    Thank you!

  •  501
    Penci replied

    Hi,

    Please  send me your website managment information ( admin url site, username and password ) . I will change it help you.

    Best Regards,

    PenciDesign

  •   free20art replied privately
  •  501
    Penci replied

    Hi,

    1/ I add custom code php to pennews/function.php file  to Random posts for Archive pages and Mega Menu: http://prntscr.com/nchdes

    function penci_wpsites_query( $query ) {
        if ( $query->is_category() && $query->is_main_query() ) {
            $query->set( 'orderby', 'rand' );
        }
    }
    add_action( 'pre_get_posts', 'penci_wpsites_query' );

    2/ Random posts for  Mega Menu. I add custom code penci-framwork plugin / mega-menu/menu-render.php line  160 http://prntscr.com/nchdmf

    $attr = array(
    'post_type'           => $post_type,
    'posts_per_page'      => $numbers,
    'ignore_sticky_posts' => 1,
    'orderby'             => 'rand',
      'post_status'         => 'publish',
    'tax_query'           => array(
    array(
    'taxonomy' => $tax,
    'field'    => 'id',
    'terms'    => $cat_id,
    ),
    ),
    );

    Note important: please backup the code before update PenNews theme with latest version.

    Please check it again,


    Best Regards,

    PenciDesign

  •   free20art replied privately