function the_post_format_gallery_content() { global $post; /* check if user wants to display the ut gallery */ if (ot_get_option('blog_use_ut_gallery', 'on') == 'on') { echo ut_flex_slider(get_the_ID()); } else { $content = get_the_content(); $pattern = get_shortcode_regex(); preg_match("/{$pattern}/s", $content, $match); $shortcode = isset($match[0]) && !empty($match[0]) ? $match[0] : ''; echo do_shortcode($shortcode); } }
function ut_create_blog($atts, $content = null) { extract(shortcode_atts(array('numberposts' => '3', 'excerpt' => '', 'cat' => '', 'category_name' => '', 'class' => '', 'buttontext' => __('Read More', 'ut_shortcodes'), 'order' => 'DESC'), $atts)); $args = array('post_type' => 'post', 'cat' => $cat, 'category_name' => $category_name, 'posts_per_page' => $numberposts); /* blog output */ $blog = '<div class="ut-bs-wrap">'; /* initiate query */ $blog_query = new WP_Query($args); /* start loop */ if ($blog_query->have_posts()) { while ($blog_query->have_posts()) { $blog_query->the_post(); /* post format */ $post_format = get_post_format(); /* start single blog entry */ $blog .= '<div class="grid-33 tablet-grid-33 mobile-grid-100"><article id="post-' . $blog_query->post->ID . '" class="' . implode(" ", get_post_class("clearfix")) . '">'; /* entry header ( ho headline for quotes ) */ if ($post_format != 'quote') { $blog .= '<!-- entry-header --><header class="entry-header">'; $blog .= '<h3 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark" title="' . sprintf(__("Permanent Link to %s", "ut_shortcodes"), get_the_title()) . '">' . get_the_title() . '</a></h3>'; $blog .= '</header>'; } /* entry meta */ $blog .= '<div class="entry-meta">'; $blog .= '<span class="ut-sticky"><i class="fa fa-thumb-tack"></i>' . __("Sticky Post", "ut_shortcodes") . '</span>'; //$blog .= '<span class="author-links"><i class="fa fa-user"></i>' . __("By", "ut_shortcodes") . ' ' . get_author_posts_link() . '</span>'; $blog .= '<span class="date-format"><i class="fa fa-clock-o"></i>' . __("On", "ut_shortcodes") . ' <span>' . get_the_time(get_option("date_format")) . '</span></span>'; if (!post_password_required() && (comments_open() || '0' != get_comments_number())) { $blog .= '<span class="comments-link"><i class="fa fa-comments-o"></i>' . __("With", "ut_shortcodes") . ' ' . ut_get_comments_popup_link(__("No Comments", "ut_shortcodes"), __("1 Comment", "ut_shortcodes"), __("% Comments", "ut_shortcodes")) . '</span>'; } $blog .= '</div>'; /* post thumbnail */ if (has_post_thumbnail() && !post_password_required()) { $postthumbnail = wp_get_attachment_url(get_post_thumbnail_id($blog_query->post->ID)); $blog .= '<div class="entry-thumbnail">'; $blog .= '<a title="' . sprintf(__('Permanent Link to %s', 'ut_shortcodes'), get_the_title()) . '" href="' . get_permalink() . '">'; //$blog .= '<img alt="' . get_the_title() . '" class="wp-post-image" src="' . $postthumbnail . '">'; $blog .= get_the_post_thumbnail($blog_query->post->ID, "medium"); $blog .= '</a>'; $blog .= '</div>'; } /* post format gallery */ if ($post_format == 'gallery' && function_exists("ut_flex_slider")) { $blog .= ut_flex_slider($blog_query->post->ID, true); if (!empty($excerpt) && (int) $excerpt) { $the_content = ut_get_excerpt_by_id($blog_query->post->ID, $excerpt); } else { /* default content without gallery shortcode */ $the_content = get_the_content('<span class="more-link">' . __('Read more', 'ut_shortcodes') . '<i class="fa fa-chevron-circle-right"></i></span>'); $the_content = preg_replace('/(.?)\\[(gallery)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/\\2\\])?(.?)/s', '$1$6', $the_content); $the_content = apply_filters('the_content', $the_content); } } elseif ($post_format == 'gallery' && !function_exists("ut_flex_slider")) { /* default content with wordPress gallery shortcode */ if (!empty($excerpt) && (int) $excerpt) { $the_content = ut_get_excerpt_by_id($blog_query->post->ID, $excerpt); } else { $the_content = get_the_content('<span class="more-link">' . __('Read more', 'ut_shortcodes') . '<i class="fa fa-chevron-circle-right"></i></span>'); $the_content = apply_filters('the_content', $the_content); } } else { /* content for all other post formats */ if (!empty($excerpt) && (int) $excerpt) { $the_content = ut_get_excerpt_by_id($blog_query->post->ID, $excerpt); } else { $the_content = get_the_content('<span class="more-link">' . __('Read more', 'ut_shortcodes') . '<i class="fa fa-chevron-circle-right"></i></span>'); $the_content = apply_filters('the_content', $the_content); } } /* post content */ $blog .= '<!-- entry-content --><div class="entry-content clearfix">'; /* add content which has been defined above */ $blog .= $the_content; $blog .= '</div><!-- close entry-content -->'; /* end single blog entry */ $blog .= '</article></div><!-- close post -->'; /* loop finished */ } } /* Restore original Post Data */ wp_reset_postdata(); $blog .= '<div class="clear"></div>'; /* create link to blog */ $blog_id = get_option('page_for_posts'); $blog .= '<div class="ut-bs-holder"><a class="ut-bs-btn" href="' . get_permalink($blog_id) . '">' . $buttontext . '</a></div>'; $blog .= '</div>'; return $blog; }