Constant to turn off sticky stories
This commit is contained in:
parent
bb3d763e3a
commit
32858e5fbb
@ -41,8 +41,7 @@ $tabs['stories'] = array(
|
||||
'query_args' => array(
|
||||
'post_type' => 'fcn_story',
|
||||
'author' => $author_id,
|
||||
'meta_key' => 'fictioneer_story_sticky',
|
||||
'orderby' => 'meta_value modified',
|
||||
'orderby' => 'modified',
|
||||
'paged' => $current_page,
|
||||
'order' => $order,
|
||||
'meta_query' => array(
|
||||
@ -61,6 +60,11 @@ $tabs['stories'] = array(
|
||||
'empty' => __( 'No stories published yet.', 'fictioneer' )
|
||||
);
|
||||
|
||||
if ( FICTIONEER_ENABLE_STICKY_CARDS ) {
|
||||
$tabs['stories']['query_args']['meta_key'] = 'fictioneer_story_sticky';
|
||||
$tabs['stories']['query_args']['orderby'] = 'meta_value ' . $tabs['stories']['query_args']['orderby'];
|
||||
}
|
||||
|
||||
// Chapters tab
|
||||
$tabs['chapters'] = array(
|
||||
'name' => __( 'Chapters', 'fictioneer' ),
|
||||
|
@ -299,6 +299,11 @@ if ( ! defined( 'FICTIONEER_DISABLE_ACF_JSON_IMPORT' ) ) {
|
||||
define( 'FICTIONEER_DISABLE_ACF_JSON_IMPORT', false );
|
||||
}
|
||||
|
||||
// Boolean: Disable ACF JSON import
|
||||
if ( ! defined( 'FICTIONEER_ENABLE_STICKY_CARDS' ) ) {
|
||||
define( 'FICTIONEER_ENABLE_STICKY_CARDS', true );
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// GLOBAL
|
||||
// =============================================================================
|
||||
|
@ -31,8 +31,7 @@ $query_args = array(
|
||||
'post_type' => 'fcn_story',
|
||||
'post_status' => 'publish',
|
||||
'post__in' => $args['post_ids'],
|
||||
'meta_key' => 'fictioneer_story_sticky',
|
||||
'orderby' => 'meta_value ' . $args['orderby'],
|
||||
'orderby' => $args['orderby'],
|
||||
'order' => $args['order'] ?? 'desc',
|
||||
'posts_per_page' => $args['count'],
|
||||
'meta_query' => array(
|
||||
@ -49,6 +48,11 @@ $query_args = array(
|
||||
'no_found_rows' => true
|
||||
);
|
||||
|
||||
if ( FICTIONEER_ENABLE_STICKY_CARDS ) {
|
||||
$query_args['meta_key'] = 'fictioneer_story_sticky';
|
||||
$query_args['orderby'] = 'meta_value ' . $query_args['orderby'];
|
||||
}
|
||||
|
||||
// Parameter for author?
|
||||
if ( isset( $args['author'] ) && $args['author'] ) $query_args['author_name'] = $args['author'];
|
||||
|
||||
|
@ -28,8 +28,7 @@ $query_args = array(
|
||||
'post_type' => 'fcn_story',
|
||||
'post_status' => 'publish',
|
||||
'post__in' => $args['post_ids'],
|
||||
'meta_key' => 'fictioneer_story_sticky',
|
||||
'orderby' => 'meta_value ' . $args['orderby'],
|
||||
'orderby' => $args['orderby'],
|
||||
'order' => $args['order'] ?? 'desc',
|
||||
'posts_per_page' => $args['count'],
|
||||
'meta_query' => array(
|
||||
@ -46,6 +45,11 @@ $query_args = array(
|
||||
'no_found_rows' => true
|
||||
);
|
||||
|
||||
if ( FICTIONEER_ENABLE_STICKY_CARDS ) {
|
||||
$query_args['meta_key'] = 'fictioneer_story_sticky';
|
||||
$query_args['orderby'] = 'meta_value ' . $query_args['orderby'];
|
||||
}
|
||||
|
||||
// Parameter for author?
|
||||
if ( isset( $args['author'] ) && $args['author'] ) $query_args['author_name'] = $args['author'];
|
||||
|
||||
|
@ -30,13 +30,17 @@ $ago = is_numeric( $ago ) ? absint( $ago ) : sanitize_text_field( $ago );
|
||||
$query_args = array (
|
||||
'post_type' => 'fcn_story',
|
||||
'post_status' => 'publish',
|
||||
'meta_key' => 'fictioneer_story_sticky',
|
||||
'orderby' => "meta_value {$orderby}",
|
||||
'orderby' => $orderby,
|
||||
'order' => $order,
|
||||
'paged' => $page,
|
||||
'posts_per_page' => get_option( 'posts_per_page', 8 )
|
||||
);
|
||||
|
||||
if ( FICTIONEER_ENABLE_STICKY_CARDS ) {
|
||||
$query_args['meta_key'] = 'fictioneer_story_sticky';
|
||||
$query_args['orderby'] = 'meta_value ' . $query_args['orderby'];
|
||||
}
|
||||
|
||||
// Append date query (if any)
|
||||
$query_args = fictioneer_append_date_query( $query_args, $ago, $orderby );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user