当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Query::the_post方法代码示例

本文整理汇总了PHP中WP_Query::the_post方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Query::the_post方法的具体用法?PHP WP_Query::the_post怎么用?PHP WP_Query::the_post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Query的用法示例。


在下文中一共展示了WP_Query::the_post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: charity_vc_our_mission

function charity_vc_our_mission($atts, $content = null)
{
    extract(shortcode_atts(array('our_mission' => ''), $atts));
    $page_id = get_page_by_title($our_mission);
    $missionQuery = new WP_Query(array("page_id" => $page_id->ID));
    if ($missionQuery->have_posts()) {
        $missionQuery->the_post();
        $url = wp_get_attachment_image_src(get_post_thumbnail_id($page_id->ID), array(1143, 479));
        ?>
        <!-- Save Lives Section Start Here-->
        <section class="save-lives text-center parallax" style="background-image: url('<?php 
        echo esc_url($url[0]);
        ?>
')">
            <div class="container">
                <div class="row">
                    <div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
                        <header class="page-header">
                            <h2><?php 
        the_title();
        ?>
</h2>
                            <?php 
        the_content();
        ?>
                        </header>
                    </div>
                </div>
            </div>
        </section>
        <!-- Save Lives Section Start Here-->
    <?php 
    }
    wp_reset_postdata();
}
开发者ID:kautzar,项目名称:drpp4,代码行数:35,代码来源:our-mission.php

示例2: widget

 function widget($args, $instance)
 {
     global $post;
     extract($args, EXTR_SKIP);
     echo $before_widget;
     $title = empty($instance['title']) ? __('Recent Posts', 'lan-thinkupthemes') : apply_filters('widget_title', $instance['title']);
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     $posts = new WP_Query('orderby=date&posts_per_page=' . $instance['postcount'] . '');
     while ($posts->have_posts()) {
         $posts->the_post();
         // Insert post date if needed.
         if ($instance['postdate'] == 'on') {
             $date_input = '<a href="' . get_permalink() . '" class="date">' . get_the_date('M j, Y') . '</a>';
         }
         // HTML output
         echo '<div class="recent-posts">';
         if (has_post_thumbnail() and $instance['imageswitch'] == 'on') {
             echo '<div class="image">', '<a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_post_thumbnail($post->ID, array(65, 65)) . '<div class="image-overlay"></div></a>', '</div>', '<div class="main">', '<a href="' . get_permalink() . '">' . get_the_title() . '</a>', $date_input, '</div>';
         } else {
             echo '<div class="main">', '<a href="' . get_permalink() . '">' . get_the_title() . '</a>', $date_input, '</div>';
         }
         echo '</div>';
     }
     wp_reset_query();
     echo $after_widget;
 }
开发者ID:closings,项目名称:closings,代码行数:28,代码来源:recentposts.php

示例3: generate_ryuzine_stylesheets

function generate_ryuzine_stylesheets()
{
    // verify this came from the our screen and with proper authorization.
    if (!wp_verify_nonce($_POST['ryu_regenstyles_noncename'], 'ryuzine-regenstyles_install')) {
        return;
    }
    // Check permissions
    if (!current_user_can('administrator')) {
        echo "<div class='error'><p>Sorry, you do not have the correct priveledges to install the files.</p></div>";
        return;
    }
    $my_query = null;
    $my_query = new WP_Query(array('post_type' => 'ryuzine'));
    if ($my_query->have_posts()) {
        while ($my_query->have_posts()) {
            $my_query->the_post();
            $stylesheet = "";
            $issuestyles = get_post_meta(get_the_ID(), '_ryustyles', false);
            if (!empty($issuestyles)) {
                foreach ($issuestyles as $appendstyle) {
                    // If there are multiple ryustyles append them //
                    $stylesheet = $stylesheet . $appendstyle;
                }
            }
            if ($stylesheet != "") {
                ryu_create_css($stylesheet, get_the_ID());
            }
        }
    }
    // reset css check //
    //	update_option('ryu_css_admin',0);
    wp_reset_query();
    return;
}
开发者ID:ryumaru,项目名称:ryuzine-press,代码行数:34,代码来源:rp_generate_css.php

示例4: bap_ajaxP_loop

function bap_ajaxP_loop($offset = '')
{
    global $wp_query;
    $paged = get_query_var('page') ? get_query_var('page') : 1;
    $do_not_duplicate = array();
    // OFFSET SETTING
    if (!$offset == '' || !$offset == '0') {
        $argshidepost = array('numberposts' => $offset, 'post_type' => 'post', 'post_status' => 'publish');
        $hide_to_array = get_posts($argshidepost);
        // HIDE OFFSETED POSTS
        if ($hide_to_array) {
            foreach ($hide_to_array as $post) {
                $do_not_duplicate[] = $post->ID;
            }
        }
    }
    $argsmain = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => $paged, 'order' => 'DESC', 'post__not_in' => $do_not_duplicate);
    $wp_query = new WP_Query($argsmain);
    if ($wp_query->have_posts()) {
        echo '<section id="' . bap_get_option_text('bap_loopContainer') . '">';
        while ($wp_query->have_posts()) {
            $wp_query->the_post();
            get_template_part('partials/listitem');
        }
        echo '</section>';
    }
    wp_reset_postdata();
}
开发者ID:Aventyret,项目名称:bentoWP_plugin_AjaxPagin,代码行数:28,代码来源:bap_functions.php

示例5: get_Relationships_by_Tag

 public function get_Relationships_by_Tag($tag, $_method, $_route, $_path, $_headers)
 {
     if (empty($tag) || !is_string($tag)) {
         return new WP_Error('json_options_invalid_tag', __("Invalid options tag"), ['status' => 404]);
     }
     $site = $_headers['REMOTE'];
     $tags = explode(',', $tag);
     if ($tags) {
         $tags_query['relation'] = 'OR';
         foreach ($tags as $tag) {
             $tags_query[] = array('key' => 'related_tags', 'value' => $tag, 'compare' => 'LIKE');
         }
     }
     $args = array('post_type' => 'relationship', 'meta_query' => array('relation' => 'AND', array('key' => 'site_address', 'value' => $site), $tags_query));
     $relationships = new WP_Query($args);
     if ($relationships->have_posts()) {
         // Get the Target Categories
         $targets = [];
         while ($relationships->have_posts()) {
             $relationships->the_post();
             $targets[] = get_field('target_category');
         }
         $targets = dedupe($targets);
         $related_categories = implode(', ', $targets);
         // Find Matching Relationships
         $args = array('post_type' => 'relationship', 'tax_query' => array(array('taxonomy' => 'related_categories', 'terms' => $related_categories)));
         $relationships = new WP_Query($args);
         // Build Relationships JSON Reponse
         include 'related-json-response.php';
     }
     wp_reset_query();
     return $sites;
 }
开发者ID:fullsteamlabs,项目名称:root-around,代码行数:33,代码来源:class-root-around-relationships.php

示例6: dispatch

 /**
  * Blockquote shortcode callback
  *
  * @param  array  $atts    shortcode attributes
  * @param  string $content shortcode content
  * @param  string $code    shortcode name
  * @return string          output html
  */
 public static function dispatch($atts, $content, $code)
 {
     extract(shortcode_atts(array('layout' => 'slider', 'cat' => '', 'ids' => '', 'autorotate' => false), $atts));
     $query = array('post_type' => 'testimonials', 'orderby' => 'menu_order', 'order' => 'DESC', 'posts_per_page' => -1);
     if (!empty($cat)) {
         $query['tax_query'] = array(array('taxonomy' => 'testimonials_category', 'field' => 'slug', 'terms' => explode(',', $cat)));
     }
     if ($ids && $ids != 'null') {
         $query['post__in'] = explode(',', $ids);
     }
     $q = new WP_Query($query);
     $output = '';
     if ($layout == 'slider') {
         $slides = array();
         while ($q->have_posts()) {
             $q->the_post();
             $slides[] = array('type' => 'html', 'html' => self::format());
         }
         $output = wpv_shortcode_slider(array('pager' => true, 'controls' => false, 'auto' => wpv_sanitize_bool($autorotate)), json_encode($slides), 'slider');
     } else {
         $output .= '<div class="blockquote-list">';
         while ($q->have_posts()) {
             $q->the_post();
             $output .= self::format();
         }
         $output .= '</div>';
     }
     wp_reset_postdata();
     return $output;
 }
开发者ID:petrfaitl,项目名称:wordpress-event-theme,代码行数:38,代码来源:blockquote.php

示例7: widget

 function widget($args, $instance)
 {
     extract($args);
     $instance = wp_parse_args($instance, $this->default);
     if (function_exists('icl_t')) {
         $instance['supertitle'] = icl_t('PRESSO Widget', $this->id . '_supertitle', $instance['supertitle']);
         $instance['title'] = icl_t('PRESSO Widget', $this->id . '_title', $instance['title']);
         $instance['subtitle'] = icl_t('PRESSO Widget', $this->id . '_subtitle', $instance['subtitle']);
     }
     $supertitle_html = '';
     if (!empty($instance['supertitle'])) {
         $supertitle_html = sprintf(__('<span class="super-title">%s</span>', 'envirra'), $instance['supertitle']);
     }
     $title_html = '';
     if (!empty($instance['title'])) {
         $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
         $title_html = $supertitle_html . $title;
     }
     $subtitle_html = '';
     if (!empty($instance['subtitle'])) {
         $subtitle_html = sprintf(__('<p class="section-description">%s</p>', 'envirra'), $instance['subtitle']);
     }
     $category = intval($instance['category']);
     $thumbnail = $instance['thumbnail'];
     $format = $instance['format'];
     $count = intval($instance['count']);
     echo $before_widget;
     if ($instance['title']) {
         echo $before_title . $title_html . $after_title . $subtitle_html;
     }
     global $post;
     $args = array('post_type' => 'post', 'orderby' => 'post_date', 'ignore_sticky_posts' => true, 'posts_per_page' => $count);
     if ($category > 0) {
         $args['cat'] = $category;
     }
     if (!empty($format)) {
         $args['tax_query'] = array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-' . $format)));
     }
     $the_query = new WP_Query($args);
     echo '<div class="post-box-list">';
     if ('large' == $thumbnail || 'small' == $thumbnail) {
         while ($the_query->have_posts()) {
             $the_query->the_post();
             get_template_part('templates/post-box/' . $thumbnail . '-thumbnail', get_post_format());
         }
     } else {
         if ($the_query->have_posts()) {
             $the_query->the_post();
             get_template_part('templates/post-box/large-thumbnail', get_post_format());
         }
         while ($the_query->have_posts()) {
             $the_query->the_post();
             get_template_part('templates/post-box/small-thumbnail', get_post_format());
         }
     }
     echo '</div>';
     wp_reset_postdata();
     echo $after_widget;
 }
开发者ID:wilxsv,项目名称:prevensionPublicLibrary,代码行数:59,代码来源:latest-category.php

示例8: gm_faq_shortcode

function gm_faq_shortcode( $atts ) {
	extract( shortcode_atts( array(
		'orderby' => 'menu_order',
		'cat' => '',
		'display' => 'excerpt',
	), $atts ) );

	$db_args = array(
		'post_type' => 'faqs',
		'order' => 'ASC',
		'orderby' => $orderby,
		'faq_categories' => $cat,
	);

	$original_query = $wp_query;
	$faqs_loop = new WP_Query( $db_args );
	if($faqs_loop->have_posts()) {
		switch($display) {		
			case "content":
				$content .= "<div class=\"faqs_wrapper\">";
				while( $faqs_loop->have_posts() ) : $faqs_loop->the_post();
					$content_filtered = get_the_content();
					$content_filtered = apply_filters('the_content', $content_filtered);
					$content_filtered = str_replace(']]>', ']]&gt;', $content_filtered);
					$content .= "<div class=\"faq_single\">";
					$content .= "<h3 class=\"faq_title\">".get_the_title()."</h3>";
					$content .= "<div class=\"faq_content\">$content_filtered</div>";
					$content .= "</div>";
				endwhile;
				$content .= "</div>";
				break;
			case "excerpt":
				$content .= "<div class=\"faqs_wrapper\">";
				while( $faqs_loop->have_posts() ) : $faqs_loop->the_post();
					$content .= "<div class=\"faq_single\">";
					$content .= "<h3 class=\"faq_title\"><a href=".get_permalink().">".get_the_title()."</a></h3>";
					$content .= "<div><span class=\"faq_excerpt\">".get_the_excerpt()."</span></div>";
					$content .= "</div>";
				endwhile;
				$content .= "</div>";
				break;
			case "list":
				$content .= "<ul class=\"faqs_wrapper\">";
				while( $faqs_loop->have_posts() ) : $faqs_loop->the_post();
					$content .= "<li class=\"faq_single\">";
					$content .= "<span class=\"faq_title\"><a href=".get_permalink().">".get_the_title()."</a></span>";
					$content .= "</li>";
				endwhile;
				$content .= "</ul>";
				break;
		}
			
	}
	$wp_query = null;
	$wp_query = $original_query;
	wp_reset_postdata();
	return $content;
				
}
开发者ID:npalomares,项目名称:wp_starter,代码行数:59,代码来源:shortcodes.php

示例9: widget

 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $items = intval($instance['items']);
     $hide = $instance['hide'];
     wp_register_script('needtoknow', plugins_url("/ht-need-to-know/ht_need_to_know.js"));
     wp_enqueue_script('needtoknow');
     //display need to know stories
     $cquery = array('orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'news', 'posts_per_page' => -1, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-status'))));
     $news = new WP_Query($cquery);
     $read = 0;
     $show = 0;
     $alreadydone = array();
     if ($hide) {
         while ($news->have_posts()) {
             $news->the_post();
             if (isset($_COOKIE['ht_need_to_know_' . get_the_id()])) {
                 $read++;
                 $alreadydone[] = get_the_id();
             } else {
                 $show++;
             }
         }
     } else {
         $show = 1;
     }
     if ($news->post_count != 0 && $news->post_count != $read && $show) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo "<div id='need-to-know'><ul class='need'>";
     }
     $k = 0;
     while ($news->have_posts()) {
         $news->the_post();
         if (in_array(get_the_id(), $alreadydone) || $k > $items) {
             continue;
         }
         //don't show if already read
         $k++;
         if ($k > $items) {
             break;
         }
         $thistitle = get_the_title();
         $thisURL = get_permalink();
         $icon = get_option('options_need_to_know_icon');
         if ($icon == '') {
             $icon = "flag";
         }
         echo "<li><a href='{$thisURL}' onclick='Javascript:pauseNeedToKnow(\"ht_need_to_know_" . get_the_id() . "\");'><span class='glyphicon glyphicon-" . $icon . "'></span> " . $thistitle . "</a></li>";
     }
     if ($news->post_count != 0 && $news->post_count != $read && $show) {
         echo "</ul></div>";
         echo $after_widget;
     }
     wp_reset_query();
 }
开发者ID:ryanlfoster,项目名称:govintranet,代码行数:59,代码来源:ht_need_to_know.php

示例10: current

 public function current()
 {
     global $post;
     $this->_query->the_post();
     // Sets up the global post, but also return the post, for use in Twig template
     $posts_class = $this->_posts_class;
     return new $posts_class($post);
 }
开发者ID:JimCaignard,项目名称:wordpress-sass-gulp-timber-starter,代码行数:8,代码来源:timber-query-iterator.php

示例11: widget

    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        echo str_replace('class="', 'class="icon-clock ', $before_widget);
        $post_type = $instance['post_type'];
        $postcount = $instance['postcount'];
        $buttontext = $instance['buttontext'];
        $buttonurl = $instance['buttonurl'];
        $show_images = (bool) $instance['show_images'];
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        $wpbp = new WP_Query(array('post_type' => $post_type, 'posts_per_page' => $postcount, 'post_status' => 'publish'));
        if ($wpbp->have_posts()) {
            if ($show_images === true) {
                // IMAGE TILES
                echo '<ul class="recent-projects-widget">';
                while ($wpbp->have_posts()) {
                    $wpbp->the_post();
                    if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
                        echo '<li><a href="' . get_permalink() . '">';
                        the_post_thumbnail('thumbnail');
                        echo '</a></li>';
                    }
                }
                echo '</ul>';
            } else {
                // POSTS LINKS
                echo '<ul>';
                while ($wpbp->have_posts()) {
                    $wpbp->the_post();
                    echo '<li><a href="' . get_permalink() . '">';
                    the_title();
                    echo '</a></li>';
                }
                echo '</ul>';
            }
        } else {
            echo '<p>' . __('No recent posts available', 'ishyoboy') . '</p>';
        }
        wp_reset_query();
        if (!empty($buttontext)) {
            ?>
            <a class="btn-small" href="<?php 
            echo esc_attr(apply_filters('ishyoboy_widget_button_url', $buttonurl));
            ?>
"><?php 
            echo $buttontext;
            ?>
</a>
        <?php 
        }
        ?>

        <?php 
        echo $after_widget;
    }
开发者ID:baden03,项目名称:access48,代码行数:66,代码来源:recent-posts.php

示例12: handleShortcode

 public function handleShortcode($atts)
 {
     $attributes = shortcode_atts(array('type' => 'floorplans', 'status' => 'publish', 'taxterms' => null, 'taxonomy' => 'property_relationship'), $atts);
     $args = ['post_type' => $attributes['type'], 'posts_per_page' => -1];
     if (isset($attributes['taxterms'])) {
         $args[$attributes['taxonomy']] = $attributes['taxterms'];
     }
     $args['post_status'] = $attributes['status'];
     $floorplans = new WP_Query($args);
     $html = '';
     $count = 0;
     if ($floorplans->have_posts()) {
         $tmp = '';
         $output = '<div class="floorplanFilters">';
         while ($floorplans->have_posts()) {
             $floorplans->the_post();
             $category_classes = '';
             $categories = get_the_terms($floorplans->post->ID, $attributes['taxonomy']);
             if ($categories) {
                 if ($categories[0]->name !== $tmp || $tmp == '') {
                     $filterLinkName = str_replace('-', ' ', str_replace('.', '', $categories[0]->name));
                     $filter = str_replace('.', '', $categories[0]->name);
                     $html .= "<a href='javascript:void()' class='filter button' data-filter=' " . $filter . " '>" . ucwords(htmlentities($filterLinkName)) . "</a>";
                     $count++;
                     ob_start();
                     echo $html;
                     $output .= ob_get_contents();
                     ob_end_clean();
                 }
                 $tmp = $categories[0]->name;
             }
         }
         $output .= "</div>";
         if ($count == 1) {
             $html = "";
         }
         wp_reset_postdata();
         $html .= "<div id='floorplanContainer'>";
         while ($floorplans->have_posts()) {
             $floorplans->the_post();
             $taxTerms = get_the_terms($floorplans->post->ID, $attributes['taxonomy']);
             $floorplan = get_post_meta($floorplans->post->ID);
             $permalink = get_the_permalink();
             $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($floorplans->post->ID), 'thumbnail');
             $imgsrc = $thumb['0'];
             $imgsrc = isset($imgsrc) ? '<img src="' . $imgsrc . '" alt=""/>' : '<img src="http://placehold.it/150x150" alt=""/>';
             $termName = isset($taxTerms[0]) ? $taxTerms[0]->name : '';
             $html .= "<div class='mix '" . str_replace('.', '', $termName) . "'>";
             $html .= "<div class='mix-img'>" . $imgsrc . "</div>";
             $html .= "<h4><a href='" . $permalink . "'> " . $floorplan['fpName'][0] . "</a></h4>";
             $html .= "<p>Starting at \$" . $floorplan['fpMaxRent'][0] . " </p></div>";
         }
         $html .= "</div>";
     }
     wp_reset_postdata();
     return $output . $html;
 }
开发者ID:30lines,项目名称:TopLineWP,代码行数:57,代码来源:topline_FloorplanShortcode.php

示例13: valid

 /**
  * (PHP 5 &gt;= 5.0.0)<br/>
  * Checks if current position is valid
  * @link http://php.net/manual/en/iterator.valid.php
  * @return boolean The return value will be casted to boolean and then evaluated.
  *       Returns true on success or false on failure.
  */
 public function valid()
 {
     if ($this->_query->have_posts()) {
         if (!$this->_query->in_the_loop) {
             $this->_query->the_post();
         }
         return true;
     }
     $this->_query->rewind_posts();
     wp_reset_postdata();
     return false;
 }
开发者ID:johnpbloch,项目名称:loopable-query,代码行数:19,代码来源:Query.php

示例14: dynamic_shortcode

function dynamic_shortcode($atts)
{
    ob_start();
    $query = new WP_Query(array('post_type' => 'post', 'order' => 'ASC', 'posts_per_page' => -1));
    if ($query->have_posts()) {
        ?>
<div id="tabs">
<ul class="tab-nav">
  <?php 
        while ($query->have_posts()) {
            $query->the_post();
            ?>
<li><a href="#post-<?php 
            echo get_the_ID();
            ?>
"><?php 
            the_title();
            ?>
</a></li>
  <?php 
        }
        ?>
 </ul>
<?php 
    }
    if ($query->have_posts()) {
        ?>
  <?php 
        while ($query->have_posts()) {
            $query->the_post();
            ?>
  <div id="post-<?php 
            echo get_the_ID();
            ?>
">
    <div class="the-content">
      <?php 
            the_content();
            ?>
    </div>

  </div>
  <?php 
        }
        wp_reset_query();
        ?>
</div>
<?php 
        $myvariable = ob_get_clean();
        return $myvariable;
    }
}
开发者ID:radon1284,项目名称:Wordpress-Post-Jquery-Tab,代码行数:52,代码来源:post_tab.php

示例15: mt_projects_shortcode

function mt_projects_shortcode($atts)
{
    // Attributes
    extract(shortcode_atts(array('number' => '-1', 'category' => '', 'columns' => '3', 'style' => 'hover'), $atts));
    $output = '';
    $scprojects = new WP_Query(array('post_type' => 'project', 'posts_per_page' => $number, 'category_name' => $category));
    if ($scprojects->have_posts()) {
        if ($style == 'hover') {
            $output .= '<section id="mt-projects"><div class="grid grid-pad">';
            while ($scprojects->have_posts()) {
                $scprojects->the_post();
                $output .= '<div class="col-1-' . $columns . ' mt-column-clear"><div class="project-box">';
                $output .= '<a href="' . get_the_permalink() . '">';
                $output .= '<div class="project-content"><div><span>';
                $output .= '<h3>' . get_the_title() . '</h3>';
                $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'project-thumb');
                $image = $image[0];
                $output .= '<div class="project-bg" style="background-image: url(' . $image . ');"></div>';
                $output .= '</span></div></div>';
                $output .= '</a>';
                $output .= '</div></div>';
            }
            $output .= '</div></section>';
        }
        if ($style == 'image') {
            $output .= '<section id="mt-projects"><div class="grid grid-pad">';
            while ($scprojects->have_posts()) {
                $scprojects->the_post();
                $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'max-control');
                $image = $image[0];
                $output .= '<a href="' . get_the_permalink() . '">';
                if (has_post_thumbnail(get_the_ID())) {
                    $output .= '<div class="home-project-image-bg" style="background-image: url(' . $image . ');">';
                } else {
                    $output .= '<div class="home-project-image-bg">';
                }
                $output .= '<span><h5>' . get_the_title() . '</h5></span>';
                if (has_post_thumbnail(get_the_ID())) {
                    $output .= '</div>';
                } else {
                    $output .= '</div>';
                }
                $output .= '</a>';
            }
            $output .= '</div></section>';
        }
    }
    wp_reset_postdata();
    return $output;
}
开发者ID:gbrutkiewicz,项目名称:ld,代码行数:50,代码来源:shortcodes-mt-projects.php


注:本文中的WP_Query::the_post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。