Add names to queries
Allows to easily identify queries in filters.
This commit is contained in:
parent
817459bcde
commit
ae54d0c8b7
@ -28,6 +28,7 @@ $ago = is_numeric( $ago ) ? absint( $ago ) : sanitize_text_field( $ago );
|
||||
|
||||
// Prepare query
|
||||
$query_args = array (
|
||||
'fictioneer_query_name' => 'chapters_list',
|
||||
'post_type' => 'fcn_chapter',
|
||||
'post_status' => 'publish',
|
||||
'orderby' => $orderby,
|
||||
|
@ -28,6 +28,7 @@ $ago = is_numeric( $ago ) ? absint( $ago ) : sanitize_text_field( $ago );
|
||||
|
||||
// Prepare query
|
||||
$query_args = array (
|
||||
'fictioneer_query_name' => 'collections_list',
|
||||
'post_type' => 'fcn_collection',
|
||||
'post_status' => 'publish',
|
||||
'orderby' => $orderby,
|
||||
|
@ -217,6 +217,7 @@ if ( ! function_exists( 'fictioneer_get_story_data' ) ) {
|
||||
// faster than querying and counting all comments.
|
||||
$chapters = new WP_Query(
|
||||
array(
|
||||
'fictioneer_query_name' => 'story_chapters',
|
||||
'post_type' => 'fcn_chapter',
|
||||
'post_status' => 'publish',
|
||||
'post__in' => fictioneer_rescue_array_zero( $old_data['chapter_ids'] ),
|
||||
@ -307,6 +308,7 @@ if ( ! function_exists( 'fictioneer_get_story_data' ) ) {
|
||||
// Query chapters
|
||||
$chapters = empty( $chapters ) ? $chapters : new WP_Query(
|
||||
array(
|
||||
'fictioneer_query_name' => 'story_chapters',
|
||||
'post_type' => 'fcn_chapter',
|
||||
'post_status' => 'publish',
|
||||
'post__in' => fictioneer_rescue_array_zero( $chapters ),
|
||||
|
@ -242,6 +242,7 @@ function fictioneer_ajax_get_finished_checkmarks_list() {
|
||||
$list_items = fictioneer_get_card_list(
|
||||
'story',
|
||||
array(
|
||||
'fictioneer_query_name' => "bookshelf_finished",
|
||||
'post__in' => $post_ids,
|
||||
'paged' => $page,
|
||||
'order' => $order
|
||||
|
@ -384,6 +384,7 @@ function fictioneer_ajax_get_follows_list() {
|
||||
$list_items = fictioneer_get_card_list(
|
||||
'story',
|
||||
array(
|
||||
'fictioneer_query_name' => "bookshelf_follows",
|
||||
'post__in' => $post_ids,
|
||||
'paged' => $page,
|
||||
'order' => $order
|
||||
|
@ -168,6 +168,7 @@ function fictioneer_ajax_get_reminders_list() {
|
||||
$list_items = fictioneer_get_card_list(
|
||||
'story',
|
||||
array(
|
||||
'fictioneer_query_name' => "bookshelf_reminders",
|
||||
'post__in' => $post_ids,
|
||||
'paged' => $page,
|
||||
'order' => $order
|
||||
|
@ -28,6 +28,7 @@ $ago = is_numeric( $ago ) ? absint( $ago ) : sanitize_text_field( $ago );
|
||||
|
||||
// Prepare query
|
||||
$query_args = array (
|
||||
'fictioneer_query_name' => 'recommendations_list',
|
||||
'post_type' => 'fcn_recommendation',
|
||||
'post_status' => 'publish',
|
||||
'orderby' => $orderby,
|
||||
|
@ -42,10 +42,10 @@ if ( $show_advanced ) {
|
||||
$author_name = $_GET['author_name'] ?? 0; // Simple text field
|
||||
|
||||
$all_tags = get_tags();
|
||||
$all_genres = get_tags( ['taxonomy' => 'fcn_genre'] );
|
||||
$all_fandoms = get_tags( ['taxonomy' => 'fcn_fandom'] );
|
||||
$all_characters = get_tags( ['taxonomy' => 'fcn_character'] );
|
||||
$all_warnings = get_tags( ['taxonomy' => 'fcn_content_warning'] );
|
||||
$all_genres = get_tags( array( 'taxonomy' => 'fcn_genre' ) );
|
||||
$all_fandoms = get_tags( array( 'taxonomy' => 'fcn_fandom' ) );
|
||||
$all_characters = get_tags( array( 'taxonomy' => 'fcn_character' ) );
|
||||
$all_warnings = get_tags( array( 'taxonomy' => 'fcn_content_warning' ) );
|
||||
|
||||
$queried_genres = $_GET['genres'] ?? 0;
|
||||
$queried_fandoms = $_GET['fandoms'] ?? 0;
|
||||
|
@ -75,7 +75,9 @@ if ( count( $tabs ) < 1 ) {
|
||||
}
|
||||
|
||||
// Use first tab if queried tab is not available
|
||||
if ( ! array_key_exists( $current_tab, $tabs ) ) $current_tab = array_key_first( $tabs );
|
||||
if ( ! array_key_exists( $current_tab, $tabs ) ) {
|
||||
$current_tab = array_key_first( $tabs );
|
||||
}
|
||||
|
||||
// Select tab
|
||||
$tabs[ $current_tab ]['classes'][] = '_current';
|
||||
@ -164,6 +166,7 @@ $tabs[ $current_tab ]['classes'][] = '_current';
|
||||
$list_items = fictioneer_get_card_list(
|
||||
'story',
|
||||
array(
|
||||
'fictioneer_query_name' => "bookshelf_{$current_tab}",
|
||||
'post__in' => $tabs[ $current_tab ]['post_ids'],
|
||||
'paged' => $current_page,
|
||||
'order' => $order
|
||||
|
@ -28,6 +28,7 @@ $ago = is_numeric( $ago ) ? absint( $ago ) : sanitize_text_field( $ago );
|
||||
|
||||
// Prepare query
|
||||
$query_args = array (
|
||||
'fictioneer_query_name' => 'stories_list',
|
||||
'post_type' => 'fcn_story',
|
||||
'post_status' => 'publish',
|
||||
'orderby' => $orderby,
|
||||
|
Loading…
x
Reference in New Issue
Block a user