File manager - Edit - /home/verseaumee/blueversionx/wp-content/themes/stargaze/single.php
Back
<?php /** * The template to display single post * * @package STARGAZE * @since STARGAZE 1.0 */ // Full post loading $full_post_loading = stargaze_get_value_gp( 'action' ) == 'full_post_loading'; // Prev post loading $prev_post_loading = stargaze_get_value_gp( 'action' ) == 'prev_post_loading'; $prev_post_loading_type = stargaze_get_theme_option( 'posts_navigation_scroll_which_block' ); // Position of the related posts $stargaze_related_position = stargaze_get_theme_option( 'related_position' ); // Type of the prev/next post navigation $stargaze_posts_navigation = stargaze_get_theme_option( 'posts_navigation' ); $stargaze_prev_post = false; $stargaze_prev_post_same_cat = stargaze_get_theme_option( 'posts_navigation_scroll_same_cat' ); // Rewrite style of the single post if current post loading via AJAX and featured image and title is not in the content if ( ( $full_post_loading || ( $prev_post_loading && 'article' == $prev_post_loading_type ) ) && ! in_array( stargaze_get_theme_option( 'single_style' ), array( 'style-6' ) ) ) { stargaze_storage_set_array( 'options_meta', 'single_style', 'style-6' ); } do_action( 'stargaze_action_prev_post_loading', $prev_post_loading, $prev_post_loading_type ); get_header(); while ( have_posts() ) { the_post(); // Type of the prev/next post navigation if ( 'scroll' == $stargaze_posts_navigation ) { $stargaze_prev_post = get_previous_post( $stargaze_prev_post_same_cat ); // Get post from same category if ( ! $stargaze_prev_post && $stargaze_prev_post_same_cat ) { $stargaze_prev_post = get_previous_post( false ); // Get post from any category } if ( ! $stargaze_prev_post ) { $stargaze_posts_navigation = 'links'; } } // Override some theme options to display featured image, title and post meta in the dynamic loaded posts if ( $full_post_loading || ( $prev_post_loading && $stargaze_prev_post ) ) { stargaze_sc_layouts_showed( 'featured', false ); stargaze_sc_layouts_showed( 'title', false ); stargaze_sc_layouts_showed( 'postmeta', false ); } // If related posts should be inside the content if ( strpos( $stargaze_related_position, 'inside' ) === 0 ) { ob_start(); } // Display post's content get_template_part( apply_filters( 'stargaze_filter_get_template_part', 'templates/content', 'single-' . stargaze_get_theme_option( 'single_style' ) ), 'single-' . stargaze_get_theme_option( 'single_style' ) ); // If related posts should be inside the content if ( strpos( $stargaze_related_position, 'inside' ) === 0 ) { $stargaze_content = ob_get_contents(); ob_end_clean(); ob_start(); do_action( 'stargaze_action_related_posts' ); $stargaze_related_content = ob_get_contents(); ob_end_clean(); if ( ! empty( $stargaze_related_content ) ) { $stargaze_related_position_inside = max( 0, min( 9, stargaze_get_theme_option( 'related_position_inside' ) ) ); if ( 0 == $stargaze_related_position_inside ) { $stargaze_related_position_inside = mt_rand( 1, 9 ); } $stargaze_p_number = 0; $stargaze_related_inserted = false; $stargaze_in_block = false; $stargaze_content_start = strpos( $stargaze_content, '<div class="post_content' ); $stargaze_content_end = strrpos( $stargaze_content, '</div>' ); for ( $i = max( 0, $stargaze_content_start ); $i < min( strlen( $stargaze_content ) - 3, $stargaze_content_end ); $i++ ) { if ( $stargaze_content[ $i ] != '<' ) { continue; } if ( $stargaze_in_block ) { if ( strtolower( substr( $stargaze_content, $i + 1, 12 ) ) == '/blockquote>' ) { $stargaze_in_block = false; $i += 12; } continue; } else if ( strtolower( substr( $stargaze_content, $i + 1, 10 ) ) == 'blockquote' && in_array( $stargaze_content[ $i + 11 ], array( '>', ' ' ) ) ) { $stargaze_in_block = true; $i += 11; continue; } else if ( 'p' == $stargaze_content[ $i + 1 ] && in_array( $stargaze_content[ $i + 2 ], array( '>', ' ' ) ) ) { $stargaze_p_number++; if ( $stargaze_related_position_inside == $stargaze_p_number ) { $stargaze_related_inserted = true; $stargaze_content = ( $i > 0 ? substr( $stargaze_content, 0, $i ) : '' ) . $stargaze_related_content . substr( $stargaze_content, $i ); } } } if ( ! $stargaze_related_inserted ) { if ( $stargaze_content_end > 0 ) { $stargaze_content = substr( $stargaze_content, 0, $stargaze_content_end ) . $stargaze_related_content . substr( $stargaze_content, $stargaze_content_end ); } else { $stargaze_content .= $stargaze_related_content; } } } stargaze_show_layout( $stargaze_content ); } // Comments do_action( 'stargaze_action_before_comments' ); comments_template(); do_action( 'stargaze_action_after_comments' ); // Related posts if ( 'below_content' == $stargaze_related_position && ( 'scroll' != $stargaze_posts_navigation || stargaze_get_theme_option( 'posts_navigation_scroll_hide_related' ) == 0 ) && ( ! $full_post_loading || stargaze_get_theme_option( 'open_full_post_hide_related' ) == 0 ) ) { do_action( 'stargaze_action_related_posts' ); } // Post navigation: type 'scroll' if ( 'scroll' == $stargaze_posts_navigation && ! $full_post_loading ) { ?> <div class="nav-links-single-scroll" data-post-id="<?php echo esc_attr( get_the_ID( $stargaze_prev_post ) ); ?>" data-post-link="<?php echo esc_attr( get_permalink( $stargaze_prev_post ) ); ?>" data-post-title="<?php the_title_attribute( array( 'post' => $stargaze_prev_post ) ); ?>" <?php do_action( 'stargaze_action_nav_links_single_scroll_data', $stargaze_prev_post ); ?> ></div> <?php } } get_footer();
| ver. 1.4 |
Github
|
.
| PHP 8.5.7 | Generation time: 0 |
proxy
|
phpinfo
|
Settings