', ', ', '', $id ); $readmore = ''.$taglist.''.__( 'READ MORE', 'buildx' ).''; return wp_kses( $readmore, array( 'span' => array( 'class' => array() ), 'a' => array( 'href' => array(), 'class' => array(), 'rel' => array() ) ) ); } function buildx_featured_image($post_id, $size){ //if the post has a featured image if( has_post_thumbnail() ){ $featured_image_blog = get_the_post_thumbnail( $post_id, $size ); //if the post doesn't has a featured image }else{ $args = array( 'post_type' => 'attachment', 'numberposts' => 1, 'post_mime_type' => 'image', 'post_parent' => $post_id ); $attachment = get_children( $args ); //if the post has an uploaded or inserted image to the post if( !empty( $attachment ) ){ $rekeyed_array = array_values( $attachment ); $child_image = $rekeyed_array[0]; $featured_image_blog = wp_get_attachment_image( $child_image->ID,$size ); //if the post doesn't has any uploaded or inserted images, continue to check an embedded image }else{ $the_post = get_post($post_id); $content = $the_post->post_content; $imagefound = ''; //if the post doesn't have any content if( !empty($content) ){ $regex = '/< *img[^>]*src *= *["\']?([^"\']*)/i'; preg_match( $regex, $content, $matches ); if( !empty( $matches[1] ) ){ // reversing the matches array $imagefound = $matches[1]; } } //if the post has an embedded image if( !empty( $imagefound ) ){ $featured_image_blog = ''; //ig the post doen't has any image }else{ $featured_image_blog = 'no image avaiable'; } } } return wp_kses( $featured_image_blog, array( 'img' => array( 'width' => array(), 'height' => array(), 'src' => array(), 'class' => array(), 'alt' => array(), 'srcset' => array(), 'sizes' => array() ) ) ); } if ( ! file_exists( get_template_directory() . '/assets/bootstrap-navwalker.php' ) ) { // file does not exist... return an error. return new WP_Error( 'class-wp-bootstrap-navwalker-missing', __( 'It appears the bootstrap-navwalker.php file may be missing.', 'buildx' ) ); } else { // file exists... require it. require_once get_template_directory() . '/assets/bootstrap-navwalker.php'; } function buildx_the_posts_navigation(){ if( is_home() || is_archive() ){ // Don't print empty markup if there's only one page. if ( $GLOBALS['wp_query']->max_num_pages < 2 ) { return; } ?>
'«', 'next_text' => '»' )); }else{ ?>