コード例 #1
0
    function widget($args, $instance)
    {
        extract($args);
        $number = $instance['number'];
        $title = $instance['title'];
        echo $before_widget;
        if ($title) {
            echo $before_title . esc_attr($title) . $after_title;
        }
        ?>
<ul class="article_list">
<?php 
        $anposts = new WP_Query(array('post_type' => 'post', 'posts_per_page' => esc_attr($number)));
        // number to display more / less
        $c = 0;
        while ($anposts->have_posts()) {
            $anposts->the_post();
            $c++;
            if ($c == 1) {
                ?>
  <li><?php 
                if (has_post_thumbnail()) {
                    ?>
        <div class="post-date">
          <span class="month"><?php 
                    the_time('M', '', '', true);
                    ?>
</span>
          <span class="day"><?php 
                    the_time('d', '', '', true);
                    ?>
</span>
        </div><!-- end .post-date -->
        <a href="<?php 
                    the_permalink();
                    ?>
"> <?php 
                    echo the_post_thumbnail('thumbnail-widget');
                    ?>
 </a>
        <div class="clear"></div>
        <div class="article-category"><i></i> <?php 
                    $category = get_the_category();
                    if ($category) {
                        echo '<a href="' . get_category_link($category[0]->term_id) . '" class="tiptipBlog" title="' . sprintf(__("View all posts in %s", "anthemes"), $category[0]->name) . '" ' . '>' . $category[0]->name . '</a> ';
                    }
                    ?>
        </div><div class="arrow-down-cat"></div><!-- end .article-category -->
      <?php 
                }
                ?>
 <div class="clear"></div>
      <div class="an-widget-title">
        <h3 class="article-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h3>
          <?php 
                if (function_exists('taqyeem_get_score')) {
                    ?>
            <?php 
                    taqyeem_get_score();
                    ?>
          <?php 
                }
                ?>
        <span><?php 
                _e('Written by', 'anthemes');
                ?>
 <?php 
                the_author_posts_link();
                ?>
</span>
      </div>
  </li>
<?php 
            } else {
                ?>
  <li>
      <a href="<?php 
                the_permalink();
                ?>
"> <?php 
                echo the_post_thumbnail('thumbnail-widget-small');
                ?>
 </a>
      <div class="an-widget-title" <?php 
                if (has_post_thumbnail()) {
                    ?>
 style="margin-left:70px;" <?php 
                }
                ?>
>
        <h4 class="article-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h4>
          <?php 
                if (function_exists('taqyeem_get_score')) {
                    ?>
            <?php 
                    taqyeem_get_score();
                    ?>
          <?php 
                }
                ?>
        <span><?php 
                _e('by', 'anthemes');
                ?>
 <?php 
                the_author_posts_link();
                ?>
</span>
      </div>
  </li>
<?php 
            }
        }
        wp_reset_query();
        ?>
</ul>
<?php 
        echo $after_widget;
    }
コード例 #2
0
							</a>
						</div>
						<div class="entry-read-more">
							<a href="<?php 
        the_permalink();
        ?>
" title="Read the whole article.">Read More...</a>
						</div>
						<div class="entry-empty-box">&nbsp;</div>
					</div>
		
					<?php 
        if (function_exists('taqyeem_get_score')) {
            ?>
						<?php 
            taqyeem_get_score();
            ?>
					<?php 
        }
        ?>
                   
				</div><!-- end .an-content -->
			</li>
			<?php 
    }
}
?>
		</ul><!-- end .classic-blog -->

	    <!-- Pagination -->    
	    <div class="line-bottom"></div>
コード例 #3
0
ファイル: cp_portfolio.php プロジェクト: pcco/portal-redesign
        function print_port_item($item_xml)
        {
            wp_reset_query();
            global $paged, $sidebar, $team_div_size_num_class, $post, $counter;
            if (empty($paged)) {
                $paged = get_query_var('page') ? get_query_var('page') : 1;
            }
            $category = find_xml_value($item_xml, 'category');
            // get the blog meta value
            $header = find_xml_value($item_xml, 'header');
            $num_fetch = find_xml_value($item_xml, 'num-fetch');
            $num_excerpt = find_xml_value($item_xml, 'num-excerpt');
            if (empty($num_excerpt)) {
                $num_excerpt = '200';
            }
            if (!empty($header)) {
                echo '<h2 class="heading">' . $header . '</h2>';
            }
            echo '
                <div class="portfolio-list">
                	<ul class="row-fluid">';
            if ($category == '0') {
                query_posts(array('posts_per_page' => $num_fetch, 'paged' => $paged, 'post_type' => 'portfolio', 'post_status' => 'publish', 'order' => 'DESC'));
            } else {
                query_posts(array('posts_per_page' => $num_fetch, 'paged' => $paged, 'post_type' => 'portfolio', 'tax_query' => array(array('taxonomy' => 'portfolio-category', 'field' => 'term_id', 'terms' => $category)), 'post_status' => 'publish', 'order' => 'DESC'));
            }
            $counter_team = 0;
            while (have_posts()) {
                the_post();
                //Fetching All Tracks from Database
                $track_name_xml = get_post_meta($post->ID, 'add_project_xml', true);
                $track_url_xml = get_post_meta($post->ID, 'add_project_field_xml', true);
                //Empty Variables
                //$album_download = '';
                $children = '';
                $children_title = '';
                //Track Name
                if ($track_name_xml != '') {
                    $ingre_xml = new DOMDocument();
                    $ingre_xml->recover = TRUE;
                    $ingre_xml->loadXML($track_name_xml);
                    $children_name = $ingre_xml->documentElement->childNodes;
                }
                //Track URL
                if ($track_url_xml != '') {
                    $ingre_title_xml = new DOMDocument();
                    $ingre_title_xml->recover = TRUE;
                    $ingre_title_xml->loadXML($track_url_xml);
                    $children_title = $ingre_title_xml->documentElement->childNodes;
                }
                $port_class = '';
                if ($counter_team % 4 == 0) {
                    $port_class = 'first';
                } else {
                    $post_class = 'no-class';
                }
                $counter_team++;
                ?>

				<!--LIST ITEM START-->
				<li class="span3 <?php 
                echo $port_class;
                ?>
">
					<div class="portfolio-wrapper">
						<div class="thumb">
							<?php 
                echo get_the_post_thumbnail($post->ID, array(614, 614));
                ?>

							<div class="caption">
								<h5><?php 
                echo get_the_title();
                ?>
</h5>
								<p><?php 
                $variable_category = wp_get_post_terms($post->ID, 'portfolio-category');
                $counterr = 0;
                foreach ($variable_category as $values) {
                    $counterr++;
                    echo '<a class="portfolio-tag" href="' . get_term_link(intval($values->term_id), 'portfolio-category') . '">' . $values->name . '</a>  ';
                }
                ?>

								</p>
								<div class="cp-rating">
									<?php 
                if (function_exists('taqyeem_get_score')) {
                    taqyeem_get_score($post->ID);
                }
                ?>

								</div>
								<p><?php 
                echo substr(get_the_content(), 0, 200);
                ?>
</p>
							</div>
						</div>
						<div class="text">
							<?php 
                //Combine Loop
                if ($track_name_xml != '' || $track_url_xml != '') {
                    $counter = 0;
                    $nofields = $ingre_xml->documentElement->childNodes->length;
                    if ($nofields != 0) {
                        for ($i = 0; $i < 1; $i++) {
                            $counter++;
                            if (isset($track_name_xml)) {
                                echo '<h5>' . $children_name->item($i)->nodeValue . '</h5>';
                            }
                            if (isset($track_url_xml)) {
                                echo '<p>' . $children_title->item($i)->nodeValue . '</p>';
                            }
                        }
                    } else {
                        echo '<h5>Type</h5>';
                        echo '<p>No Type Found</p>';
                    }
                }
                ?>

							<a href="<?php 
                echo get_permalink();
                ?>
" class="view-project"><?php 
                _e('View Project', 'crunchpress');
                ?>
</a>
						</div>
					</div>
				</li>
				<!--LIST ITEM START-->
			<?php 
            }
            echo '      </ul>
                </div>';
        }
コード例 #4
0
function tie_get_score($post_id = false, $size = 'small')
{
    if (function_exists('taqyeem_get_score')) {
        taqyeem_get_score($post_id, $size);
    }
}
コード例 #5
0
function taqyeem_get_types_reviews($num = 5, $order = 'latest', $avatar = false, $types = 'any')
{
    if ($order == 'rand') {
        $orderby = "rand";
    } elseif ($order == 'best') {
        $orderby = "meta_value";
    } else {
        $orderby = "date";
    }
    $taq_args = array('posts_per_page' => $num, 'meta_key' => 'taq_review_score', 'orderby' => $orderby, 'post_type' => $types, 'post_status' => 'publish');
    $cat_query = new WP_Query($taq_args);
    ?>
	<ul class="reviews-posts">
	<?php 
    if ($cat_query->have_posts()) {
        while ($cat_query->have_posts()) {
            $cat_query->the_post();
            ?>
		<li>
		<?php 
            if (function_exists("has_post_thumbnail") && has_post_thumbnail() && $avatar != false) {
                ?>
		<div class="review-thumbnail">
			<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                printf(esc_attr__('Permalink to %s', 'taq'), the_title_attribute('echo=0'));
                ?>
" rel="bookmark">
				<?php 
                echo $image_url = wp_get_attachment_image(get_post_thumbnail_id($post->ID), $avatar);
                ?>
			</a>
		</div><!-- review-thumbnail /-->
		<?php 
            }
            ?>
		<h3><a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            printf(esc_attr__('Permalink to %s', 'taq'), the_title_attribute('echo=0'));
            ?>
" ><?php 
            the_title();
            ?>
</a></h3> <?php 
            taqyeem_get_score();
            ?>
</li>
	<?php 
        }
    } else {
        ?>
	<li><?php 
        _e('No Posts', 'taq');
        ?>
</li>
	<?php 
    }
    ?>
	</ul>
<?php 
}