Exemple #1
0
/**
 * Returns a sentence as an excerpt for the latest news post
**/
function get_news_excerpt()
{
    $args = array('posts_per_page' => 1, 'category_name' => 'news', 'meta_key' => '_thumbnail_id');
    $excerpt_args = 'length=16&length_type=words&no_custom=1&finish=sentence&add_link=0&exclude_tags=img,p,strong,a';
    $the_query = new WP_Query($args);
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            // Paragraph
            echo '<p class="excerpt">';
            // Date
            echo get_the_date('M j, Y · ');
            // Excerpt
            echo the_advanced_excerpt($excerpt_args);
            echo '</p>';
        }
    } else {
        // no posts found
    }
    wp_reset_postdata();
}
Exemple #2
0
      <?php 
    if (get_field('author_credit')) {
        ?>
      	<p class="author-credit">By <?php 
        the_field('author_credit');
        ?>
</p>
      <?php 
    }
    ?>
      <p class="post-date"><?php 
    the_date('F j, Y');
    ?>
</p>
      <p class="news-description"><?php 
    the_advanced_excerpt();
    ?>
</p>
      <a href="<?php 
    the_permalink();
    ?>
" class="read-more-btn">Read Article</a>
	</div><!-- end Post Content -->
		
 </div><!-- End Post Box -->

 <?php 
}
?>
       
       		<?php 
 } else {
     $NV_galexturl = get_permalink();
 }
 // Set the title
 if (get_post_meta($post->ID, '_cmb_pagetitle', true) && get_post_meta($post->ID, '_cmb_pagetitle', true) != 'BLANK') {
     $NV_posttitle = get_post_meta($post->ID, '_cmb_pagetitle', true);
 } else {
     $NV_posttitle = the_title('', '', false);
 }
 global $more;
 $more = FALSE;
 if (empty($post->post_excerpt)) {
     if ($NV_stagegallery == "textoverlay" || !function_exists('the_advanced_excerpt')) {
         $NV_description = get_the_content();
     } else {
         $NV_description = the_advanced_excerpt('length=' . $NV_galleryexcerpt . '&ellipsis=', true);
     }
 } else {
     $NV_description = get_the_excerpt();
 }
 /* ------------------------------------
 		
 		:: 3D ONLY
 		
 		------------------------------------ */
 if (empty($NV_3dsegments)) {
     $NV_3dsegments = '';
 }
 if (empty($NV_3dtween)) {
     $NV_3dtween = '';
 }
Exemple #4
0
function nv_recent_posts_shortcode($atts)
{
    extract(shortcode_atts(array('limit' => '', 'categories' => '', 'metadata' => '', 'show_date' => '', 'order' => 'date', 'orderby' => '', 'offset' => '', 'image_width' => '', 'image_height' => '', 'image_align' => '', 'image_effect' => '', 'content_type' => '', 'content' => 'textimage', 'excerpt' => ''), $atts));
    if (!empty($content_type)) {
        $content = $content_type;
    }
    ob_start();
    $q = new WP_Query('offset=' . $offset . '&orderby=' . $order . '&order=' . $orderby . '&category_name=' . $categories . '&posts_per_page=' . $limit);
    if (esc_attr($excerpt)) {
        $recent_excerpt = esc_attr($excerpt);
    } else {
        $recent_excerpt = "15";
    }
    ?>
		
		<ul class="nv-recent-posts">
		
		<?php 
    while ($q->have_posts()) {
        $q->the_post();
        $post_id = get_the_ID();
        $NV_previewimgurl = get_post_meta($post_id, '_cmb_previewimgurl', true) != '' ? get_post_meta($post_id, '_cmb_previewimgurl', true) : '';
        $disablegallink = get_post_meta($post_id, '_cmb_disablegallink', true) != '' ? get_post_meta($post_id, '_cmb_disablegallink', true) : '';
        $disablereadmore = get_post_meta($post_id, '_cmb_disablereadmore', true) != '' ? get_post_meta($post_id, '_cmb_disablereadmore', true) : '';
        $link_url = get_post_meta($post_id, '_cmb_galexturl', true) != '' ? get_post_meta($post_id, '_cmb_galexturl', true) : get_permalink();
        // check what image to use, custom, featured, image within post.
        if (empty($NV_previewimgurl)) {
            $post_image_id = get_post_thumbnail_id(get_the_ID());
            if ($post_image_id) {
                $thumbnail = wp_get_attachment_image_src($post_image_id, 'medium', false);
                $NV_previewimgurl = $thumbnail[0];
                $NV_previewimgurl = parse_url($NV_previewimgurl, PHP_URL_PATH);
                // make relative Image URL
            } else {
                $NV_previewimgurl = catch_image();
                // Check for images within post
            }
        }
        $image = $NV_previewimgurl;
        if ($image && ($content == 'textimage' || $content == 'titleimage' || $content == 'image')) {
            // check if link is disabled
            $image_link = $disablegallink != 'yes' ? $image_link = 'link="' . $link_url . '"' : '';
            $image = '[imageeffect type="' . $image_effect . '" align="' . $image_align . '" width="' . $image_width . '" height="' . $image_height . '"  alt="' . get_the_title() . '" url="' . $image . '" ' . $image_link . ' ]';
        } else {
            $image = '';
        }
        ?>
		
			<li>
				<?php 
        echo do_shortcode($image);
        if ($content != 'image') {
            ?>
					<div>
					<h4>
                    	<?php 
            if ($disablegallink == 'yes') {
                the_title();
            } else {
                ?>
							<a href="<?php 
                echo $link_url;
                ?>
"><?php 
                the_title();
                ?>
</a>
						<?php 
            }
            ?>
                    </h4>    
					<?php 
            if ($show_date == 'yes') {
                ?>
						<small><?php 
                echo get_the_date();
                ?>
</small>
					<?php 
            }
            if ($content != 'titleimage' && $content != 'title') {
                if ($q->post->post_excerpt) {
                    echo "<p>" . get_the_excerpt() . "</p>";
                } else {
                    if (function_exists('the_advanced_excerpt')) {
                        echo the_advanced_excerpt('length=' . $recent_excerpt);
                    } else {
                        echo get_the_content();
                    }
                }
                if ($disablegallink != 'yes' && $disablereadmore != 'yes') {
                    echo themeva_readmore($link_url);
                }
            }
            ?>
					</div>
				<?php 
        }
        if ($metadata == 'yes') {
            ?>
					<div class="recent-metadata">
						<?php 
            echo __('by', 'themeva');
            ?>
 <a href="<?php 
            echo get_author_posts_url(get_the_author_meta('ID'));
            ?>
"><?php 
            echo get_the_author_meta('first_name') . " " . get_the_author_meta('last_name');
            ?>
</a> <span class="subbreak">/</span> 
						<?php 
            echo __('in', 'themeva') . ' ';
            the_category(', ');
            ?>
 <span class="subbreak">/</span> 
						<?php 
            comments_popup_link(__('No Comments', 'themeva') . ' ', '1 ' . __('Comment', 'themeva') . ' ', '% ' . __('Comments', 'themeva'));
            ?>
						<div class="hozbreak clearfix">&nbsp;</div>
					</div>
				<?php 
        }
        ?>
                
				<div class="clear"></div>
			</li>
		<?php 
    }
    wp_reset_query();
    ?>
		
		</ul>
		
		
	<?php 
    $output_string = '';
    $output_string = ob_get_contents();
    ob_end_clean();
    return $output_string;
}
Exemple #5
0
        ?>
"><?php 
        the_title();
        ?>
</a></h4>
				<!-- <small class="postmetadata"><?php 
        the_time('l, j F, Y');
        ?>
</small>-->
				<p class="postmetadata">Pubblicato in <?php 
        echo dito_printObjectTermsInNiceFormat($post->ID);
        ?>
</p>
					<?php 
        if (function_exists('the_advanced_excerpt')) {
            the_advanced_excerpt('length=150&use_words=0&no_custom=1&ellipsis=%26hellip;&exclude_tags=img');
        } else {
            echo "Attivare la plugin Advanced Excerpt";
        }
        ?>
			<p class="postmetadata"><?php 
        edit_post_link('Edit', '', ' | ');
        ?>
  <?php 
        comments_popup_link('Nessun Commento &#187;', '1 Commento &#187;', '% Commenti &#187;');
        ?>
	</p>
			</div>

		<?php 
    }
Exemple #6
0
                        
                
                            <?php 
        //woo_get_image('image',$GLOBALS['thumb_width_feat'],$GLOBALS['thumb_height_feat'],'thumbnail '.$GLOBALS['align_feat']);
        ?>
 
                            
                            <?php 
        if (function_exists('get_the_image')) {
            get_the_image(array('custom_key' => array('thumbnail', 'thumbnail'), 'size' => 'medium', 'width' => '200'));
        }
        ?>
                    	
                        
	                        <p><?php 
        the_advanced_excerpt('exclude_tags=img,p&length=50');
        ?>
</p>
	                        
	                        <p><a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        the_title();
        ?>
" class="button">read more</a></p>
                       
        			
                    </div><!-- /.entry -->
                    
        
Exemple #7
0
function ditoDoExerpt($length = 150)
{
    //make sure add this plugin shit doesn't bother
    if (function_exists('addthis_init')) {
        remove_filter('the_content', 'addthis_display_social_widget', 15);
        remove_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt', 11);
    }
    if (function_exists('the_advanced_excerpt')) {
        the_advanced_excerpt('length=' . $length . '&use_words=0&no_custom=1&ellipsis=%26hellip;&exclude_tags=img&read_more=[Leggi tutto]&add_link=1&finish_sentence=0&finish_word=1&no_shortcode=1');
    }
}
function blokmaker($cols, $types)
{
    if ($types == 'video') {
        $thumb = convertYoutubeImg(get_post_meta(get_the_ID(), '_video_extra_boxes_url', true));
        $thumb = '<img src="' . $thumb . '">';
    } elseif ($types == 'testimonial') {
        if (has_post_thumbnail()) {
            $thumb_id = get_post_thumbnail_id();
            if ($cols == 12) {
                $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumb-xlarge', true);
            }
            if ($cols == 9 || $cols == 8) {
                $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumb-large', true);
            } else {
                $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumb-medium', true);
            }
            //var_dump($thumb_id);
            $thumb = $thumb_url_array[0];
            $thumb = '<img src="' . $thumb . '">';
        } else {
            $thumb = convertYoutubeImg(get_post_meta(get_the_ID(), '_video_extra_boxes_url', true));
            $thumb = '<img src="' . $thumb . '">';
        }
    } elseif ($types == 'media') {
        if (has_post_thumbnail()) {
            $thumb_id = get_post_thumbnail_id();
            if ($cols == 12) {
                $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumb-xlarge', true);
            }
            if ($cols == 9 || $cols == 8) {
                $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumb-large', true);
            } else {
                $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumb-medium', true);
            }
            //var_dump($thumb_id);
            $thumb = $thumb_url_array[0];
            $thumb = '<img src="' . $thumb . '">';
        } else {
            $filename = get_post_meta(get_the_ID(), '_media_lib_file', true);
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            if ($ext == 'pdf') {
                $fa = 'fa-file-pdf-o';
            } elseif (in_array($ext, array('doc', 'docx'), true)) {
                $fa = 'fa-file-word-o';
            } elseif (in_array($ext, array('xls', 'xlsx'), true)) {
                $fa = 'fa-file-excel-o';
            } elseif (in_array($ext, array('ppt', 'pptx'), true)) {
                $fa = 'fa-file-powerpoint-o';
            } elseif (in_array($ext, array('zip', 'rar', '7z'), true)) {
                $fa = 'fa-file-archive-o';
            } else {
                $fa = 'fa-file-o';
            }
            $thumb = '<div class="icon-wrap"><i class="fa fa-inverse fa-4x ' . $fa . '"></i></div>';
        }
    } else {
        if (has_post_thumbnail()) {
            $thumb_id = get_post_thumbnail_id();
            if ($cols == 12) {
                $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumb-xlarge', true);
            }
            if ($cols == 9 || $cols == 8) {
                $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumb-large', true);
            } else {
                $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumb-medium', true);
            }
            //var_dump($thumb_id);
            $thumb = $thumb_url_array[0];
            $thumb = '<img src="' . $thumb . '">';
        } else {
            $thumb = get_template_directory_uri() . '/dist/images/placeholder800x400-320x180.jpg';
            $thumb = '<img src="' . $thumb . '">';
        }
    }
    $type = $types;
    if ($types == 'post' || !isset($types)) {
        $type = 'news';
    }
    $title = get_the_title();
    if ($cols == 12) {
        $size = 'megagroot';
        $title = truncate($title, 180);
    } elseif ($cols == 9) {
        $size = 'groot';
        $title = truncate($title, 130);
    } elseif ($cols == 8) {
        $size = 'groot';
        $title = truncate($title, 100);
    } elseif ($cols == 6) {
        $size = 'middel';
        $title = truncate($title, 70);
    } elseif ($cols == 4) {
        $size = 'middel';
        $title = truncate($title, 40);
    } else {
        $size = 'klein';
        $title = truncate($title, 35);
    }
    ?>
  <div class="col-md-<?php 
    echo $cols;
    ?>
 eq">
    <div class="box-wrap static <?php 
    echo $size;
    ?>
 <?php 
    if (is_front_page()) {
        echo 'home';
    }
    ?>
">
      <a href="<?php 
    the_permalink();
    ?>
" class="boxlink"></a>
      <div class="header-wrap">
        <h2><?php 
    echo $title;
    ?>
</h2>
      </div>
      <div <?php 
    post_class('infobar');
    ?>
>
        <time class="updated date" datetime="<?php 
    echo get_the_time('c');
    ?>
"><?php 
    echo get_the_date();
    ?>
</time>
        <span class="type"><span class="hidden-md"><?php 
    _e($type, 'sage');
    ?>
</span></span>
      </div>
      <?php 
    echo $thumb;
    ?>
      <div class="excerpt">
        <?php 
    the_advanced_excerpt();
    ?>
      </div>
    </div>
  </div>
  <?php 
}
    function category()
    {
        // Determine what category is being shown, and generate category object & list of subcategories
        $category_id = get_query_var('cat');
        $category = get_category($category_id);
        $subcategories = get_categories('hide_empty=0&parent=' . $category_id);
        // Display a customized category intro panel, for top-level categories only
        if ($category->category_parent === 0) {
            ?>
            <header class="category-intro <?php 
            echo $category->slug;
            ?>
">
                <img src="<?php 
            bloginfo(stylesheet_directory);
            ?>
/custom/images/categories/<?php 
            echo $category->slug;
            ?>
.jpg">
                <div>
                    <h1><i class="icon-header-fleuron-left"></i><?php 
            echo $category->name;
            ?>
<i class="icon-header-fleuron-right"></i></h1>
                    <p><?php 
            echo str_replace('#', get_category_link($category->term_id), $category->description);
            ?>
</p>
                </div>
            </header>
        <?php 
        } else {
            ?>
            <section class="headline_area">
                <h1 class="entry-title"><?php 
            echo $category->name;
            ?>
</h1>
            </section>
        <?php 
        }
        // If we're in the Design Resources category, display an expandable panel with a list of sub-categories
        if ($category->name === "Design Resources") {
            $series_subcategories = array_slice($subcategories, 0, 4);
            $print_subcategories = array_slice($subcategories, 4);
            ?>
            <a href="#" class="subcategory-expander-link"><i class="icon-caret-down"></i>By series or print</a>
            <section class="subcategory-expander">
                <div>
                    <section>
                        <h2><i class="icon-bullet-fleuron"></i>By series</h2>
                        <ul>
                    <?php 
            foreach ($series_subcategories as $subcategory) {
                echo '<li>' . $count . '<a href="' . get_category_link($subcategory->term_id) . '">' . $subcategory->name . '</a></li>';
            }
            ?>
                        </ul>
                    </section>

                    <section>
                        <h2><i class="icon-bullet-fleuron"></i>By print</h2>
                    <?php 
            $count = 0;
            foreach ($print_subcategories as $subcategory) {
                if ($count % 3 === 0) {
                    echo '<ul>';
                }
                echo '<li><a href="' . get_category_link($subcategory->term_id) . '">' . $subcategory->name . '</a></li>';
                $count++;
                if ($count % 3 === 0 or $count - 1 === count($print_subcategories)) {
                    echo '</ul>';
                }
            }
            ?>
                    </section>



                </div>
            </section>
        <?php 
        }
        ?>


        <?php 
        // If we're in the Shopping Guides category, display a styled block for each sub-category
        if ($category->name === "Shopping Guides") {
            foreach ($subcategories as $subcategory) {
                ?>
                <div class="subcategory <?php 
                echo smarter_slug($subcategory);
                ?>
">
                    <h2><?php 
                echo $subcategory->name;
                ?>
</h2>
                    <?php 
                // Currently featured category should show an "Updated for..." badge
                global $featured;
                if ($subcategory->term_id == $featured->term_id) {
                    ?>
                        <img class="badge" src="<?php 
                    bloginfo(stylesheet_directory);
                    ?>
/custom/images/updated-for-2015.png" alt="Updated for 2015"/>
                    <?php 
                }
                ?>
                    <p class="read-more"><a href="<?php 
                echo get_category_link($subcategory->term_id);
                ?>
">Read more</a></p>
                    <a class="div-link" href="<?php 
                echo get_category_link($subcategory->term_id);
                ?>
"></a>
                </div>
            <?php 
            }
            // Otherwise, display a list of posts
        } else {
            while (have_posts()) {
                the_post();
                echo '<div class="post-excerpt">';
                if (has_post_thumbnail()) {
                    ?>
                    <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title_attribute();
                    ?>
" >
                        <?php 
                    the_post_thumbnail('');
                    ?>
                    </a>
                <?php 
                }
                ?>
                    <div class="headline_area">
                        <?php 
                echo post_meta();
                ?>
                        <a href="<?php 
                the_permalink();
                ?>
"><h2 class="entry-title"><?php 
                echo get_the_title();
                ?>
</h2></a>
                    </div>
                    <div class="format_text entry-content">
                        <p><?php 
                the_advanced_excerpt('length=40&use_words=1&no_custom=1&ellipsis=&finish_sentence=1');
                ?>
</p>
                        <p class="read-more"><a href="<?php 
                the_permalink();
                ?>
" rel="bookmark" title="<?php 
                the_title();
                ?>
">Read more</a></p>
                    </div>
                </div>
            <?php 
            }
        }
    }