Пример #1
0
function custom_shortcode()
{
    $terms = get_terms('productcat');
    foreach ($terms as $term) {
        $wpq = array('taxonomy' => 'productcat', 'term' => $term->slug);
        $myquery = new WP_Query($wpq);
        $article_count = $myquery->post_count;
        ?>
      <div class="row productshowrow headercontentpro">
      <h3><?php 
        echo $term->name;
        ?>
</h3>
      <hr>
      </div>
      <div class="row productshowrow">
      <?php 
        if ($article_count) {
            ?>
            <?php 
            while ($myquery->have_posts()) {
                $myquery->the_post();
                ?>
                
	            <div class="col-sm-4">
				<div class="portfolio-box text-center productlist">
				<a href="#">
				<?php 
                echo the_post_thumbnail();
                ?>
				</a>
				<a href="http://localhost/ultimum/product-1/">
				<h3><?php 
                echo get_the_title();
                ?>
</h3>
				</a>
				<p style="margin-bottom:0"><?php 
                echo get_the_twitter_excerpt(100);
                ?>
</p>
				</div>
				</div>
                
            <?php 
            }
            ?>
            </div>
            <?php 
        }
    }
}
Пример #2
0
            echo esc_attr(sprintf(esc_html__('Permalink to %s', 'quark'), the_title_attribute('echo=0')));
            ?>
" rel="bookmark"><?php 
            the_title();
            ?>
</a>
											</h2>
										<?php 
        }
        // is_single()
        ?>
									</header> <!-- /.entry-header -->
									
									<div class="entry-summary">
										<?php 
        echo get_the_twitter_excerpt();
        ?>
										<p class="confira">
											<a href="<?php 
        the_permalink();
        ?>
"><img class="e-claro" src="<?php 
        echo dirname(get_bloginfo('stylesheet_url')) . "/images/btn-plus.jpg";
        ?>
"/>  Confira o post completo</a>
										</p>
									</div> <!-- /.entry-summary -->

								</article> <!-- /#post -->
							</div>
							<?php 
Пример #3
0
 function widget($args, $instance)
 {
     extract($args);
     extract($instance);
     global $post;
     $page_array = array();
     $icon_array = array();
     for ($i = 0; $i < 4; $i++) {
         $var = 'portfolio_' . $i;
         $page_id = isset($instance[$var]) ? absint($instance[$var]) : '';
         if (!empty($page_id)) {
             array_push($page_array, $page_id);
         }
         // Push the page id in the array
     }
     $get_service_pages = new WP_Query(array('posts_per_page' => -1, 'post_type' => array('page'), 'post__in' => $page_array, 'orderby' => 'post__in'));
     echo $before_widget;
     $j = 0;
     $list_num = count($page_array);
     switch ($list_num) {
         case 1:
             $column = "12";
             break;
         case 2:
             $column = "6";
             break;
         case 3:
             $column = "4";
             break;
         case 4:
             $column = "3";
             break;
     }
     if (count($page_array) > 0) {
         while ($get_service_pages->have_posts()) {
             $get_service_pages->the_post();
             $tags = get_the_tags(get_the_ID());
             $tags_list = '<ul>';
             if (is_array($tags)) {
                 foreach ($tags as $tag) {
                     $tag_link = get_tag_link($tag->term_id);
                     $tags_list .= "<li><a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
                     $tags_list .= "{$tag->name}</a></li>";
                 }
             }
             $tags_list .= '</ul>';
             echo '<div class="col-sm-6 col-md-' . $column . '"><div class="portfolio-box text-center productlist">';
             if (has_post_thumbnail()) {
                 echo '<a href="' . get_permalink() . '">';
                 the_post_thumbnail("portfolio");
                 echo '</a>';
             }
             echo '<a href="' . get_permalink() . '"><h3>' . get_the_title() . '</h3></a><p>' . get_the_twitter_excerpt(100) . '</p>' . $tags_list . '</div>';
             echo '</div>';
         }
         wp_reset_postdata();
     }
     echo $after_widget;
 }
Пример #4
0
" class="share-button facebook-share"><i class="fa fa-facebook"></i> Like</a>
                        <a href="javascript:" onclick="share_me_twitter(this);" data-title="<?php 
the_title();
?>
" data-description="<?php 
echo str_replace($tags, '', get_the_twitter_excerpt());
?>
" data-url="<?php 
the_permalink();
?>
" class="share-button twitter-share"><i class="fa fa-twitter"></i> Tweet</a>
                        <a href="javascript:" onclick="share_me_pinterest(this);" data-title="<?php 
the_title();
?>
" data-description="<?php 
echo str_replace($tags, '', get_the_twitter_excerpt());
?>
" data-url="<?php 
the_permalink();
?>
" data-image="<?php 
echo @$url;
?>
" class="share-button pinterest-share"><i class="fa fa-pinterest-p"></i> Pin it</a>
                        <a href="javascript:" class="share-button envelope-share"><i class="fa fa-envelope"></i> Email</a>
                    </div>
                </div>
                <div class="relative-posts">
                <?php 
$args = array('tax_query' => array('relation' => 'OR', array('taxonomy' => 'category', 'field' => 'slug', 'terms' => $cat_array, 'include_children' => false), array('taxonomy' => 'post_tag', 'field' => 'slug', 'terms' => $tagsPost)), 'post__not_in' => array($post->ID), 'posts_per_page' => 3, 'caller_get_posts' => 1, 'orderby' => 'rand');
$query = new WP_Query($args);