';
if( ! is_single() && !is_page()):
if ( $type == 'content' ) {
the_content();
}else{
echo wp_kses_post( get_the_excerpt() );
}
else:
the_content();
endif;
echo '
';
}
/**
* Adds custom Read More link the_content().
* add_filter( 'the_content_more_link', array( $this,'content_read_more_link' ));
* @param string $more "Read more" excerpt string.
* @return string (Maybe) modified "read more" excerpt string.
*/
public function content_read_more_link( $more ) {
if ( is_admin() ) return $more;
return sprintf( '';
$post_blocks = parse_blocks( $post->post_content );
if( !empty( $post_blocks ) ):
$html .= '
';
foreach ( $post_blocks as $row ):
if( $row['blockName']=='core/gallery' ){
foreach ( $row['innerBlocks'] as $item ):
if( !empty($item["attrs"]["id"]) ):
$link = wp_get_attachment_url( $item["attrs"]["id"] );
$html .= '';
endif;
endforeach;
}
//
endforeach;
$html .= '';
endif;
$html .= '
';
elseif ( get_post_gallery() ) :
$html = '';
$html .= get_avatar( get_the_author_meta('user_email'), $size = '60');
$html .= '
';
$gallery = get_post_gallery( $post, false );
if( !empty($ids) ):
$ids = explode( ",", $gallery['ids'] );
foreach( $ids as $id ) {
$link = wp_get_attachment_url( $id );
$html .= '';
}
endif;
$html .= '';
$html .= '
';
else:
$html .= $this->get_image_thumbnail();
endif;
$html = apply_filters( 'bc_consulting_gallery_thumbnail', $html );
echo wp_kses( $html, $this->alowed_tags() );
}
/**
* Post formats audio.
*
* @since 1.0.0
*/
public function get_audio_thumbnail(){
$content = apply_filters( 'the_content', get_the_content() );
$audio = false;
$post_thumbnail_url = '';
$html = '';
// Only get audio from the content if a playlist isn't present.
if ( false === strpos( $content, 'wp-playlist-script' ) ) {
$audio = get_media_embedded_in_content( $content, array( 'audio' ) );
}
if ( has_post_thumbnail() ) :
$post_thumbnail_id = get_post_thumbnail_id( get_the_ID() );
$post_thumbnail_url = wp_get_attachment_url( $post_thumbnail_id );
endif;
// If not a single post, highlight the audio file.
if ( ! empty( $audio ) )
{ $i = 0;
$html = '';
foreach ( $audio as $audio_html ) : $i++;
if( $post_thumbnail_url != "" )
{
$html .= '
';
$html .= wp_kses( $audio_html, $this->alowed_tags() );
$html .= '
';
}else{
$html .= wp_kses( $audio_html, $this->alowed_tags() );
}
if( $i == 1 ){ break; }
endforeach;
$html .= '
';
}else {
$html .= $this->get_image_thumbnail();
}
$html = apply_filters( 'bc_consulting_audio_thumbnail', $html );
echo wp_kses( $html, $this->alowed_tags() );
}
/**
* Post formats video.
*
* @since 1.0.0
*/
public function get_video_thumbnail(){
$content = apply_filters( 'the_content', get_the_content(get_the_ID()) );
$video = false;
$html = '';
// Only get video from the content if a playlist isn't present.
if ( false === strpos( $content, 'wp-playlist-script' ) ) {
$video = get_media_embedded_in_content( $content, array( 'video', 'object', 'embed', 'iframe' ) );
}
if ( ! empty( $video ) )
{
$html = '';
$i = 0;
foreach ( $video as $video_html ) { $i++;
$html .= '
';
$html .= wp_kses( $video_html, $this->alowed_tags() );
$html .= '
';
if( $i == 1 ){ break; }
}
$html .= '
';
}else
{
$html .= $this->get_image_thumbnail();
}
$html = apply_filters( 'bc_consulting_video_thumbnail', $html );
echo wp_kses( $html, $this->alowed_tags() );
}
/**
* Post formats thumbnail.
*
* @since 1.0.0
*/
public function get_image_thumbnail(){
$html = '';
if ( has_post_thumbnail() ) :
$html = '';
$post_thumbnail_id = get_post_thumbnail_id( get_the_ID() );
$post_thumbnail_url = wp_get_attachment_url( $post_thumbnail_id );
if ( is_singular() )
{
$html .= '
';
} else
{
$html .= '';
}
$html .='';
$html .= get_the_post_thumbnail( get_the_ID(), 'full' );
$html .= '
';
endif;
$html = apply_filters( 'bc_consulting_image_thumbnail', $html );
echo wp_kses( $html, $this->alowed_tags() );
}
private function post_get_avatar( ) {
$html = '