Optimize index templates
This commit is contained in:
parent
f8e0aa8afe
commit
74722edea8
@ -33,13 +33,15 @@ $sorted_stories = [];
|
||||
if ( $stories->have_posts() ) {
|
||||
// Loop through posts...
|
||||
foreach ( $stories->posts as $story ) {
|
||||
$story_id = $story->ID;
|
||||
|
||||
// Skip hidden
|
||||
if ( get_post_meta( $story->ID, 'fictioneer_story_hidden', true ) ) {
|
||||
if ( get_post_meta( $story_id, 'fictioneer_story_hidden', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Relevant data
|
||||
$title = trim( fictioneer_get_safe_title( $story->ID, 'story_index' ) );
|
||||
$title = trim( fictioneer_get_safe_title( $story_id, 'story_index' ) );
|
||||
$first_char = strtolower( mb_substr( $title, 0, 1, 'UTF-8' ) );
|
||||
|
||||
// Normalize for numbers and other non-alphabetical characters
|
||||
@ -53,13 +55,13 @@ if ( $stories->have_posts() ) {
|
||||
}
|
||||
|
||||
$sorted_stories[ $first_char ][] = array(
|
||||
'id' => $story->ID,
|
||||
'id' => $story_id,
|
||||
'title' => $title,
|
||||
'link' => get_post_meta( $story->ID, 'fictioneer_story_redirect_link', true ) ?: get_permalink( $story->ID ),
|
||||
'date' => get_the_date( $story->ID ),
|
||||
'total_words' => absint( get_post_meta( $story->ID, 'fictioneer_story_total_word_count', true ) ?? 0 ),
|
||||
'rating' => get_post_meta( $story->ID, 'fictioneer_story_rating', true ),
|
||||
'status' => get_post_meta( $story->ID, 'fictioneer_story_status', true )
|
||||
'link' => get_post_meta( $story_id, 'fictioneer_story_redirect_link', true ) ?: get_permalink( $story_id ),
|
||||
'date' => get_the_date( $story_id ),
|
||||
'total_words' => absint( get_post_meta( $story_id, 'fictioneer_story_total_word_count', true ) ?? 0 ),
|
||||
'rating' => get_post_meta( $story_id, 'fictioneer_story_rating', true ),
|
||||
'status' => get_post_meta( $story_id, 'fictioneer_story_status', true )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -33,13 +33,15 @@ $sorted_stories = [];
|
||||
if ( $stories->have_posts() ) {
|
||||
// Loop through posts...
|
||||
foreach ( $stories->posts as $story ) {
|
||||
$story_id = $story->ID;
|
||||
|
||||
// Skip hidden
|
||||
if ( get_post_meta( $story->ID, 'fictioneer_story_hidden', true ) ) {
|
||||
if ( get_post_meta( $story_id, 'fictioneer_story_hidden', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Relevant data
|
||||
$title = trim( fictioneer_get_safe_title( $story->ID, 'story_index' ) );
|
||||
$title = trim( fictioneer_get_safe_title( $story_id, 'story_index' ) );
|
||||
$first_char = strtolower( mb_substr( $title, 0, 1, 'UTF-8' ) );
|
||||
|
||||
// Normalize for numbers and other non-alphabetical characters
|
||||
@ -53,9 +55,9 @@ if ( $stories->have_posts() ) {
|
||||
}
|
||||
|
||||
$sorted_stories[ $first_char ][] = array(
|
||||
'id' => $story->ID,
|
||||
'id' => $story_id,
|
||||
'title' => $title,
|
||||
'link' => get_post_meta( $story->ID, 'fictioneer_story_redirect_link', true ) ?: get_permalink( $story->ID )
|
||||
'link' => get_post_meta( $story_id, 'fictioneer_story_redirect_link', true ) ?: get_permalink( $story_id )
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user