• Hello
    Wordpress 4.4.2
    Theme Gridsby
    Modele page: home page.

    i want to have a lot of random article in my home page but the code orderby=> rand doesn’t work correctly…..

    if i write this code, i have a probleme:

    Article Everything is good in the disorder, but link too…..

    <?php else :

    global $post;

    // Set the photo length
    if ( get_theme_mod( ‘photos_length’ ) ) :

    if ( ‘option1’ == gridsby_sanitize_index_content( get_theme_mod( ‘gridsby_post_time_method’ ) ) ) :

    // Set Ascending
    $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => get_theme_mod( ‘photos_length’, ’20’ ), ‘order’ => ‘ASC’, ‘tax_query’ =>
    array(
    array(
    ‘taxonomy’ => ‘post_format’,
    ‘field’ => ‘slug’,
    ‘terms’ => ‘post-format-image’,
    )));

    else :

    // Set Descending
    $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => get_theme_mod( ‘photos_length’, ’20’ ), ‘tax_query’ =>
    array(
    array(
    ‘taxonomy’ => ‘post_format’,
    ‘field’ => ‘slug’,
    ‘terms’ => ‘post-format-image’,
    )));

    endif;

    else :

    if ( ‘option1’ == gridsby_sanitize_index_content( get_theme_mod( ‘gridsby_post_time_method’ ) ) ) :

    // Set Ascending
    $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1, ‘order’ => ‘ASC’, ‘tax_query’ =>
    array(
    array(
    ‘taxonomy’ => ‘post_format’,
    ‘field’ => ‘slug’,
    ‘terms’ => ‘post-format-image’,
    )));

    else :

    // Set Descending
    $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1, ‘tax_query’ =>
    array(
    array(
    ‘taxonomy’ => ‘post_format’,
    ‘field’ => ‘slug’,
    ‘terms’ => ‘post-format-image’,
    )));

    endif;

    endif;

    $myposts = get_posts( $args );
    foreach( $myposts as $post ) : setup_postdata($post); ?>

    <?php get_template_part( ‘content’, ‘pf-image’ ); // Post Format Image ?>

    <?php endforeach; ?>

    <?php endif; ?>

  • The topic ‘Random article on gridsby theme’ is closed to new replies.