new design

This commit is contained in:
2022-08-16 10:37:55 +03:00
parent cebc3aca47
commit c1cf264f28
7 changed files with 200 additions and 10 deletions

View File

@@ -677,6 +677,10 @@ add_action( 'pre_get_posts', function ($query) {
else {
$query->set( 'posts_per_page', 23 );
}
if (is_author()){
$query->set( 'posts_per_page', 23 );
}
}
@@ -706,3 +710,47 @@ function add_text_to_the_feed_end( $content ){
add_filter( 'the_excerpt_rss', 'add_text_to_the_feed_end' );
function add_div_youtube($content){
$content = str_replace(
['<iframe', '</iframe>'],
['<div class="vijdeo"><iframe', '</iframe></div>'],
$content);
return $content;
}
add_filter('the_content', 'add_div_youtube');
//preview
ini_set('display_errors', 'off');
add_filter( 'posts_results', 'set_query_to_draft', null, 2 );
function set_query_to_draft( $posts, &$query ) {
if ( sizeof( $posts ) != 1 )
return $posts;
$post_status_obj = get_post_status_object(get_post_status( $posts[0]));
if ( !$post_status_obj->name == 'draft' )
return $posts;
if ( $_GET['key'] != 'guest' )
return $posts;
$query->_draft_post = $posts;
add_filter( 'the_posts', 'show_draft_post', null, 2 );
}
function show_draft_post( $posts, &$query ) {
remove_filter( 'the_posts', 'show_draft_post', null, 2 );
return $query->_draft_post;
}