Example #1
0
function categoryContent($cat, $post_count)
{
    query_posts("posts_per_page={$post_count}&cat={$cat}&orderby=ID");
    ?>
	<ul>
	<?php 
    while (have_posts()) {
        the_post();
        ?>
		<li><a href='<?php 
        the_permalink();
        ?>
'><?php 
        the_title();
        ?>
</a><br>
		<p><?php 
        excerpt(20);
        ?>
</p>
		</li>
	<?php 
    }
    ?>
	</ul>
<?php 
}
 public function save(PostRequest $request, $forum, $topic, $post = null)
 {
     $url = \DB::transaction(function () use($request, $forum, $topic, $post) {
         // parsing text and store it in cache
         $text = app()->make('Parser\\Post')->parse($request->text);
         // post has been modified...
         if ($post !== null) {
             $this->authorize('update', [$post, $forum]);
             $data = $request->only(['text', 'user_name']) + ['edit_count' => $post->edit_count + 1, 'editor_id' => auth()->id()];
             $post->fill($data)->save();
             $activity = Stream_Update::class;
             // user want to change the subject. we must update topics table
             if ($post->id === $topic->first_post_id) {
                 $path = str_slug($request->get('subject'), '_');
                 $topic->fill($request->all() + ['path' => $path])->save();
                 $this->topic->setTags($topic->id, $request->get('tag', []));
             }
         } else {
             $activity = Stream_Create::class;
             // create new post and assign it to topic. don't worry about the rest: trigger will do the work
             $post = $this->post->create($request->all() + ['user_id' => auth()->id(), 'topic_id' => $topic->id, 'forum_id' => $forum->id, 'ip' => request()->ip(), 'browser' => request()->browser(), 'host' => request()->server('SERVER_NAME')]);
             // get id of users that were mentioned in the text
             $usersId = (new Ref_Login())->grab($text);
             if ($usersId) {
                 app()->make('Alert\\Post\\Login')->with(['users_id' => $usersId, 'sender_id' => auth()->id(), 'sender_name' => $request->get('user_name', auth()->user()->name), 'subject' => excerpt($topic->subject, 48), 'excerpt' => excerpt($text), 'url' => route('forum.topic', [$forum->path, $topic->id, $topic->path], false)])->notify();
             }
         }
         $url = route('forum.topic', [$forum->path, $topic->id, $topic->path], false);
         $url .= '?p=' . $post->id . '#id' . $post->id;
         $object = (new Stream_Post(['url' => $url]))->map($post);
         stream($activity, $object, (new Stream_Topic())->map($topic, $forum));
         return $url;
     });
     return redirect()->to($url);
 }
Example #3
0
function doFeed($feed)
{
    $rss = new DOMDocument();
    if ($rss->load($feed)) {
        $feed = array();
        foreach ($rss->getElementsByTagName('item') as $node) {
            $item = array('title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue);
            array_push($feed, $item);
        }
        $limit = 3;
        for ($x = 0; $x < $limit; $x++) {
            $title = str_replace(' & ', ' &amp; ', $feed[$x]['title']);
            $link = $feed[$x]['link'];
            $description = $feed[$x]['desc'];
            $date = date('l, F d, Y', strtotime($feed[$x]['date']));
            echo '
					<article>
						<hgroup>
							<h1><a href="' . $link . '" title="' . $title . '">' . $title . '</a>
							<h2>' . $date . '</h2>
						</hgroup>
						<p>' . excerpt($description) . '</p>
					</article>' . "\r\n";
        }
    } else {
        echo '<p class="none">No posts found!</p>' . "\r\n";
    }
}
Example #4
0
 public function map(Model $microblog)
 {
     $this->id = $microblog->id;
     $this->url = route('microblog.view', [$microblog->id], false);
     $this->displayName = excerpt($microblog->text);
     return $this;
 }
Example #5
0
 /**
  * @param Model $microblog
  * @return $this
  */
 public function map(Model $microblog)
 {
     $this->setMicroblogId($microblog->id);
     $this->setUrl(route('microblog.view', [$microblog->id], false));
     $this->setUserId($microblog->user_id);
     $this->setExcerpt(excerpt($microblog->text));
     return $this;
 }
 public function save(Request $request)
 {
     $this->validate($request, ['url' => 'required|string', 'metadata' => 'json', 'type_id' => 'integer|exists:flag_types,id', 'text' => 'string']);
     \DB::transaction(function () use($request) {
         $flag = Flag::create($request->all() + ['user_id' => auth()->id()]);
         $object = new Stream_Flag(['id' => $flag->id, 'displayName' => excerpt($request->text)]);
         stream(Stream_Create::class, $object);
     });
 }
Example #7
0
function get_slide_items($slide_cat, $count)
{
    global $post;
    $args = array('posts_per_page' => $count, 'cat' => $slide_cat);
    $loop = new WP_Query($args);
    echo "<ul class='slides'>";
    while ($loop->have_posts()) {
        $loop->the_post();
        ?>

	<li>
		
		<?php 
        $thumb_id = get_post_thumbnail_id();
        $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
        $thumb_url = $thumb_url_array[0];
        // $thumb = get_post_thumbnail_id();
        // $img_url = wp_get_attachment_url( $thumb,'full' ); //get full URL to image (use "large" or "medium" if the images too big)
        // $image = aq_resize( $img_url, 960, 410, true,true,true ); //resize & crop the image
        ?>
		<?php 
        if ($thumb_url) {
            ?>
			<a href="<?php 
            the_permalink();
            ?>
">  <img src="<?php 
            echo $thumb_url;
            ?>
" alt="<?php 
            the_title();
            ?>
" /> </a>
		<?php 
        }
        ?>
		<div class="flex-caption">
					<h2><a href="<?php 
        the_permalink();
        ?>
">  <?php 
        the_title();
        ?>
 </a></h2>
			  	  	<span> <?php 
        echo excerpt(25);
        ?>
 </span>
  	  	</div>
  	</li>

    <?php 
    }
    echo "</ul>";
    wp_reset_postdata();
}
Example #8
0
 /**
  * @param Model $topic
  * @param Forum $forum
  * @param string|null $text
  * @return $this
  */
 public function map(Model $topic, Forum $forum, $text = null)
 {
     $this->id = $topic->id;
     $this->url = route('forum.topic', [$forum->path, $topic->id, $topic->path], false);
     $this->displayName = $topic->subject;
     $this->forum = ['name' => $forum->name, 'id' => $forum->id, 'path' => $forum->path];
     if ($text) {
         $this->excerpt = excerpt($text);
     }
     return $this;
 }
 /**
  * @param $id
  * @param Microblog $repository
  * @return $this
  */
 public function index($id, Microblog $repository)
 {
     $microblog = $repository->findOrFail($id);
     $excerpt = excerpt($microblog->text);
     $this->breadcrumb->push('Mikroblog', route('microblog.home'));
     $this->breadcrumb->push($excerpt, route('microblog.view', [$microblog->id]));
     $microblog->text = app()->make('Parser\\Microblog')->parse($microblog->text);
     $parser = app()->make('Parser\\Comment');
     foreach ($microblog->comments as &$comment) {
         $comment->text = $parser->parse($comment->text);
     }
     return parent::view('microblog.view')->with(['microblog' => $microblog, 'excerpt' => $excerpt]);
 }
function custom_excerpt($length = '', $more_txt = 'Read More')
{
    $default_length = 30;
    if (empty($length)) {
        $excerpt_length = $default_length;
    } else {
        $excerpt_length = $length;
    }
    $excerpt = excerpt($excerpt_length);
    $link = '<a href="' . get_permalink($post->ID) . '" class="more_link">' . $more_txt . '</a>';
    $output = "{$excerpt} {$link}";
    echo wpautop($output, true);
}
function bytbil_show_news_feed($posts, $categories = "")
{
    // set up or arguments for our custom query
    if ($posts == 0) {
        $posts = 10;
    }
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    if ($categories != '' && count($categories) != 0) {
        $query_args = array('tax_query' => array(array('taxonomy' => 'news_categories', 'field' => 'id', 'terms' => $categories)), 'posts_per_page' => $posts, 'paged' => $paged);
    } else {
        $query_args = array('post_type' => 'news', 'posts_per_page' => $posts, 'paged' => $paged);
    }
    // create a new instance of WP_Query
    $the_query = new WP_Query($query_args);
    ?>

    <?php 
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            // run the loop
            ?>
    <article class="news-post">
        <a href="<?php 
            the_permalink();
            ?>
">
            <h2><?php 
            echo the_title();
            ?>
</h2>

            <div class="excerpt">
                <?php 
            echo excerpt(45);
            ?>
            </div>
            <span class="date">Skrivet den: <?php 
            echo get_the_date('Y-m-d');
            ?>
</span>
        </a>
    </article>
<?php 
        }
    }
    wp_reset_query();
}
Example #12
0
function portfolio_custom_columns($column)
{
    global $post;
    switch ($column) {
        case "portfolio_desc":
            echo excerpt('25');
            break;
        case "portfolio_category":
            echo get_the_term_list($post->ID, 'portfolio_category', '', ', ', '');
            break;
        case "portfolio_image":
            $custom = get_post_custom();
            the_post_thumbnail('thumb-admin');
            break;
    }
}
"><?php 
    the_title();
    ?>
</a></h3>
                                <em class="data-time"><?php 
    the_author_posts_link();
    ?>
<span><?php 
    the_time('j M');
    ?>
</span>, <?php 
    the_time('Y');
    ?>
</em>
                                <p><?php 
    echo excerpt(75);
    ?>
</p>
                                <a class="btn btn-primary" href="<?php 
    the_permalink();
    ?>
">Просмотреть</a>
                            </div>
                        </div>
                    </li>
                <?php 
}
?>

            </ul>
Example #14
0
    while (have_posts()) {
        the_post();
        ?>

                <!-- blog entry -->
                <article class="search-block">
            
                    <h5><a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_title();
        ?>
</a></h5>
                    <?php 
        echo excerpt('26');
        ?>
                    
                    <div class="search-permalink"><a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_permalink();
        ?>
</a></div>
                    
                    <hr class="gw-divider clearboth" />              
                    
                </article>
                
                <?php 
Example #15
0
if ('latest' == $content_slider['content']) {
} else {
    if ('category' == $content_slider['content']) {
        $args_slider['cat'] = $content_slider['category'];
    } else {
        if ('tag' == $content_slider['content']) {
            $args_slider['tag'] = $content_slider['tag'];
        }
    }
}
query_posts($args_slider);
global $post;
while (have_posts()) {
    the_post();
    $title = get_the_title();
    $excerpt = excerpt(20);
    if (has_post_thumbnail()) {
        $carousel .= get_the_post_thumbnail($post->ID, 'slider-big');
    } else {
        $image = get_template_directory_uri() . '/img/default_slidefixed.jpg';
        $carousel .= '<img src="' . $image . '"   alt="slide_' . $s . '"  />';
    }
    $single_cate = single_category_post($post);
    $caption .= '<div class="caption slide_' . $s . '">';
    if (!empty($single_cate)) {
        /* $caption.='<div class="cate">'.$single_cate.'</div>'; */
    }
    $caption .= '<h3><a href="' . get_permalink() . '" title="' . $title . '">' . $title . '</a></h3>';
    $caption .= '<p>' . $excerpt . '<br /><br /><a href="' . get_permalink() . '" class="btn btn-success btn-large">' . __('Read More', 'mtcframework') . '</a></p>';
    $caption .= '</div>';
    $s++;
    ?>
		<?php 
}
?>
		<?php 
$bpxl_status_excerpt_home = rwmb_meta('bpxl_status_excerpt_home', $args = array('type' => 'checkbox'), $post->ID);
if (empty($bpxl_status_excerpt_home)) {
    ?>
			<div class="post-inner">
				<div class="post-content">
					<?php 
    $excerpt_length = $bpxl_goblog_options['bpxl_excerpt_length'];
    if ($bpxl_goblog_options['bpxl_home_content'] == '2') {
        the_content(__('Read More', 'bloompixel'));
    } else {
        echo excerpt($excerpt_length);
        ?>
								<div class="read-more">
									<a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        the_title_attribute();
        ?>
" rel="bookmark"><?php 
        _e('Read More', 'bloompixel');
        ?>
</a>
								</div>		
						<?php 
    }
Example #17
0
										
										<? } else { ?>
										
										<p><?php echo excerpt(40); ?></p>
										
										<? } ?>
										
										
										<div class="he-view">
										
											<div class="bg a0" data-animate="fadeIn">								
			
												<div class="center-bar">
													<a href="<?php the_permalink(); ?>" aria-hidden="true" class="icon-link a0" data-animate="fadeInUp"></a>
												<a href="https://twitter.com/share?url=<?php the_permalink(); ?>&text=<?php the_title(); ?>&via=<?php get_option('cebo_twitter'); ?>" target="_blank" aria-hidden="true" class="icon-twitter a0" data-animate="fadeInUp"></a>
												<a href="http://www.facebook.com/sharer.php?s= 100&amp;p[title]=<?php the_title(); ?>&amp;p[url]=<?php the_permalink(); ?>&amp;p[images][0]=<?php echo $imgsrc[0]; ?>&amp;p[summary]=<?php echo excerpt(30); ?>" target="_blank" aria-hidden="true" class="icon-facebook a0" data-animate="fadeInUp"></a>
													
												</div>
											</div>
									
										</div>	
									
									</div>
									
								
								
								</div>
								
							</div>
							
							
</h3></span>
								</div><!--split-img-->
								<div class="split-text">
									<span class="widget-info"><span class="widget-author"><?php 
                            the_author();
                            ?>
</span> | <?php 
                            the_time(get_option('date_format'));
                            ?>
</span>
									<h2><?php 
                            the_title();
                            ?>
</h2>
									<p><?php 
                            echo excerpt(19);
                            ?>
</p>
								</div><!--split-text-->
								</a>
							</li>
							<?php 
                        }
                    }
                    ?>

						<?php 
                }
                ?>

					</ul>
Example #19
0
							
							<?php 
        }
        ?>
								
							</div>

						<div class="fr">
							
							<h3><?php 
        the_title();
        ?>
</h3>

							<p><?php 
        echo excerpt(67);
        ?>
</p>

							<div class="room-list-buttons">

								<a class="button" onclick="_gaq.push(['_link', this.href]);return false;" href="<?php 
        if (get_post_meta($post->ID, 'cebo_booklink', true)) {
            echo get_post_meta($post->ID, 'cebo_booklink', true);
        } else {
            echo get_option('cebo_genbooklink');
        }
        ?>
">Reserve Now</a>
								<!--<a class="button" href="<?php 
        the_permalink();
						<?php 
    } else {
        ?>
						<img src="<?php 
        bloginfo('template_url');
        ?>
/assets/img/placeholder-carousel.png" width="700" height="252" alt="placeholder" />
						<?php 
    }
    ?>
						<div class="slide-excerpt">
							<h2><?php 
    the_title();
    ?>
 </h2><span><?php 
    excerpt(12);
    ?>
 </span><a href="<?php 
    the_permalink();
    ?>
">Learn more</a></h2>
						</div>
						
					</li>
					<?php 
}
?>
				</ul>
				<div id="slideshow-pager">&nbsp;</div>
			</div>
			<div class="related">
Example #21
0
      <p class="search-list-excerpt"><?php 
            echo html($result->description());
            ?>
</p>
      <?php 
        } elseif ($result->excerpt() != '') {
            ?>
      <p class="search-list-excerpt"><?php 
            echo html($result->excerpt());
            ?>
</p>
      <?php 
        } else {
            ?>
      <p class="search-list-excerpt"><?php 
            echo excerpt($result->text());
            ?>
</p>
      <?php 
        }
        ?>

      <p class="search-list-crumb">
        <?php 
        foreach ($result->parents()->flip() as $parent) {
            ?>
<!--
     --><a data-separator="&rsaquo;" href="<?php 
            echo $parent->url();
            ?>
"><?php 
Example #22
0
    }
    ?>
		</figure>
		<div class="item-details ten columns omega">
			<div class="item-heading clearfix">
				<h2><a class="item-title" href="<?php 
    the_permalink();
    ?>
"><?php 
    the_title();
    ?>
</a></h2>
			</div>
			<div class="blog-excerpt quote">
				<p><?php 
    echo excerpt(14);
    ?>
</p>
				<cite><?php 
    echo get_post_meta($post->ID, 'quote-cite', true);
    ?>
</cite>
			</div>
			<div class="meta">
                <span class="date"><?php 
    the_time('d F Y');
    ?>
</span>
                <span>//</span>
                <span class="comments"><?php 
    comments_number('0 Comments', '1 Comment', '% Comments');
			<a href="<?php 
        the_permalink();
        ?>
" class="ease"><h4><?php 
        the_time('F jS, Y');
        ?>
</h4></a>
			<a href="<?php 
        the_permalink();
        ?>
" class="ease"><h1><?php 
        the_title();
        ?>
</h1></a>
			<h3><?php 
        echo excerpt(50);
        ?>
</h3>
			<a href="<?php 
        the_permalink();
        ?>
" class="ease"><h4>read more &raquo;</h4></a>

		</article>

<?php 
    }
}
?>

		</div>
    function widget($args, $instance)
    {
        global $post;
        extract($args);
        $postid = apply_filters('postid', $instance['postid']);
        $opt_thumbnail = apply_filters('opt_thumbnail', $instance['opt_thumbnail']);
        $postexcerpt = apply_filters('postexcerpt', $instance['postexcerpt']);
        if ($postexcerpt == "") {
            $postexcerpt = 20;
        }
        echo $before_widget;
        $postlist = new WP_Query('p=' . $postid);
        while ($postlist->have_posts()) {
            $postlist->the_post();
            $image_thumbnail = get_post_meta($post->ID, '_image_thumbnail', true);
            $title = $before_title . get_the_title() . $after_title;
            echo $title;
            ?>
      <?php 
            if ($opt_thumbnail == "on") {
                ?>
        <div class="boximg2">
        <?php 
                if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
                    ?>
        <div class="side-box">
          <?php 
                    if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
                        ?>
            <img src="<?php 
                        echo get_template_directory_uri();
                        ?>
/timthumb.php?src=<?php 
                        echo thumb_url();
                        ?>
&amp;h=124&amp;w=236&amp;zc=1"  alt="" />
          <?php 
                    }
                    ?>
        </div>
        <?php 
                }
                ?>
        </div>
        <?php 
            }
            ?>
    <p><?php 
            echo excerpt($postexcerpt);
            ?>
<a href="<?php 
            the_permalink();
            ?>
"  class="linkreadmore"> <?php 
            echo __('Read more &raquo;', 'corbiz');
            ?>
</a></p>
    <?php 
        }
        echo $after_widget;
    }
Example #25
0
        the_field('film_title');
        ?>
</a></h2>
				<a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_post_thumbnail('full');
        ?>
</a>
				<p><span style="font-weight:bold">Release Date:  </span><?php 
        the_field('film_year');
        ?>
.<br></p>
				<p><span style="font-weight:bold">Premise:  </span><?php 
        echo excerpt(32);
        ?>
</p>
			</li>
		<?php 
    }
}
?>
		<?php 
wp_reset_postdata();
?>
		<?php 
wp_reset_query();
?>
	</ul>  <!-- .comingsoon -->
</article> <!-- .recentreview -->
        the_post_thumbnail('thumbnail', array('class' => 'featured'));
    }
    ?>
          </div>
          <div class="table-right">
            <h3>Travel News</h3>
            <div class="subhead">7/14/2015</div>
            <div class="subhead"><?php 
    the_title();
    ?>
</div>
          </div>
        </div>
      </a>
      <p><?php 
    echo excerpt(42);
    ?>
</p>
    </div>
<?php 
}
wp_reset_postdata();
?>

<?php 
$args = array('page_id' => 201);
$the_query = new WP_Query($args);
$url = get_the_permalink(201);
if ($the_query->have_posts()) {
    while ($the_query->have_posts()) {
        $the_query->the_post();
" title="<?php 
        the_title();
        ?>
"><?php 
        the_title();
        ?>
</a></h2>
            <?php 
    }
    ?>
            <?php 
    if ($options['disable_portfolio_description'] != 'disable') {
        if ($portfolio_description != '') {
            echo $portfolio_description;
        } else {
            echo excerpt(15);
        }
    }
    ?>
		</div>
        <!-- END .portfolio-item -->
	</div>
    <!-- END <?php 
    echo $portfolio_grid_class;
    ?>
 -->
	<?php 
    //reset the count to "0" and clear the divs
    if ($count == $portfolio_columns) {
        $count = 0;
        echo '<div class="clear"></div>';
Example #28
0
?>
		  
								     <ul>   <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
								           <li> <h3><a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_title();
        ?>
 <strong>»</strong></a></h3>
										<p>		<?php 
        echo excerpt(12);
        ?>
										</p>
								</li>
								 
								        <?php 
    }
}
?>
				
					</ul>
					<a href="/code-for-america-blog/" class="btn">Go to Blog</a>
				</div>
				<!--Tweets -->
			<div id="tweets">				
				<h2>What’s Being Said About CfA ?</h2>				
Example #29
0
            the_post_thumbnail('blog_image', array('class' => "attachment-{$size}, imageborder img-responsive"));
            ?>
                                        <?php 
        } else {
            ?>
                                            <img src="<?php 
            echo get_template_directory_uri();
            ?>
/img/no_image.png" class="img-responsive imageborder" alt="No image">
                                        <?php 
        }
        ?>
                                    </div>
                                    <div class="col-lg-6">
                                        <?php 
        echo excerpt(60);
        ?>
                                    </div>
                                </div>
                            </div>
                            <div class="panel-footer">
                                <div class="row">
                                    <div class="col-lg-10 col-md-9 col-sm-8">
                                        <i class="fa fa-clock-o"></i> <?php 
        the_date();
        ?>
 
                                        <i class="fa fa-user"></i> <a href="#"><?php 
        the_author();
        ?>
</a> 
Example #30
0
<div class="mesec_gal"><?php 
    echo tribe_get_start_date(null, false, 'M');
    ?>
</div><br>

<div class="mesec_gal"><?php 
    echo tribe_get_start_date(null, false, 'j');
    ?>
</div></div>

<div class="gal_tit_pos"><a href="<?php 
    the_permalink();
    ?>
" class="tip" title="<?php 
    echo excerpt(30);
    ?>
"><?php 
    the_title();
    ?>
</a></div>

</div>



<?php 
}
?>