'post' ); $args = array_merge( $args, $wp_query->query ); query_posts( $args ); } // if( $custom_search === 'posts' ) { // -------------------------------------------------------- // incase of only posts search we change the query // -------------------------------------------------------- if( $custom_search === 'pages' ) { $args = array( 'post_type' => 'page' ); $args = array_merge( $args, $wp_query->query ); query_posts( $args ); } // if( $custom_search === 'pages' ) { // -------------------------------------------------------- // getting the search query value // -------------------------------------------------------- $search_term = get_search_query(); if( !empty($search_term) ) { if( have_posts() ) { $page_output .= "

" . __('Search results for', 'yydevelopment-basic') . " \"" . $search_term . "\"

"; $page_output .= ""; // -------------------------------------------------------- // checking if there is a post and output the page content // -------------------------------------------------------- while( have_posts() ) { // -------------------------------------------------------- // Getting the post/page data // -------------------------------------------------------- the_post(); // -------------------------------------------------------- // Getting post format if it's set // -------------------------------------------------------- $format = ""; if( has_post_format() ) { $format = "page-format-" . get_post_format(); }// if( has_post_format() ) { // -------------------------------------------------------- // Checking if there is thumbnail image for the post // -------------------------------------------------------- $thumbnail_content_class = ""; if ( has_post_thumbnail()) { $thumbnail = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); $img_id = get_post_thumbnail_id( get_the_ID() ); $alt_text = get_post_meta($img_id , '_wp_attachment_image_alt', true); if( empty($alt_text) ) { $alt_text = get_the_title(); } // if(empty($alt_text)) { $thumbnail_content_class = "blog-post-content-thumbnail"; } // if ( has_post_thumbnail()) { // -------------------------------------------------------- // Creating all the page content and ouput it to the page // -------------------------------------------------------- $get_yy_posts_class = get_post_class(); $get_yy_posts_class = implode(' ', $get_yy_posts_class); $get_yy_posts_class = $get_yy_posts_class . ' blog-posts ' . $format; $page_output .= "
"; $page_output .= "
"; $page_output .= "
"; // -------------------------------------------------------- // Output the post thumbnail data // -------------------------------------------------------- if( !empty($thumbnail_content_class) ) { $page_output .= "
"; $page_output .= ""; $page_output .= "" .  $alt_text . ""; $page_output .= ""; $page_output .= "
"; } // if( !empty($thumbnail_content_class) ) { // -------------------------------------------------------- // Output the post data // -------------------------------------------------------- $page_output .= "

" . get_the_title() . "

"; $page_output .= ""; $page_output .= "
"; // -------------------------------------------------------- // adding fast editing button to each post // -------------------------------------------------------- if( $yydev_theme_data['yy_fast_editing_button'] == 1 ) { $page_output .= include( get_theme_file_path( 'pages-structure/blog-page-assets/fast-editing-button.php' ) ); } // if( $yydev_theme_data['yy_fast_editing_button'] == 1 ) { $page_output .= "
"; $page_output .= "
"; $page_output .= "
"; } // while( have_posts() ) { // -------------------------------------------------------- // creating the blog pages if there are more than one page // -------------------------------------------------------- if($wp_query->max_num_pages > 1) { $page_output .= yydev_theme_show_pages(false); } // if($wp_query->max_num_pages > 1) { } else { // if( have_posts() ) { // -------------------------------------------------------- // incase there were no results found for the page // -------------------------------------------------------- $page_output .= "

" . __('No search results were found', 'yydevelopment-basic') . "

"; $page_output .= ""; } // } else { // if( have_posts() ) { } else { // if( !empty($search_term) ) { // -------------------------------------------------------- // incase the search value was empty // -------------------------------------------------------- $page_output .= "

" . __('You must enter a term to the search', 'yydevelopment-basic') . "

"; $page_output .= ""; } // } else { // if( !empty($search_term) ) { // -------------------------------------------------------- // output the page content into the page // -------------------------------------------------------- echo $page_output; ?>