=' ) { if ( empty( $version_to_compare ) ) { return true; } global $wp_version; // Check if using WordPress version 3.7 or higher. return version_compare( $wp_version, $version_to_compare, $operator ); } /** * Tag name to full tag conversion. * * @param array $meta_tag Tag option. * @return string */ public static function short_tag_to_html( $meta_tag ) { $exclude_tag_string = ''; foreach ( $meta_tag as $key => $value ) { $exclude_tag_string .= '<' . $value . '>,'; } return $exclude_tag_string; } /** * Content function. * * @param array $view_options Read more options array. * @param string $type Content type. * @return return */ public static function pcp_content( $view_options, $type ) { global $wp_embed; $post_content_ellipsis = isset( $view_options['post_content_ellipsis'] ) ? $view_options['post_content_ellipsis'] : ''; $pcp_strip_tags = isset( $view_options['pcp_strip_tags'] ) ? $view_options['pcp_strip_tags'] : ''; $pcp_allow_tag_name = isset( $view_options['pcp_allow_tag_name'] ) ? $view_options['pcp_allow_tag_name'] : ''; $allowed_tags = explode( ',', $pcp_allow_tag_name ); if ( 'full_content' === $type ) { $pcp_post_content = get_the_content(); } else { $pcp_post_content = get_the_excerpt(); } $pcp_post_content = do_shortcode( $wp_embed->autoembed( wpautop( trim( $pcp_post_content ) ) ) ); return $pcp_post_content; } /** * Thumbnail alter text * * @param integer $slide_id The slide/post ID. * * @return string */ public static function pcp_thumb_alter_text( $slide_id ) { $image_id = get_post_thumbnail_id( $slide_id ); $alt_text = get_post_meta( $image_id, '_wp_attachment_image_alt', true ); return $alt_text; } /** * Thumb Sized function * * @param array $post_thumb_setting Thumbnails options array. * @param integer $slide_id The slide/post ID. * * @return string */ public static function pcp_sized_thumb( $post_thumb_setting, $slide_id ) { $thumb_id = ''; $image = ''; if ( has_post_thumbnail( $slide_id ) ) { $thumb_id = get_post_thumbnail_id(); } $placeholder_img = SP_PC_URL . 'public/assets/img/placeholder.png'; $placeholder_img = apply_filters( 'pcp_no_thumb_placeholder', $placeholder_img ); if ( empty( $thumb_id ) && ! empty( $placeholder_img ) ) { $thumb_id = attachment_url_to_postid( $placeholder_img ); } if ( ! empty( $thumb_id ) ) { $image_sizes = isset( $post_thumb_setting['pcp_thumb_sizes'] ) ? $post_thumb_setting['pcp_thumb_sizes'] : ''; $image_src = wp_get_attachment_image_src( $thumb_id, $image_sizes ); $image_src = is_array( $image_src ) ? $image_src : array( '', '', '' ); $image = $image_src[0]; $image_width = $image_src[1]; $image_height = $image_src[2]; } elseif ( ! empty( $placeholder_img ) ) { $image = $placeholder_img; $image_width = 600; $image_height = 450; } $pcp_image_attr = array( 'src' => $image, 'width' => $image_width, 'height' => $image_height, ); return $pcp_image_attr; } /** * Process all the post meta. * * @param array $post_meta_fields The selected post meta to show. * @param string $meta_separator The post meta separator. * @return void */ public static function pcp_get_post_meta( $post_meta_fields, $meta_separator ) { $i = 0; foreach ( $post_meta_fields as $each_meta ) { $selected_meta = $each_meta['select_post_meta']; $meta_icon = ! empty( $each_meta['select_meta_icon'] ) ? sprintf( '' ) : ''; $meta_tag_start = apply_filters( 'pcp_post_meta_html_tag_start', '