Example #1
0
function ua_webtide_add_twitter_card()
{
    global $post;
    // Get our description - use Facebook OG
    $description = isset($post) && isset($post->ID) ? get_post_meta($post->ID, '_yoast_wpseo_opengraph-description', true) : NULL;
    // If no OG description, get excerpt
    if (!$description && isset($post->post_excerpt)) {
        $description = wp_trim_excerpt($post->post_excerpt);
    }
    // Get the image
    $image = isset($post) && isset($post->ID) ? get_post_meta($post->ID, '_yoast_wpseo_opengraph-image', true) : 'https://webtide.ua.edu/wp-content/uploads/wwWebTide-logo-fb-og-w-c.png';
    ?>
<meta name="twitter:card" content="summary_large_image">
	<meta name="twitter:site" content="@bamawebtide">
	<meta name="twitter:title" content="<?php 
    echo get_bloginfo('name');
    ?>
" />
	<meta name="twitter:description" content="<?php 
    echo $description;
    ?>
">
	<meta name="twitter:image:src" content="<?php 
    echo $image;
    ?>
"><?php 
}
 /**
  * @ticket 25349
  */
 public function test_secondary_loop_respect_nextpage()
 {
     $post1 = self::factory()->post->create(array('post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2'));
     $post2 = self::factory()->post->create(array('post_content' => 'Post 2 Page 1<!--nextpage-->Post 2 Page 2'));
     $this->go_to('/?p=' . $post1);
     setup_postdata(get_post($post1));
     $q = new WP_Query(array('post__in' => array($post2)));
     if ($q->have_posts()) {
         while ($q->have_posts()) {
             $q->the_post();
             $this->assertSame('Post 2 Page 1', wp_trim_excerpt());
         }
     }
 }
 function modify($posts, $type)
 {
     if (count($posts) > 0) {
         foreach ($posts as $pos => $post) {
             if ($type == 'excerpt') {
                 $posts[$pos]->post_content = wp_trim_excerpt($post->post_content);
             } else {
                 if ($type == 'content') {
                     $posts[$pos]->post_excerpt = $post->post_content;
                 }
             }
         }
     }
     return $posts;
 }
Example #4
0
 /**
  * Fetches an instance of Exporter.
  *
  * @return Exporter
  * @access public
  */
 public function fetch_exporter()
 {
     do_action('apple_news_do_fetch_exporter', $this->id);
     // Fetch WP_Post object, and all required post information to fill up the
     // Exporter_Content instance.
     $post = get_post($this->id);
     // Build the excerpt if required
     $excerpt = empty($post->post_excerpt) ? wp_trim_excerpt($post->post_content) : $post->post_excerpt;
     // Get the post thumbnail
     $post_thumb = wp_get_attachment_url(get_post_thumbnail_id($this->id)) ?: null;
     // Get the author
     $author = ucfirst(get_the_author_meta('display_name', $post->post_author));
     // Set the default date format
     $date_format = 'M j, Y | g:i A';
     // Check for a custom byline format
     $byline_format = $this->get_setting('byline_format');
     if (!empty($byline_format)) {
         // Find and replace the author format placeholder the name, if set
         $byline = str_replace('#author#', $author, $byline_format);
         // Attempt to parse the date format from the remaining string
         $matches = array();
         preg_match('/#(.*?)#/', $byline, $matches);
         if (!empty($matches[1])) {
             // Set the date using the custom format
             $byline = str_replace($matches[0], date($matches[1], strtotime($post->post_date)), $byline);
         }
     } else {
         // Use the default format
         $byline = sprintf('by %1$s | %2$s', $author, date($date_format, strtotime($post->post_date)));
     }
     // Filter each of our items before passing into the exporter class.
     $title = apply_filters('apple_news_exporter_title', $post->post_title, $post->ID);
     $excerpt = apply_filters('apple_news_exporter_excerpt', $excerpt, $post->ID);
     $post_thumb = apply_filters('apple_news_exporter_post_thumb', $post_thumb, $post->ID);
     $date = apply_filters('apple_news_exporter_date', $date, $post->ID);
     $byline = apply_filters('apple_news_exporter_byline', $byline, $post->ID);
     // The post_content is not raw HTML, as WordPress editor cleans up
     // paragraphs and new lines, so we need to transform the content to
     // HTML. We use 'the_content' filter for that.
     $content = apply_filters('apple_news_exporter_content_pre', $post->post_content, $post->ID);
     $content = apply_filters('the_content', $content);
     $content = apply_filters('apple_news_exporter_content', $content, $post->ID);
     // Now pass all the variables into the Exporter_Content array.
     $base_content = new Exporter_Content($post->ID, $title, $content, $excerpt, $post_thumb, $byline, $this->fetch_content_settings());
     return new Exporter($base_content, null, $this->settings);
 }
 public function pagebuilder_tags($tags)
 {
     // Page Builder stuff
     if (class_exists('ModularPageBuilder\\Plugin') && is_singular()) {
         $mpb = \ModularPageBuilder\Plugin::get_instance();
         $builder = $mpb->get_builder('modular-page-builder');
         $html = $builder->get_rendered_data(get_the_ID(), $builder->id . '-data');
         if (empty($tags['og:description'])) {
             $tags['og:description'] = wp_trim_excerpt(strip_tags($html));
         }
         foreach ($builder->get_raw_data(get_the_ID()) as $module_args) {
             if ($module = $mpb->init_module($module_args['name'], $module_args)) {
                 if ('image' === $module_args['name'] && !has_post_thumbnail()) {
                     $tags['og:image'] = $module->get_json()['image'][0][0];
                     break;
                 }
             }
         }
     }
     return $tags;
 }
function easy_t_get_single_testimonial_html($postid, $atts, $is_single = false)
{
    //for use in the filter
    $atts['is_single'] = $is_single;
    //if this is being loaded from the single post view
    //then we already have the post data setup (we are in The Loop)
    //so skip this step
    if (!$is_single) {
        global $post;
        $post = get_post($postid, OBJECT);
        setup_postdata($post);
    }
    extract($atts);
    ob_start();
    $testimonial['date'] = get_the_date('M. j, Y');
    if ($use_excerpt) {
        $testimonial['content'] = get_the_excerpt();
    } else {
        $testimonial['content'] = get_the_content();
    }
    //load rating
    //if set, append english text to it
    $testimonial['rating'] = get_post_meta($postid, '_ikcf_rating', true);
    $testimonial['num_stars'] = '';
    //reset num stars (Thanks Steve@IntegrityConsultants!)
    if (strlen($testimonial['rating']) > 0) {
        $rating_css = easy_testimonials_build_typography_css('easy_t_rating_');
        $testimonial['num_stars'] = $testimonial['rating'];
        $testimonial['rating'] = '<p class="easy_t_ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" style="' . $rating_css . '"><meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue" >' . $testimonial['rating'] . '</span>/<span itemprop="bestRating">5</span> Stars.</p>';
    }
    //if nothing is set for the short content, use the long content
    if (strlen($testimonial['content']) < 2) {
        //$temp_post_content = get_post($postid);
        $testimonial['content'] = $post->post_excerpt;
        if ($use_excerpt) {
            if ($testimonial['content'] == '') {
                $testimonial['content'] = wp_trim_excerpt($post->post_content);
            }
        } else {
            $testimonial['content'] = $post->post_content;
        }
    }
    if (strlen($show_rating) > 2) {
        if ($show_rating == "before") {
            $testimonial['content'] = $testimonial['rating'] . ' ' . $testimonial['content'];
        }
        if ($show_rating == "after") {
            $testimonial['content'] = $testimonial['content'] . ' ' . $testimonial['rating'];
        }
    }
    if ($show_thumbs) {
        $testimonial['image'] = build_testimonial_image($postid);
    }
    $testimonial['client'] = get_post_meta($postid, '_ikcf_client', true);
    $testimonial['position'] = get_post_meta($postid, '_ikcf_position', true);
    $testimonial['other'] = get_post_meta($postid, '_ikcf_other', true);
    build_single_testimonial($testimonial, $show_thumbs, $show_title, $postid, $author_class, $body_class, $testimonials_link, $theme, $show_date, $show_rating, $show_other, $width, $is_single);
    wp_reset_postdata();
    $content = ob_get_contents();
    ob_end_clean();
    return apply_filters('easy_t_get_single_testimonial_html', $content, $testimonial, $atts, $postid);
}
			<td><a href="<?php 
                bloginfo('url');
                ?>
/wp-admin/admin.php?page=bblm_plugin/pages/bb.admin.manage.dyk.php&action=edit&item=dyk&id=<?php 
                print "{$d->dyk_id}";
                ?>
" title="Edit this Did You Know"><?php 
                if ("none" !== $d->dyk_title) {
                    print "{$d->dyk_title}";
                } else {
                    print "Edit";
                }
                ?>
</a></td>
			<td><?php 
                print wp_trim_excerpt("{$d->dyk_desc}");
                ?>
</td>
<?php 
                if ($d->dyk_type) {
                    print "\t\t\t<td>Trivia</td>\n";
                } else {
                    print "\t\t\t<td>Fact</td>\n";
                }
                if ($d->dyk_show) {
                    print "\t\t\t<td><a href=\"";
                    bloginfo('url');
                    print "/wp-admin/admin.php?page=bblm_plugin/pages/bb.admin.manage.dyk.php&action=edit&item=activate&id=" . $d->dyk_id . "\" title=\"Deactivate this Did You Know\">Deactivate</td>\n";
                } else {
                    print "\t\t\t<td><a href=\"";
                    bloginfo('url');
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $items_num = apply_filters('widget_items_num', empty($instance['items_num']) ? 3 : intval($instance['items_num']), $instance);
        if ($items_num < 1) {
            $items_num = 3;
        }
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        // end if title empty
        // query events
        $date_time_now = time();
        // to compare with
        $q_events = new WP_Query(array('post_type' => 'event', 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => '_order', 'posts_per_page' => $items_num, 'meta_query' => array(array('key' => '_finito', 'value' => $date_time_now, 'compare' => '>', 'type' => 'NUMERIC'))));
        if ($q_events->have_posts()) {
            ?>
		
		<ul class="list-unstyled">
		
		<?php 
            while ($q_events->have_posts()) {
                $q_events->the_post();
                ?>
			
            <li class="up-event-wrap">
                <h1 class="title-median">
                	<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title_attribute(array('before' => 'Permalink to: ', 'after' => ''));
                ?>
">
                	<?php 
                the_title();
                ?>
                	</a>
                </h1>
            	<?php 
                $event_start_date = vp_metabox('event.event_from');
                $event_end_date = vp_metabox('event.event_to');
                $event_start_time = vp_metabox('event.event_time_start');
                $event_end_time = vp_metabox('event.event_time_end');
                ?>
                <div class="up-event-meta clearfix">
                <?php 
                if ($event_start_date) {
                    ?>
<div class="up-event-date"><?php 
                    echo date_i18n(get_option('date_format'), strtotime($event_start_date));
                    ?>
</div><?php 
                }
                ?>
                <?php 
                if ($event_end_date) {
                    ?>
<div class="up-event-date"><?php 
                    echo date_i18n(get_option('date_format'), strtotime($event_end_date));
                    ?>
</div><?php 
                }
                ?>
                <?php 
                if ($event_start_time) {
                    ?>
<div class="up-event-time"><?php 
                    echo $event_start_time;
                    if ($event_end_time) {
                        echo ' - ' . $event_end_time;
                    }
                    ?>
</div><?php 
                }
                ?>
                </div>
                <p><?php 
                echo wp_trim_excerpt();
                ?>
</p>
            </li>
			
        <?php 
            }
            ?>
        
        </ul>
        
        <?php 
        } else {
            echo '<p>' . __('No Upcoming Events found!', 'kazaz') . '<p>';
        }
        wp_reset_query();
        // drop current query
        echo $after_widget;
    }
Example #9
0
        ?>
    <div class="item">
        <a href="<?php 
        echo esc_url(get_permalink());
        ?>
">
            <?php 
        if (has_post_thumbnail()) {
            echo woocommerce_get_product_thumbnail('shop_catalog');
        }
        ?>
        </a>
        <div class="carousel-caption">
            <?php 
        the_title(sprintf('<h6 class="product-title"><a href="%s">', esc_url(get_permalink())), '</a></h6>');
        ?>
            <?php 
        echo woocommerce_get_template('loop/price.php');
        ?>
            <?php 
        echo '<p>' . wp_trim_excerpt() . '</p>';
        ?>
        </div>
    </div>
<?php 
    }
    wp_reset_postdata();
}
?>
</div><!-- /.carousel -->
Example #10
0
/**
 * Techozoic Social Media Icons Function
 *
 * Echos the social media icon links and images as set in options.
 * 
 * 
 * @param       bool    function called from home page or single page
 *
 * @access    public
 * @since     1.8.8
 */
function tech_social_icons($home = true)
{
    global $tech, $post;
    $short_link = home_url() . "/?p=" . $post->ID;
    $home_icons = of_get_option('home_social_icons', array('delicious' => '1', 'digg' => '1', 'rss' => '1'));
    $single_icons = of_get_option('single_social_icons', array('delicious' => '1', 'digg' => '1', 'rss' => '1'));
    $image = get_template_directory_uri() . "/images/icons";
    $link = get_permalink();
    $title = $post->post_title;
    $email_title = preg_replace('/&/i', 'and', $title);
    $url_title = urlencode($post->post_title);
    $excerpt = urlencode(wp_trim_excerpt($post->post_excerpt));
    $excerpt_mail = wp_trim_excerpt($post->post_excerpt);
    $excerpt_mail = preg_replace("/&#?[a-z0-9]{2,8};/i", "", $excerpt_mail);
    $home_title = urlencode(get_bloginfo('name'));
    $social_links = array("delicious" => "<a href=\"http://delicious.com/post?url={$link}&amp;title={$url_title}\" title=\"" . __('del.icio.us this!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/delicious_16.png\" alt=\"" . __('del.icio.us this!', 'techozoic') . "\" /></a>", "digg" => "<a href=\"http://digg.com/submit?phase=2&amp;url={$link}&amp;title={$url_title} \" title=\"" . __('Digg this!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/digg_16.png\" alt=\"" . __('Digg this!', 'techozoic') . "\"/></a>", "email" => "<a href=\"mailto:?subject={$email_title}&amp;body={$excerpt_mail} {$link}\" title=\"" . __('Share this by email.', 'techozoic') . "\"><img src=\"{$image}/email_16.png\" alt=\"" . __('Share this by email.', 'techozoic') . "\"/></a>", "facebook" => "<a href=\"http://www.facebook.com/share.php?u={$link}&amp;t={$url_title}\" title=\"" . __('Share on Facebook!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/facebook_16.png\" alt=\"" . __('Share on Facebook!', 'techozoic') . "\"/></a>", "linkedin" => "<a href =\"http://www.linkedin.com/shareArticle?mini=true&amp;url={$link}&amp;title={$url_title}&amp;summary={$excerpt}&amp;source={$home_title}\" title=\"" . __('Share on LinkedIn!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/linkedin_16.png\" alt=\"" . __('Share on LinkedIn!', 'techozoic') . "\" /></a>", "myspace" => "<a href=\"http://www.myspace.com/Modules/PostTo/Pages/?u={$link}&amp;t={$url_title}\" title=\"" . __('Share on Myspace!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/myspace_16.png\" alt=\"" . __('Share on Myspace!', 'techozoic') . "\"/></a>", "newsvine" => "<a href=\"http://www.newsvine.com/_tools/seed&amp;save?u={$link}\" title=\"" . __('Share on NewsVine!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/newsvine_16.png\" alt=\"" . __('Share on NewsVine!', 'techozoic') . "\"/></a>", "stumbleupon" => "<a href=\"http://www.stumbleupon.com/submit?url={$link}&amp;title={$url_title}\" title=\"" . __('Stumble Upon this!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/stumbleupon_16.png\" alt=\"" . __('Stumble Upon this!', 'techozoic') . "\"/></a>", "twitter" => "<a href=\"http://twitter.com/home?status=Reading%20{$url_title}%20on%20{$short_link}\" title=\"" . __('Tweet this!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/twitter_16.png\" alt=\"" . __('Tweet this!', 'techozoic') . "\"/></a>", "reddit" => "<a href=\"http://reddit.com/submit?url={$link}&amp;title={$url_title}\" title=\"" . __('Share on Reddit!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/reddit_16.png\" alt=\"" . __('Share on Reddit!', 'techozoic') . "\" /></a>", "rss" => "<a href=\"" . get_post_comments_feed_link() . "\" title=\"" . __('Subscribe to Feed', 'techozoic') . "\"><img src=\"{$image}/rss_16.png\" alt=\"" . __('RSS 2.0', 'techozoic') . "\"/></a>", "google" => "<g:plusone size=\"small\" annotation=\"none\" expandto=\"right\" href=\"{$link}\"></g:plusone>");
    if ($home == true) {
        if (is_array($home_icons)) {
            foreach ($home_icons as $key => $value) {
                if ($value == "1") {
                    echo $social_links[$key] . "&nbsp;";
                }
            }
        }
    } else {
        if (is_array($single_icons)) {
            foreach ($single_icons as $key => $value) {
                if ($value == "1") {
                    echo $social_links[$key] . "&nbsp;";
                }
            }
        }
    }
}
function sc_upcoming_events($atts, $content = NULL)
{
    extract(shortcode_atts(array('section_title' => '', 'items_number' => 3), $atts));
    $output = '';
    $ppp = 3;
    if (!empty($items_number)) {
        $ppp = intval($items_number);
    }
    if ($ppp < 1) {
        $ppp = 3;
    }
    if (!empty($section_title)) {
        $output .= '<h1 class="title-widget">' . esc_attr($section_title) . '</h1>';
    }
    // query events
    $date_time_now = time();
    // to compare with
    $q_events = new WP_Query(array('post_type' => 'event', 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => '_order', 'posts_per_page' => $ppp, 'meta_query' => array(array('key' => '_finito', 'value' => $date_time_now, 'compare' => '>', 'type' => 'NUMERIC'))));
    if (!$q_events->have_posts()) {
        $output .= '<div class="alert alert-danger">' . __('No entries found!', 'kazaz') . '</div>';
    } else {
        $output .= '<ul class="list-unstyled">';
        while ($q_events->have_posts()) {
            $q_events->the_post();
            $output .= '<li class="up-event-wrap">';
            $output .= '<h1 class="title-median">';
            $output .= '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '">';
            $output .= esc_attr(get_the_title());
            $output .= '</a>';
            $output .= '</h1>';
            // grab meta...
            $event_start_date = vp_metabox('event.event_from');
            $event_end_date = vp_metabox('event.event_to');
            $event_start_time = vp_metabox('event.event_time_start');
            $event_end_time = vp_metabox('event.event_time_end');
            $output .= '<div class="up-event-meta clearfix">';
            if ($event_start_date) {
                $output .= '<div class="up-event-date">' . date_i18n(get_option('date_format'), strtotime($event_start_date)) . '</div>';
            }
            if ($event_end_date) {
                $output .= '<div class="up-event-date">' . date_i18n(get_option('date_format'), strtotime($event_end_date)) . '</div>';
            }
            if ($event_start_time) {
                $output .= '<div class="up-event-time">' . $event_start_time;
                if ($event_end_time) {
                    $output .= ' - ' . $event_end_time;
                }
                $output .= '</div>';
            }
            $output .= '</div>';
            $output .= '<p>' . wp_trim_excerpt() . '</p>';
            $output .= '</li>';
        }
        $output .= '</ul>';
    }
    wp_reset_query();
    // drop current query
    return $output;
}
 /**
  * Update the SEO key tags values on wordpress "wp" action,
  * such as %%title%%, %%excerpt%%, values can only be initialised after "wp" action
  * @internal
  */
 public function _theme_action_update_seo_tags($location)
 {
     if (empty($this->seo_tags)) {
         $this->get_seo_tags();
     }
     switch ($location['type']) {
         case 'search':
             $this->seo_tags['searchphrase']['value'] = get_search_query();
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'author_archive':
             $this->seo_tags['author_id']['value'] = get_query_var('author');
             $this->seo_tags['author_name']['value'] = get_the_author_meta('nickname', get_query_var('author'));
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'date_archive':
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'front_page':
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'blog_page':
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'singular':
             global $post;
             $this->seo_tags['date']['value'] = get_the_date();
             $this->seo_tags['title']['value'] = get_the_title();
             $this->seo_tags['excerpt']['value'] = has_excerpt() ? get_the_excerpt() : wp_trim_excerpt();
             $this->seo_tags['excerpt_only']['value'] = has_excerpt() ? get_the_excerpt() : '';
             $this->seo_tags['modified']['value'] = $post->post_modified;
             $this->seo_tags['id']['value'] = $post->ID;
             $this->seo_tags['author_id']['value'] = $post->post_author;
             $this->seo_tags['author_name']['value'] = get_the_author_meta('nickname', $post->post_author);
             if ($location['post_type'] == 'attachment') {
                 $this->seo_tags['caption']['value'] = has_excerpt() ? get_the_excerpt() : '';
             }
             $categories = wp_get_post_categories($post->ID);
             foreach ($categories as $cat_id) {
                 $category = get_category($cat_id);
                 $this->seo_tags['post_categories']['value'] .= $category->name . ', ';
             }
             $this->seo_tags['post_categories']['value'] = rtrim($this->seo_tags['post_categories']['value'], ', ');
             $tags = wp_get_post_tags($post->ID);
             foreach ($tags as $tag_id) {
                 $tag = get_tag($tag_id);
                 $this->seo_tags['post_tags']['value'] .= $tag->name . ', ';
             }
             $this->seo_tags['post_tags']['value'] = rtrim($this->seo_tags['post_tags']['value'], ', ');
             break;
         case 'tag':
             $this->seo_tags['title']['value'] = single_term_title('', false);
             $this->seo_tags['description']['value'] = term_description($location['id'], $location['taxonomy_type']);
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'category':
             $this->seo_tags['title']['value'] = single_term_title('', false);
             $this->seo_tags['description']['value'] = term_description($location['id'], $location['taxonomy_type']);
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'taxonomy':
             $this->seo_tags['title']['value'] = single_term_title('', false);
             $this->seo_tags['description']['value'] = term_description($location['id'], $location['taxonomy_type']);
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
     }
     $this->seo_tags = apply_filters('fw_ext_seo_update_tags', $this->seo_tags, $location);
 }
 private function get_post($post, $params)
 {
     $attachments = array('images' => array(), 'videos' => array(), 'audio' => array());
     $this->attachments =& $attachments;
     $is_user_logged_in = isset($params['session_id']);
     $include_raw_post = isset($params['include_raw_post']);
     $is_reqistration_required = '1' == get_option('comment_registration');
     $remaped_post = $this->array_remap_keys($post, array('ID' => 'post_id', 'post_date_gmt' => 'published_at', 'post_title' => 'title', 'post_excerpt' => 'summary', 'post_content' => 'body', 'comment_status' => 'commentable', 'comment_count' => 'comments_count'));
     $post_categories = wp_get_post_categories($remaped_post['post_id']);
     $categories = array();
     $tags = array();
     foreach ($post_categories as $category) {
         $cat = get_category($category);
         $categories[] = array('id' => $cat->cat_ID, 'name' => $cat->name);
     }
     $remaped_post['categories'] = $categories;
     //*** ACTION  shoutem_get_post_start ***//
     //Integration with external plugins will usually hook to this action to
     //substitute shortcodes or generate appropriate attachments from the content.
     //For example: @see ShoutemNGGDao, @see ShoutemFlaGalleryDao.
     do_action('shoutem_get_post_start', array('wp_post' => $post, 'attachments_ref' => &$attachments));
     $body = apply_filters('the_content', do_shortcode($remaped_post['body']));
     if ($include_raw_post) {
         $remaped_post['raw_post'] = $body;
     }
     $striped_attachments = array();
     $remaped_post['body'] = sanitize_html($body, $striped_attachments);
     $user_data = get_userdata($post->post_author);
     $remaped_post['author'] = $user_data->display_name;
     $remaped_post['likeable'] = 0;
     $remaped_post['likes_count'] = 0;
     $remaped_post['link'] = get_permalink($remaped_post['post_id']);
     $this->include_leading_image_in_attachments($attachments, $post->ID);
     $attachments['images'] = array_merge($attachments['images'], $striped_attachments['images']);
     $attachments['videos'] = array_merge($attachments['videos'], $striped_attachments['videos']);
     $attachments['audio'] = array_merge($attachments['audio'], $striped_attachments['audio']);
     sanitize_attachments($attachments);
     $remaped_post['attachments'] = $attachments;
     $remaped_post['image_url'] = '';
     $images = $attachments['images'];
     if (count($images) > 0) {
         $remaped_post['image_url'] = $images[0]['src'];
     }
     $post_commentable = $remaped_post['commentable'] == 'open';
     if (!$this->options['enable_wp_commentable']) {
         $remaped_post['commentable'] = 'no';
     } else {
         if (array_key_exists('commentable', $params)) {
             $remaped_post['commentable'] = $params['commentable'];
         } else {
             $remaped_post['commentable'] = $this->get_commentable($post_commentable, $is_user_logged_in, $is_reqistration_required);
         }
     }
     if ($this->options['enable_fb_commentable']) {
         $remaped_post['fb_commentable'] = 'yes';
     }
     if (!$remaped_post['summary']) {
         $remaped_post['summary'] = wp_trim_excerpt(apply_filters('the_excerpt', get_the_excerpt()));
         $remaped_post['summary'] = html_to_text($remaped_post['summary']);
     }
     $remaped_post['title'] = html_to_text($remaped_post['title']);
     $remaped_posts[] = $remaped_post;
     return $remaped_post;
 }
function outputTestimonialsCycle($atts)
{
    //load shortcode attributes into an array
    extract(shortcode_atts(array('testimonials_link' => get_option('testimonials_link'), 'show_title' => 0, 'count' => -1, 'transition' => 'scrollHorz', 'show_thumbs' => '', 'timer' => '2000', 'container' => false, 'use_excerpt' => false, 'auto_height' => false, 'category' => '', 'body_class' => 'testimonial_body', 'author_class' => 'testimonial_author', 'random' => '', 'orderby' => 'date', 'order' => 'ASC', 'pager' => false, 'show_pager_icons' => false, 'show_rating' => false, 'testimonials_per_slide' => 1, 'theme' => '', 'show_date' => false, 'show_other' => false, 'pause_on_hover' => false, 'prev_next' => false, 'width' => false, 'paused' => false), $atts));
    $show_thumbs = $show_thumbs == '' ? get_option('testimonials_image') : $show_thumbs;
    if (!is_numeric($count)) {
        $count = -1;
    }
    ob_start();
    $i = 0;
    if (!isValidKey() && !in_array($transition, array('fadeOut', 'fade', 'scrollHorz'))) {
        $transition = 'fadeout';
    }
    //use random WP query to be sure we aren't just randomly sorting a chronologically queried set of testimonials
    //this prevents us from just randomly ordering the same 5 testimonials constantly!
    if ($random) {
        $orderby = "rand";
    }
    //determine if autoheight is set to container or to calculate
    //not sure why i did this so backwards to begin with!  oh well...
    if ($container) {
        $container = "container";
    }
    if ($auto_height == "calc") {
        $container = "calc";
    } else {
        if ($auto_height == "container") {
            $container = "container";
        }
    }
    ?>
	
	<div class="cycle-slideshow" 
		data-cycle-fx="<?php 
    echo $transition;
    ?>
" 
		data-cycle-timeout="<?php 
    echo $timer;
    ?>
"
		data-cycle-slides="> div.testimonial_slide"
		<?php 
    if ($container) {
        ?>
 data-cycle-auto-height="<?php 
        echo $container;
        ?>
" <?php 
    }
    ?>
		<?php 
    if ($random) {
        ?>
 data-cycle-random="true" <?php 
    }
    ?>
		<?php 
    if ($pause_on_hover) {
        ?>
 data-cycle-pause-on-hover="true" <?php 
    }
    ?>
		<?php 
    if ($paused) {
        ?>
 data-cycle-paused="true" <?php 
    }
    ?>
		<?php 
    if ($prev_next) {
        ?>
 data-cycle-prev=".easy-t-cycle-prev"  data-cycle-next=".easy-t-cycle-next" <?php 
    }
    ?>
	>
	<?php 
    $counter = 0;
    //load testimonials into an array
    $loop = new WP_Query(array('post_type' => 'testimonial', 'posts_per_page' => $count, 'orderby' => $orderby, 'order' => $order, 'easy-testimonial-category' => $category));
    while ($loop->have_posts()) {
        $loop->the_post();
        if ($counter == 0) {
            $testimonial_display = '';
        } else {
            $testimonial_display = 'style="display:none;"';
        }
        if ($counter % $testimonials_per_slide == 0) {
            ?>
<div <?php 
            echo $testimonial_display;
            ?>
 class="testimonial_slide"><?php 
        }
        $counter++;
        $postid = get_the_ID();
        $testimonial['date'] = get_the_date('M. j, Y');
        //if nothing is set for the short content, use the long content
        if ($use_excerpt) {
            $testimonial['content'] = get_the_excerpt();
        } else {
            $testimonial['content'] = get_the_content();
        }
        //load rating
        //if set, append english text to it
        $testimonial['rating'] = get_post_meta($postid, '_ikcf_rating', true);
        $testimonial['num_stars'] = '';
        //reset num stars (Thanks Steve@IntegrityConsultants!)
        if (strlen($testimonial['rating']) > 0) {
            $testimonial['num_stars'] = $testimonial['rating'];
            $testimonial['rating'] = '<p class="easy_t_ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue">' . $testimonial['rating'] . '</span>/<span itemprop="bestRating">5</span> Stars.</p>';
            //$testimonial['rating'] = '<span class="easy_t_ratings">' . $testimonial['rating'] . '/5 Stars.</span>';
        }
        //if nothing is set for the short content, use the long content
        if (strlen($testimonial['content']) < 2) {
            $temp_post_content = get_post($postid);
            $testimonial['content'] = $temp_post_content->post_excerpt;
            if ($use_excerpt) {
                if ($testimonial['content'] == '') {
                    $testimonial['content'] = wp_trim_excerpt($temp_post_content->post_content);
                }
            } else {
                $testimonial['content'] = $temp_post_content->post_content;
            }
        }
        if (strlen($show_rating) > 2) {
            if ($show_rating == "before") {
                $testimonial['content'] = $testimonial['rating'] . ' ' . $testimonial['content'];
            }
            if ($show_rating == "after") {
                $testimonial['content'] = $testimonial['content'] . ' ' . $testimonial['rating'];
            }
        }
        if ($show_thumbs) {
            $testimonial['image'] = build_testimonial_image($postid);
        }
        $testimonial['client'] = get_post_meta($postid, '_ikcf_client', true);
        $testimonial['position'] = get_post_meta($postid, '_ikcf_position', true);
        $testimonial['other'] = get_post_meta($postid, '_ikcf_other', true);
        echo build_single_testimonial($testimonial, $show_thumbs, $show_title, $postid, $author_class, $body_class, $testimonials_link, $theme, $show_date, $show_rating, $show_other, $width);
        if ($counter % $testimonials_per_slide == 0) {
            ?>
</div><?php 
        }
    }
    wp_reset_query();
    //display pager icons
    if ($pager || $show_pager_icons) {
        ?>
<div class="cycle-pager"></div><?php 
    }
    ?>
	</div>
	<?php 
    //display previous and next buttons
    //do it after the closing div so it is outside of the slideshow container
    if ($prev_next) {
        ?>
<div class="cycle-prev easy-t-cycle-prev">&lt;&lt; Prev </div>
		<div class="cycle-next easy-t-cycle-next">Next &gt;&gt;</div><?php 
    }
    $content = ob_get_contents();
    ob_end_clean();
    return apply_filters('easy_t_testimonials_cyle_html', $content);
}
Example #15
0
    the_permalink();
    ?>
" title="<?php 
    the_title_attribute();
    ?>
" >
                    <?php 
    the_post_thumbnail();
    ?>
                </a>
            </div>
        <?php 
}
?>

        <div class="entry-content-small">
            <?php 
echo wp_trim_excerpt();
#the_excerpt();
?>
            <?php 
echo get_post_custom_values('fb_link')[0];
wp_link_pages(array('before' => '<div class="page-links">' . 'Страницы:', 'after' => '</div>'));
?>
        </div><!-- .entry-content-small -->
        <?php 
edit_post_link(__('Редактировать', 'maza'), '<footer class="entry-meta container"><span class="edit-link">', '</span></footer>');
?>
    </div>
</article>
<hr class="section-divider">
Example #16
0
function easy_t_get_single_testimonial_html($postid, $atts)
{
    global $post;
    $post = get_post($postid, OBJECT);
    setup_postdata($post);
    extract($atts);
    ob_start();
    $testimonial['date'] = get_the_date('M. j, Y');
    if ($use_excerpt) {
        $testimonial['content'] = get_the_excerpt();
    } else {
        $testimonial['content'] = get_the_content();
    }
    //load rating
    //if set, append english text to it
    $testimonial['rating'] = get_post_meta($postid, '_ikcf_rating', true);
    $testimonial['num_stars'] = '';
    //reset num stars (Thanks Steve@IntegrityConsultants!)
    if (strlen($testimonial['rating']) > 0) {
        $testimonial['num_stars'] = $testimonial['rating'];
        $testimonial['rating'] = '<p class="easy_t_ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue">' . $testimonial['rating'] . '</span>/<span itemprop="bestRating">5</span> Stars.</p>';
        //$testimonial['rating'] = '<span class="easy_t_ratings">' . $testimonial['rating'] . '/5 Stars.</span>';
    }
    //if nothing is set for the short content, use the long content
    if (strlen($testimonial['content']) < 2) {
        //$temp_post_content = get_post($postid);
        $testimonial['content'] = $post->post_excerpt;
        if ($use_excerpt) {
            if ($testimonial['content'] == '') {
                $testimonial['content'] = wp_trim_excerpt($post->post_content);
            }
        } else {
            $testimonial['content'] = $post->post_content;
        }
    }
    if (strlen($show_rating) > 2) {
        if ($show_rating == "before") {
            $testimonial['content'] = $testimonial['rating'] . ' ' . $testimonial['content'];
        }
        if ($show_rating == "after") {
            $testimonial['content'] = $testimonial['content'] . ' ' . $testimonial['rating'];
        }
    }
    if ($show_thumbs) {
        $testimonial['image'] = build_testimonial_image($postid);
    }
    $testimonial['client'] = get_post_meta($postid, '_ikcf_client', true);
    $testimonial['position'] = get_post_meta($postid, '_ikcf_position', true);
    $testimonial['other'] = get_post_meta($postid, '_ikcf_other', true);
    build_single_testimonial($testimonial, $show_thumbs, $show_title, $postid, $author_class, $body_class, $testimonials_link, $theme, $show_date, $show_rating, $show_other, $width);
    wp_reset_postdata();
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Example #17
0
/**
 * @param $content
 *
 * @return mixed|string
 */
function gmedia_post_type__the_excerpt($content)
{
    remove_filter('get_the_excerpt', 'gmedia_post_type__the_excerpt', 150);
    remove_filter('the_content', 'gmedia_post_type__the_content', 200);
    $content = wp_trim_excerpt();
    return gmedia_post_type__the_content($content);
}
 /**
  * AAGoogle404Handler::related_posts()
  *
  * @param integer $limit
  * @param integer $len
  * @return
  */
 function related_posts($limit = 15, $len = 120)
 {
     //error_log(__FUNCTION__.':'.__LINE__);
     global $wpdb;
     $terms = $this->get_keywords(' ');
     if (strlen($terms) < 3) {
         return;
     }
     $sql = "SELECT ID, post_title, post_name, post_content, MATCH (post_name, post_content) AGAINST ('{$terms}') AS `score` FROM {$wpdb->posts} WHERE MATCH (post_name, post_content) AGAINST ('{$terms}') " . "AND post_type = 'post' AND post_status = 'publish' AND post_password = '' AND post_date < '" . current_time('mysql') . "' ORDER BY score DESC LIMIT {$limit}";
     $results = $wpdb->get_results($wpdb->prepare($sql));
     if ($results) {
         //error_log(__FUNCTION__.':'.__LINE__);
         foreach ($results as $result) {
             printf('%4$s<h4><a href="%1$s" title="%2$s">%2$s</a></h4>%4$s<blockquote cite="%1$s">%4$s<p>%3$s...</p>%4$s</blockquote>%4$s', get_permalink($result->ID), attribute_escape(stripslashes(apply_filters('the_title', $result->post_title))), substr(wp_trim_excerpt(stripslashes(strip_tags($result->post_content))), 0, $len), "\n");
         }
     }
 }
Example #19
0
 function get($data)
 {
     $post = get_post($data['post_id']);
     $this->set_post_global($data['post_id']);
     return wp_trim_excerpt($post->post_excerpt);
 }
Example #20
0
<section <?php 
post_class('row');
?>
>

<?php 
$args = array('post_type' => 'ecoregion', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => '-1');
$loop = new WP_Query($args);
$popup_content_array = array();
if ($loop->have_posts()) {
    while ($loop->have_posts()) {
        $loop->the_post();
        //get content material for svg popup
        $region_title = the_title('', '', false);
        $region_content = wp_trim_excerpt(get_the_excerpt());
        $popup_content_array[$region_title] = $region_content;
        get_template_part('/templates/cpt-parts/part', 'ecoregion');
    }
}
?>

	<div class="compass main">

		<?php 
wp_enqueue_script('svgPopup', get_template_directory_uri() . '/assets/scripts/svgPopup.js');
wp_localize_script('svgPopup', 'svg_popup_vars', $popup_content_array);
?>

		<div class="ecoregion-svg">
			<img id="region-png" src="/media/ODFW_ecoregion_final_base.png"/>
Example #21
0
function getSubPageEntries($pid, $tagatt)
{
    global $wpdb;
    $query = "SELECT id, post_title, post_content, post_excerpt " . "FROM " . $wpdb->posts . " " . "WHERE post_parent = " . $pid . " AND post_status = 'static'";
    $count = 0;
    if ($xData = $wpdb->get_results($query)) {
        $iH .= $tagatt['pretext'];
        foreach ($xData as $MySub) {
            $mdat = $wpdb->get_var("SELECT meta_value FROM " . $wpdb->postmeta . " WHERE post_id = " . $MySub->id . " AND meta_key = 'description'");
            $meta = "";
            if ($mdat) {
                $meta = $mdat;
            }
            if (!$meta) {
                $meta = $MySub->post_content;
                $meta = wp_trim_excerpt($meta);
                $meta = strip_tags($meta);
            }
            if ($meta) {
                $meta .= '<br/>&nbsp;';
            }
            $str = str_replace(array('%id%', '%link%', '%title%', '%excerpt%'), array($MySub->id, get_permalink($MySub->id), $MySub->post_title, $meta), $tagatt['format']);
            //$iH .= '<li><a href="'.get_permalink($MySub->id).'">'.$MySub->post_title.'</a><br />' . $meta . '<br /></li>';
            if ($MySub->id == $tagatt['curpage'] && $tagatt['showcurrent'] != true) {
                continue;
            }
            $iH .= $str;
            $count++;
            if ($tagatt['recurse'] != false) {
                $iH .= getSubPageEntries($MySub->id, $tagatt);
            }
        }
        $iH .= $tagatt['posttext'];
    }
    if ($count == 0) {
        $iH = $tagatt['notext'];
    }
    return $iH;
}
 /**
  * A Excerpt method used across the board on our Events Plugin Suite.
  *
  * By default it removes all shortcodes, the reason for this is that shortcodes added by other plugins/themes
  * may not have been registered by the time our ajax responses are generated. To avoid leaving unparsed
  * shortcodes in our excerpts then we strip out anything that looks like one.
  *
  * @category Events
  *
  * @param  WP_Post|int|null $post The Post Object|ID, if null defaults to `get_the_ID()`
  * @param  array $allowed_html The wp_kses compatible array
  *
  * @return string|null Will return null on Bad Post Instances
  */
 function tribe_events_get_the_excerpt($post = null, $allowed_html = null)
 {
     // If post is not numeric or instance of WP_Post it defaults to the current Post ID
     if (!is_numeric($post) && !$post instanceof WP_Post) {
         $post = get_the_ID();
     }
     // If not a WP_Post we try to fetch it as one
     if (is_numeric($post)) {
         $post = WP_Post::get_instance($post);
     }
     // Prevent Non usable $post instances
     if (!$post instanceof WP_Post) {
         return null;
     }
     // Default Allowed HTML
     if (!is_array($allowed_html)) {
         $base_attrs = array('class' => array(), 'id' => array(), 'style' => array());
         $allowed_html = array('a' => array('class' => array(), 'id' => array(), 'style' => array(), 'href' => array(), 'rel' => array(), 'target' => array()), 'b' => $base_attrs, 'strong' => $base_attrs, 'em' => $base_attrs, 'span' => $base_attrs, 'ul' => $base_attrs, 'li' => $base_attrs, 'ol' => $base_attrs);
     }
     /**
      * Allow developers to filter what are the allowed HTML on the Excerpt
      *
      * @var array Must be compatible to wp_kses structure
      *
      * @link https://codex.wordpress.org/Function_Reference/wp_kses
      */
     $allowed_html = apply_filters('tribe_events_excerpt_allowed_html', $allowed_html, $post);
     /**
      * Allow shortcodes to be Applied on the Excerpt or not
      *
      * @var bool
      */
     $allow_shortcode = apply_filters('tribe_events_excerpt_allow_shortcode', false);
     // Get the Excerpt or content based on what is available
     if (has_excerpt($post->ID)) {
         $excerpt = $post->post_excerpt;
     } else {
         $excerpt = $post->post_content;
     }
     // Remove all shortcode Content before removing HTML
     if (!$allow_shortcode) {
         $excerpt = preg_replace('#\\[.+\\]#U', '', $excerpt);
     }
     // Remove "all" HTML based on what is allowed
     $excerpt = wp_kses($excerpt, $allowed_html);
     // Still treat this as an Excerpt on WP
     $excerpt = wp_trim_excerpt($excerpt);
     return wpautop($excerpt);
 }
 /**
  * @since 1.4.0
  *
  * @param $excerpt
  * @return string
  */
 public function override_excerpt_filters($excerpt)
 {
     return wp_trim_excerpt(wpautop(wptexturize($this->original_excerpt)));
 }
 public static function the_excerpt($the_excerpt)
 {
     CrayonLog::debug('excerpt');
     global $post;
     if (!empty($post->post_excerpt)) {
         // Use custom excerpt if defined
         $the_excerpt = wpautop($post->post_excerpt);
     } else {
         // Pass wp_trim_excerpt('') to gen from content (and remove [crayons])
         $the_excerpt = wpautop(wp_trim_excerpt(''));
     }
     // XXX Returning "" may cause it to default to full contents...
     return $the_excerpt . ' ';
 }
Example #25
0
            echo '" class="thumbnail-wrapper">';
            the_post_thumbnail();
            echo '</a>';
        } else {
            echo '<a href="';
            the_permalink();
            echo '" class="thumbnail-wrapper">';
            echo '<img src="';
            echo catch_that_image();
            echo '" alt="" />';
            echo '</a>';
        }
        ?>
											</div>
											<?php 
        echo _substr(wp_trim_excerpt(), 300, get_permalink());
        ?>
											<div><a class="more-link" href="<?php 
        the_permalink();
        ?>
"> Nhấn vào để đọc thêm</a></div>
										<div class="clearFix"></div>
									</div>
									</div>
									<div class="subFooting">
									<div class="tags-and-categories">
										<?php 
        the_tags();
        ?>
			
									</div>
 function easy_t_get_single_testimonial_html($is_single = false)
 {
     global $post;
     $postid = $this->testimonial->ID;
     //if this is being loaded from the single post view
     //then we already have the post data setup (we are in The Loop)
     //so skip this step
     if (!$is_single) {
         setup_postdata($this->testimonial);
     }
     //empty array to place all the testimonial data
     $testimonial = array();
     $testimonial['date'] = get_the_date('M. j, Y', $postid);
     if ($this->atts['use_excerpt'] && !$is_single) {
         $testimonial['content'] = $this->easy_t_get_the_excerpt($this->testimonial->ID);
     } else {
         $testimonial['content'] = get_post_field('post_content', $this->testimonial->ID);
     }
     //apply our content filter, if flag set
     if (get_option('easy_t_apply_content_filter', false) || $is_single) {
         $testimonial['content'] = $this->easy_testimonials_the_content_filter($testimonial['content']);
     } else {
         $testimonial['content'] = wpautop($testimonial['content']);
     }
     $testimonial['id'] = $this->testimonial->ID;
     //load rating
     //if set, append english text to it
     $testimonial['rating'] = get_post_meta($this->testimonial->ID, '_ikcf_rating', true);
     $testimonial['num_stars'] = '';
     //reset num stars (Thanks Steve@IntegrityConsultants!)
     if (strlen($testimonial['rating']) > 0) {
         $rating_css = $this->easy_testimonials_build_typography_css('easy_t_rating_');
         $testimonial['num_stars'] = $testimonial['rating'];
         $testimonial['rating'] = '<p class="easy_t_ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" style="' . $rating_css . '"><meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue" >' . htmlentities($testimonial['rating']) . '</span>/<span itemprop="bestRating">5</span> Stars.</p>';
     }
     //if nothing is set for the short content, use the long content
     if (strlen($testimonial['content']) < 2) {
         $testimonial['content'] = $post->post_excerpt;
         if ($this->atts['use_excerpt']) {
             if ($testimonial['content'] == '') {
                 $testimonial['content'] = wp_trim_excerpt($post->post_content);
             }
         } else {
             $testimonial['content'] = $post->post_content;
         }
     }
     if (strlen($this->atts['show_rating']) > 2) {
         if ($this->atts['show_rating'] == "before") {
             $testimonial['content'] = $testimonial['rating'] . ' ' . $testimonial['content'];
         }
         if ($this->atts['show_rating'] == "after") {
             $testimonial['content'] = $testimonial['content'] . ' ' . $testimonial['rating'];
         }
     }
     if ($this->atts['show_thumbs']) {
         $testimonial['image'] = $this->build_testimonial_image($this->testimonial->ID);
     }
     $testimonial['client'] = get_post_meta($this->testimonial->ID, '_ikcf_client', true);
     $testimonial['position'] = get_post_meta($this->testimonial->ID, '_ikcf_position', true);
     $testimonial['other'] = get_post_meta($this->testimonial->ID, '_ikcf_other', true);
     //if this testimonial doesn't have a value for the item being reviewed
     //and if the use global item reviewed setting is checked
     //use the global item reviewed value in for the current testimonial
     if (strlen($testimonial['other']) < 2 && get_option('easy_t_use_global_item_reviewed', false)) {
         $testimonial['other'] = get_option('easy_t_global_item_reviewed', '');
     }
     //load a list of of easy testimonial categories associated with this testimonial
     //loop through list and build a string of category slugs
     //we will append these to the wrapping HTML of the single testimonial for advanced customization
     $terms = wp_get_object_terms($this->testimonial->ID, 'easy-testimonial-category');
     $term_list = '';
     foreach ($terms as $term) {
         $term_list .= "easy-t-category-" . $term->slug . " ";
     }
     //build attribute based classes for extra customization options
     $atts_for_classes = array('thumbs' => $this->atts['show_thumbs'] ? 'show' : 'hide', 'title' => $this->atts['show_title'] ? 'show' : 'hide', 'date' => $this->atts['show_date'] ? 'show' : 'hide', 'rating' => $this->atts['show_rating'], 'other' => $this->atts['show_other'] ? 'show' : 'hide');
     $attribute_classes = $this->easy_t_build_classes_from_atts($atts_for_classes);
     //add the category slugs to the list of classes to output
     //make sure to include the extra space so we aren't butting classes up against each other
     $attribute_classes .= " " . $term_list;
     //get classes for current theme
     $output_theme = $this->easy_t_get_theme_class($this->atts['theme']);
     //get css from our typography settings
     $testimonial_body_css = $this->easy_testimonials_build_typography_css('easy_t_body_');
     //get width from our width option
     $width_style = $this->atts['width'] ? 'style="width: ' . $this->atts['width'] . '"' : 'style="width: ' . get_option('easy_t_width', '') . '"';
     //if the "Show View More Testimonials Link" option is checked
     //and the hide_view_more attribute is not set
     //then set $show_view_more to true
     //else set to false
     $show_view_more = get_option('easy_t_show_view_more_link', false) && !$this->atts['hide_view_more'] ? true : false;
     //last chance to customize attributes before rendering template
     extract(apply_filters('easy_t_display_attributes', $this->atts));
     //render single testimonial template
     ob_start();
     include $this->config->dir_path . "templates/single_testimonial.php";
     $output = ob_get_contents();
     ob_end_clean();
     wp_reset_postdata();
     //apply filter with the current output, the current testimonial array, the current attributes, and the current testimonial's ID
     return apply_filters('easy_t_get_single_testimonial_html', $output, $testimonial, $this->atts, $this->testimonial->ID);
 }
Example #27
0
 /**
  * Get the excerpt of the current post.
  *
  * @return string The excerpt of the current post.
  */
 public function excerpt($word_count = 40)
 {
     return wp_trim_words(empty($this->data->post_excerpt) ? wp_trim_excerpt(wp_strip_all_tags($this->content())) : $this->data->post_excerpt, $word_count);
 }
    }
} else {
    $sharedImage = $fallbackImage;
}
// Image fallback
if (empty($sharedImage)) {
    $sharedImage = $fallbackImage;
}
/*
 * This builds the summary text.
 */
if (is_single() || is_page()) {
    // If page has no children or is single, set the summary to the excerpt.
    $summary = get_the_excerpt();
    if (empty($summary)) {
        $summary = wp_trim_excerpt(strip_shortcodes($post->post_content));
    }
    // Fallback
    if (empty($summary)) {
        $summary = get_bloginfo('description');
    }
} else {
    $summary = get_bloginfo('description');
}
// Remove any links or tags from summary
$summary = strip_tags($summary);
$summary = esc_attr($summary);
// Remove line breaks
$summary = preg_replace('!\\s+!', ' ', $summary);
?>
 /**
  * Use the most recent public reply as the post excerpt
  * on the Manage Tickets view so mode=excerpt works well
  */
 public function filter_get_the_excerpt($orig)
 {
     if ($reply = array_pop(SupportFlow()->get_ticket_replies(get_the_ID()))) {
         $reply_author = get_post_meta($reply->ID, 'reply_author');
         return $reply_author . ': "' . wp_trim_excerpt($reply->post_content) . '"';
     } else {
         return $orig;
     }
 }
Example #30
0
    echo '</div>';
}
// AUTHOR INFO
if ($cite) {
    echo "<div class=\"testimonial_rotator_author_info cf-tr\">\n";
    echo wpautop($cite);
    echo "</div>\n";
}
echo "\t</div>\n";
// MICRODATA
if ($show_microdata) {
    $global_rating = $global_rating + $rating;
    echo "\t<div class=\"testimonial_rotator_microdata\">\n";
    if ($itemreviewed) {
        echo "\t<div class=\"fn\">{$itemreviewed}</div>\n";
    }
    if ($rating) {
        echo "\t<div class=\"rating\">{$rating}.0</div>\n";
    }
    echo "\t<div class=\"dtreviewed\"> " . get_the_date('c') . "</div>";
    echo "\t<div class=\"reviewer\"> ";
    echo "\t<div class=\"fn\"> " . wpautop($cite) . "</div>";
    if (has_post_thumbnail()) {
        echo get_the_post_thumbnail(get_the_ID(), 'thumbnail', array('class' => 'photo'));
    }
    echo "\t</div>";
    echo "\t<div class=\"summary\"> " . wp_trim_excerpt(get_the_excerpt()) . "</div>";
    echo "\t<div class=\"permalink\"> " . get_permalink() . "</div>";
    echo "\t</div> <!-- .testimonial_rotator_microdata -->\n";
}
echo "</div>\n";