Skip to main content
added 171 characters in body
Source Link
birgire
  • 67.8k
  • 7
  • 119
  • 251

Here are threefour different methods:

Many other variations could be possible, but I stop here ;-)

Note that I've never installed or used this theme before. These are just some ideas based on skimming through the theme's source code.

Here are three different methods:

Many other variations could be possible, but I stop here ;-)

Here are four different methods:

Many other variations could be possible, but I stop here ;-)

Note that I've never installed or used this theme before. These are just some ideas based on skimming through the theme's source code.

added 703 characters in body
Source Link
birgire
  • 67.8k
  • 7
  • 119
  • 251

We could try to modify method #2 by increasingincrease the theme's quantity option, (from the backend) to 6 but display only 4 (just as an example). We could then use a modification of method #2:

add_filter( 'longform_get_featured_posts', function( $posts )
{
    shuffle( $posts );

    if( count( $posts ) > 4  )
        $posts = array_slice( $posts, 0, 4 );

    return $posts;
}, 11 );

We could try to modify method #2 by increasing the quantity option, to 6 but display only 4 (just as an example):

add_filter( 'longform_get_featured_posts', function( $posts )
{
    shuffle( $posts );

    if( count( $posts ) > 4  )
        array_slice( $posts, 0, 4 );

    return $posts;
}, 11 );

We could try to increase the theme's quantity option (from the backend) to 6 but display only 4 (just as an example). We could then use a modification of method #2:

add_filter( 'longform_get_featured_posts', function( $posts )
{
    shuffle( $posts );

    if( count( $posts ) > 4  )
        $posts = array_slice( $posts, 0, 4 );

    return $posts;
}, 11 );
added 703 characters in body
Source Link
birgire
  • 67.8k
  • 7
  • 119
  • 251

Method 4)

We could try to modify method #2 by increasing the quantity option, to 6 but display only 4 (just as an example):

add_filter( 'longform_get_featured_posts', function( $posts )
{
    shuffle( $posts );

    if( count( $posts ) > 4  )
        array_slice( $posts, 0, 4 );

    return $posts;
}, 11 );

To increase the number above 6, then max_posts need to be modified from this code part:

// Add support for featured content.
add_theme_support( 'featured-content', array(
    'featured_content_filter' => 'longform_get_featured_posts',
    'max_posts' => 6,
) );

Many other variations could be possible, but I stop here ;-)

Method 4)

We could try to modify method #2 by increasing the quantity option, to 6 but display only 4 (just as an example):

add_filter( 'longform_get_featured_posts', function( $posts )
{
    shuffle( $posts );

    if( count( $posts ) > 4  )
        array_slice( $posts, 0, 4 );

    return $posts;
}, 11 );

To increase the number above 6, then max_posts need to be modified from this code part:

// Add support for featured content.
add_theme_support( 'featured-content', array(
    'featured_content_filter' => 'longform_get_featured_posts',
    'max_posts' => 6,
) );

Many other variations could be possible, but I stop here ;-)

added 569 characters in body
Source Link
birgire
  • 67.8k
  • 7
  • 119
  • 251
Loading
added 4 characters in body
Source Link
birgire
  • 67.8k
  • 7
  • 119
  • 251
Loading
added 177 characters in body
Source Link
birgire
  • 67.8k
  • 7
  • 119
  • 251
Loading
added 24 characters in body
Source Link
birgire
  • 67.8k
  • 7
  • 119
  • 251
Loading
Source Link
birgire
  • 67.8k
  • 7
  • 119
  • 251
Loading