• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP the_ID函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中the_ID函数的典型用法代码示例。如果您正苦于以下问题:PHP the_ID函数的具体用法?PHP the_ID怎么用?PHP the_ID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: Page

function Page()
{
    ?>
<div class="article">
  <article id="post-<?php 
    the_ID();
    ?>
" <?php 
    post_class();
    ?>
>
    <?php 
    Page_Header();
    ?>
    <?php 
    Article_Content();
    ?>
    <?php 
    Page_Footer();
    ?>
  </article>
</div>

<?php 
}
开发者ID:gios-asu,项目名称:bemmy-wordpress-theme,代码行数:25,代码来源:Page.php


示例2: widget

    /**
     * Outputs the content for a new widget instance.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args 		Widget arguments.
     * @param array $instance 	Saved values from database.
     */
    function widget($args, $instance)
    {
        extract($args);
        if (isset($instance['page']) && $instance['page'] != -1) {
            $page_id = (int) $instance['page'];
            $p = new WP_Query(array('page_id' => $page_id));
            if ($p->have_posts()) {
                $p->the_post();
                $title = apply_filters('widget_title', empty($instance['title']) ? get_the_title() : $instance['title'], $instance, $this->id_base);
                echo $before_widget;
                echo $before_title;
                echo $title;
                echo $after_title;
                ?>
				<div id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class();
                ?>
>
						<?php 
                the_content();
                ?>
				</div>

				<?php 
                echo $after_widget;
                wp_reset_postdata();
            }
        }
    }
开发者ID:redweb-tn,项目名称:sx-featured-page-widget,代码行数:40,代码来源:sx-featured-page-widget.php


示例3: Search

function Search()
{
    ?>
<div class="article">
  <article id="post-<?php 
    the_ID();
    ?>
" <?php 
    post_class();
    ?>
>
    <?php 
    Search_Header();
    ?>
    <?php 
    Article_Summary();
    ?>
    <?php 
    Article_Footer();
    ?>
  </article>
</div>

<?php 
}
开发者ID:gios-asu,项目名称:bemmy-wordpress-theme,代码行数:25,代码来源:Search.php


示例4: getPosts

    public function getPosts($get, $post)
    {
        if (!isset($get['form_id'])) {
            echo '';
            die;
        }
        $form_id = intval($get['form_id']);
        $fm = CRED_Loader::get('MODEL/Forms');
        $form_settings = $fm->getFormCustomField($form_id, 'form_settings');
        if (!$form_settings) {
            echo '';
            die;
        }
        //print_r($form_settings);
        $post_type = $form_settings['post_type'];
        $post_query = new WP_Query(array('post_type' => $post_type, 'posts_per_page' => -1));
        ob_start();
        if ($post_query->have_posts()) {
            while ($post_query->have_posts()) {
                $post_query->the_post();
                ?>
                <option value="<?php 
                the_ID();
                ?>
"><?php 
                the_title();
                ?>
</option>
                <?php 
            }
        }
        $output = ob_get_clean();
        echo $output;
        die;
    }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:35,代码来源:Posts_Controller.php


示例5: Article

function Article()
{
    ?>
<div class="article">
  <article id="post-<?php 
    the_ID();
    ?>
" <?php 
    post_class();
    ?>
>
    <?php 
    Article_Header();
    ?>
    <?php 
    if (is_single()) {
        Article_Content();
    } else {
        Article_Continue();
    }
    ?>
  
    <?php 
    Article_Footer();
    ?>
  </article>
</div>

<?php 
}
开发者ID:gios-asu,项目名称:bemmy-wordpress-theme,代码行数:30,代码来源:Article.php


示例6: widget

	/** @see WP_Widget::widget */
	function widget($args, $instance) {
		$cache = wp_cache_get('widget_recent_products', 'widget');

		if ( !is_array($cache) ) $cache = array();

		if ( isset($cache[$args['widget_id']]) ) {
			echo $cache[$args['widget_id']];
			return;
		}

		ob_start();
		extract($args);
		
		$title = apply_filters('widget_title', empty($instance['title']) ? __('New Products', 'jigoshop') : $instance['title'], $instance, $this->id_base);
		if ( !$number = (int) $instance['number'] )
			$number = 10;
		else if ( $number < 1 )
			$number = 1;
		else if ( $number > 15 )
			$number = 15;

    $show_variations = $instance['show_variations'] ? '1' : '0';

    $args = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'post_type' => 'product');

    if($show_variations=='0'){
      $args['meta_query'] = array(
			  array(
				  'key' => 'visibility',
				  'value' => array('catalog', 'visible'),
				  'compare' => 'IN'
			  )
		  );
		  $args['parent'] = '0';
    }

		$r = new WP_Query($args);
		
		if ($r->have_posts()) :
?>
		<?php echo $before_widget; ?>
		<?php if ( $title ) echo $before_title . $title . $after_title; ?>
		<ul class="product_list_widget">
		<?php  while ($r->have_posts()) : $r->the_post(); $_product = &new jigoshop_product(get_the_ID()); ?>
		<li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>">
			<?php if (has_post_thumbnail()) the_post_thumbnail('shop_tiny'); else echo '<img src="'.jigoshop::plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.jigoshop::get_var('shop_tiny_w').'px" height="'.jigoshop::get_var('shop_tiny_h').'px" />'; ?>
			<?php if ( get_the_title() ) the_title(); else the_ID(); ?>
		</a> <?php echo $_product->get_price_html(); ?></li>
		<?php endwhile; ?>
		</ul>
		<?php echo $after_widget; ?>
<?php
		// Reset the global $the_post as this query will have stomped on it
		//wp_reset_postdata();

		endif;

		if (isset($args['widget_id']) && isset($cache[$args['widget_id']])) $cache[$args['widget_id']] = ob_get_flush();
		wp_cache_set('widget_recent_products', $cache, 'widget');
	}
开发者ID:rszczypka,项目名称:jigoshop,代码行数:61,代码来源:recent_products.php


示例7: section_template

    function section_template()
    {
        $loop = new fotosPostLoop();
        $artsep = pl_setting('ba_fotos_art_sep');
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>
<article <?php 
                post_class('fotos-article');
                ?>
 id="post-<?php 
                the_ID();
                ?>
" itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost"><?php 
                $loop->post_header();
                $loop->post_content();
                $loop->post_social();
                $loop->post_comments();
                ?>
</article><?php 
                if ($artsep && is_home()) {
                    echo $artsep;
                }
            }
        } else {
            echo 'Sorry no posts found';
        }
    }
开发者ID:adrian-sowinski,项目名称:fotos,代码行数:29,代码来源:section.php


示例8: render_content

function render_content()
{
    ?>
	<?php 
    if (have_posts()) {
        ?>
		<div class="loop">
			<div class="loop-content">
				<?php 
        while (have_posts()) {
            // The Loop
            ?>
					<?php 
            the_post();
            ?>
					
					<div id="post-<?php 
            the_ID();
            ?>
" <?php 
            post_class();
            ?>
>
						<!-- title, meta, and date info -->
						<div class="entry-header clearfix">
							<h1 class="entry-title"><?php 
            the_title();
            ?>
</h1>
						</div>
						
						<!-- post content -->
						<div class="entry-content clearfix">
							<?php 
            the_content();
            ?>
						</div>
						
						<?php 
            get_search_form();
            ?>
					</div>
					<!-- end .post -->
				<?php 
        }
        // end of one post
        ?>
			</div>
		</div>
	<?php 
    } else {
        // do not delete
        ?>
		<?php 
        do_action('builder_template_show_not_found');
        ?>
	<?php 
    }
    // do not delete
}
开发者ID:jimrucinski,项目名称:Vine,代码行数:60,代码来源:page_search.php


示例9: categori_news

        function categori_news(){
            query_posts('cat=9&showposts=10&posts_per_page=3');

            while (have_posts()) : the_post();
                /*Dima insert*/the_excerpt(); ?>
                <div class="content-box">
                    <div class="bgr01"><div class="bgr02"><div class="bgr03">
                                <div <?php post_class() ?> id="post-<?php the_ID(); ?>" style=" float:none; ">
                                    <div class="title">
                                        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                                        <div class="date_all">
                                            <?php the_time('l, j ?F, Y') ?>
                                        </div>
                                        <div class="post">
                                            Написал <?php the_author_link() ?> <?php the_time('g:i A') ?>
                                        </div>
                                    </div>
                                    <div class="content_box">
                                        <?php the_content('Читать всё'); ?>
                                    </div>

                                    <div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></div>

                                    <div class="comments"><?php comments_popup_link('0 комментарии', 'комментарии', '% комментарии '); ?></div>
                                    <div class="link-edit"><?php edit_post_link('Edit', ''); ?></div>
                                </div>
                            </div></div></div>
                </div>
            <?php endwhile;}
开发者ID:xronn01,项目名称:www.prosvitcenter.org,代码行数:29,代码来源:myfunk.php


示例10: thesis_teaser

function thesis_teaser($classes, $post_count = false, $right = false)
{
    $classes = 'teaser';
    $post_image = thesis_post_image_info('thumb');
    if ($right) {
        $classes .= ' teaser_right';
    }
    thesis_hook_before_teaser_box($post_count);
    #hook
    ?>
			<div <?php 
    post_class($classes);
    ?>
 id="post-<?php 
    the_ID();
    ?>
">
<?php 
    thesis_build_teaser($post_count, $post_image);
    ?>
			</div>

<?php 
    thesis_hook_after_teaser_box($post_count);
    #hook
    echo $close_box;
}
开发者ID:JGrubb,项目名称:Almond-Tree,代码行数:27,代码来源:teasers.php


示例11: widget

    function widget($args, $instance)
    {
        $cache = wp_cache_get('widget_Pending_posts', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (isset($cache[$args['widget_id']])) {
            return $cache[$args['widget_id']];
        }
        ob_start();
        extract($args);
        $title = empty($instance['title']) ? __('Pending Posts', 'Pending_posts_widget') : apply_filters('widget_title', $instance['title']);
        if (!($number = (int) $instance['number'])) {
            $number = 10;
        } else {
            if ($number < 1) {
                $number = 1;
            } else {
                if ($number > 15) {
                    $number = 15;
                }
            }
        }
        $queryArgs = array('showposts' => $number, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'pending', 'caller_get_posts' => 1, 'order' => 'ASC');
        $r = new WP_Query($queryArgs);
        if ($r->have_posts()) {
            ?>
		<?php 
            echo $before_widget;
            ?>
		<?php 
            echo $before_title . $title . $after_title;
            ?>
		<ul>
		<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
		<li><?php 
                if (get_the_title()) {
                    the_title();
                } else {
                    the_ID();
                }
                edit_post_link('e', ' (', ')');
                ?>
</li>
		<?php 
            }
            ?>
		</ul>
		<?php 
            echo $after_widget;
            wp_reset_query();
            // Restore global post data stomped by the_post().
        }
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_add('widget_Pending_posts', $cache, 'widget');
    }
开发者ID:huyz,项目名称:Wordpress-Plugins,代码行数:59,代码来源:pending-posts-widget.php


示例12: cases_display_childs_cp

function cases_display_childs_cp()
{
    global $post;
    $query = new WP_Query('post_type=cases&post_parent=' . $post->ID);
    if (!is_singular('cases')) {
        return;
    }
    ?>
	<section id="person_dossier" class="cases-box">
		<header class="cases-box-header">
	    	<h1>Досье</h1>
	    	<hr>
		</header>
		<article class="cases-box-content">
            <ul>
			<?php 
    while ($query->have_posts()) {
        $query->the_post();
        ?>
            <li role="article" id="post-<?php 
        the_ID();
        ?>
" <?php 
        post_class();
        ?>
>
                <header class="entry-header">
                    <a href="<?php 
        the_permalink();
        ?>
">
                        <h2 class="entry-title"><?php 
        the_title();
        ?>
</h2>
                    </a>
                </header>
                <section id='meta-case'>
                    <ul class="list-inline">
                        <?php 
        do_action('case_meta_top_add_li');
        ?>
                    </ul> 
                </section>
                
            </li><!-- #post-<?php 
        the_ID();
        ?>
 -->    

            <?php 
    }
    wp_reset_postdata();
    ?>
            </ul>
		</article>
	</section>
<?php 
}
开发者ID:Laxiston,项目名称:casepress,代码行数:59,代码来源:dossier.php


示例13: element

    function element()
    {
        $title_style = $this->opt('title_style') ? $this->opt('title_style') : 'zn_titleStyle1';
        $title = $this->opt('title') ? $this->opt('title') : 'Latest Posts';
        $titleAlignment = $this->opt('title_alignment') ? $this->opt('title_alignment') : 'text-left';
        $number = $this->opt('items_count') ? $this->opt('items_count') : 3;
        $category = $this->opt('category') ? $this->opt('category') : '';
        //** Appear animation
        $appear = $this->opt('appear_animation') ? 'data-appear="fade-in" data-appear-direction="' . $this->opt('appear_animation') . '" data-appear-delay="' . ($this->opt('appear_delay') ? $this->opt('appear_delay') : '0') . '"' : '';
        ?>

		<div class="latestPostsList <?php 
        echo $this->data['uid'];
        ?>
" <?php 
        echo $appear;
        ?>
>
			<?php 
        echo '<h2 class="zn_title ' . $title_style . ' ' . $titleAlignment . '">' . $title . '</h2>';
        ?>
			
			<?php 
        //if ( $link_text && is_array( $link ) ) { echo $link['start'] . $link_text . $link['end']; }
        $args = array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true);
        if (is_array($category)) {
            $args['cat'] = implode(',', $category);
        }
        $r = new WP_Query($args);
        if ($r->have_posts()) {
            ?>
		<ul>
		<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
			<li>
                <a href="<?php 
                the_permalink();
                ?>
"><?php 
                get_the_title() ? the_title() : the_ID();
                ?>
</a>
            </li>
		<?php 
            }
            ?>
		</ul>
<?php 
            // Reset the global $the_post as this query will have stomped on it
            wp_reset_postdata();
        }
        ?>
		</div>

    <?php 
    }
开发者ID:fjbeteiligung,项目名称:development,代码行数:58,代码来源:latest_posts_list.php


示例14: theme_gallery_lightbox

    /**
     * Post gGallery with lightbox ready for use.
     */
    function theme_gallery_lightbox($post_id)
    {
        global $post;
        $thumbnail_ID = get_post_thumbnail_id();
        $images = get_children(array('post_parent' => $post_id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'));
        if ($images) {
            ?>

        <ul class="gallery-list" data-action="gallery-<?php 
            the_ID();
            ?>
" data-ui-component="gallery">

        <?php 
            foreach ($images as $attachment_id => $image) {
                if ($image->ID != $thumbnail_ID) {
                    $img_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
                    //alt
                    if ($img_alt == '') {
                        $img_alt = $img_title;
                    }
                    $big_array = image_downsize($image->ID, 'full');
                    $img_url = $big_array[0];
                    ?>

            <li class="gallery-item" data-src="<?php 
                    echo $image_url;
                    ?>
" data-html="<div class='gallery-caption'><h4 class='text-inverse'><?php 
                    echo the_title();
                    ?>
</h4><?php 
                    echo the_content();
                    ?>
</div>">
                <img src="<?php 
                    echo $img_url;
                    ?>
" alt="<?php 
                    echo $img_alt;
                    ?>
" title="<?php 
                    echo $img_title;
                    ?>
" />
            </li>

            <?php 
                }
                ?>
            <?php 
            }
            ?>
        </ul>
        <?php 
        }
    }
开发者ID:jimbarrett147,项目名称:boilerplates,代码行数:60,代码来源:gallery.php


示例15: komatsu_menu_template

function komatsu_menu_template($type = '')
{
    $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
    $args = array('post_type' => 'menu', 'posts_per_page' => -1, 'order' => 'ASC', 'orderby' => 'menu_order', 'tax_query' => array(array('taxonomy' => 'courses', 'field' => 'slug', 'terms' => $type)));
    $the_query = new WP_Query($args);
    if ($the_query->have_posts()) {
        ?>
    <div class="row">
        <ul class="menu">
            <?php 
        while ($the_query->have_posts()) {
            $the_query->the_post();
            ?>
            <li id="post-<?php 
            the_ID();
            ?>
" class="col-xs-10 col-xs-offset-1 col-sm-4 col-sm-offset-0 col-md-3">
	        	<?php 
            if (has_post_thumbnail()) {
                ?>
			     	 <?php 
                the_post_thumbnail('thumbnail', array('class' => 'img-responsive col-sm-12 hidden-xs'));
                ?>
				 <?php 
            } else {
                ?>
					<img class="img-responsive col-sm-12 hidden-xs" src="http://placehold.it/200x200/eeeeee/888888">
				 <?php 
            }
            ?>
	            <div class="col-sm-12">
	                <h4><?php 
            the_title();
            ?>
</h4>

	                <span><?php 
            echo implode(', ', get_field('ingredients'));
            ?>
</span>
					<p class="price"><?php 
            the_field('price');
            ?>
</p>
				</div>
				<div class="clearfix"></div>
            </li>
            <?php 
        }
        wp_reset_postdata();
        ?>
        </ul>
    </div>
    <?php 
    }
}
开发者ID:ashleycam3ron,项目名称:komatsu,代码行数:56,代码来源:custom_post_shortcodes.php


示例16: widget

    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        global $icon;
        $icon = $instance['icon'];
        $title = apply_filters('widget_title', $instance['title']);
        $number = $instance['number'];
        /* before widget */
        echo $before_widget;
        /* display title */
        if ($title && $icon) {
            echo $before_title . '<i class="fa ' . $icon . ' "></i>' . $title . $after_title;
        } elseif ($title) {
            echo $before_title . $title . $after_title;
        }
        /* display the widget */
        ?>
						
		<div <?php 
        post_class();
        ?>
 id="images-widget-<?php 
        the_ID();
        ?>
">
                        
                        <div class="gallery-widget">
                        
                        <ul>
                        <?php 
        global $post;
        $args = array('order' => 'DESC', 'post_type' => 'gallery', 'posts_per_page' => 1);
        $loop = new WP_Query($args);
        while ($loop->have_posts()) {
            $loop->the_post();
            $images = rwmb_meta('gxg_gallery_images', 'type=image&size=square2', false);
            $i = 0;
            foreach ($images as $image) {
                $imageurl = $image['url'];
                $imagefull = $image['full_url'];
                if ($i++ < $number) {
                    echo "<li class='prettyimage-wrap'><a class='pretty_image' title='' data-rel='prettyPhoto[pp_gallery]' href='{$imagefull}'><span class='image-rollover'><i class='gallery-resize-icon fa fa-expand'></i></span><img src='{$imageurl}' alt='' /></a></li>";
                }
            }
        }
        wp_reset_query();
        ?>
                
                        </ul>
                        </div><!-- .gallery-widget --> 
                        </div><!-- .post-? --> 
		
                <?php 
        /* after widget */
        echo $after_widget;
    }
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:56,代码来源:widget-images.php


示例17: simple_toolbar

function simple_toolbar()
{
    if (is_user_logged_in()) {
        //Current User EMail
        global $current_user;
        get_currentuserinfo();
        $email = $current_user->user_email;
        $grav_url = "http://www.gravatar.com/avatar/" . md5(strtolower(trim($email))) . "?d=" . urlencode($default) . "&s=" . $size;
        ?>

    <nav class="admin-nav">
        <a href="/wp-admin/profile.php" target="_blank">
            <li style="background-image: url('<?php 
        echo $grav_url;
        ?>
')">
            </li>
        </a>
        <a href="/wp-admin/" target="_blank">
            <li>
                <i class="fa fa-home"></i>
                <nobr>Admin Dashboard</nobr>
            </li>
        </a>
        <a href="/wp-admin/post.php?post=<?php 
        the_ID();
        ?>
&action=edit" target="_blank">
            <li>
                <i class="fa fa-pencil"></i>
                <nobr>Edit Page</nobr>
            </li>
        </a>
        <?php 
        if (class_exists('acf')) {
            ?>
            <a href="/wp-admin/edit.php?post_type=acf-field-group" target="_blank">
                <li>
                    <i class="fa fa-code"></i>
                    <nobr>ACF</nobr>
                </li>
            </a>
        <?php 
        }
        ?>
        <a href="/wp-admin/post-new.php" target="_blank">
            <li>
                <i class="fa fa-plus"></i>
                <nobr>New Post</nobr>
            </li>
        </a>
    </nav>

    <?php 
    }
}
开发者ID:erickolivares,项目名称:mindsauce,代码行数:56,代码来源:simple-toolbar.php


示例18: widget

    public function widget($args, $instance)
    {
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->id;
        }
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $number = !empty($instance['number']) ? absint($instance['number']) : 5;
        if (!$number) {
            $number = 5;
        }
        $args_article = array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'order' => $instance['order'], 'orderby' => $instance['orderby']);
        if (is_array($instance['category'])) {
            $args_article['category__in'] = $instance['category'];
        }
        $r = new WP_Query(apply_filters('widget_posts_args', $args_article));
        if ($r->have_posts()) {
            echo $args['before_widget'];
            if ($title) {
                echo $args['before_title'] . $title . $args['after_title'];
            }
            ?>
            <ul class="kt_posts_carousel_widget">
                <?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
                    <li <?php 
                post_class('article-widget clearfix');
                ?>
>
                        <?php 
                kt_post_thumbnail_image('kt_widget_article_carousel', 'img-responsive');
                ?>
                        <div class="article-attr">
                            <h3 class="title">
                                <a href="<?php 
                the_permalink();
                ?>
">
                                    <?php 
                get_the_title() ? the_title() : the_ID();
                ?>
                                </a>
                            </h3>
                        </div>
                    </li>
                <?php 
            }
            ?>
            </ul>
            <?php 
            echo $args['after_widget'];
            wp_reset_postdata();
        }
    }
开发者ID:websideas,项目名称:aquila,代码行数:55,代码来源:kt_article_carousel.php


示例19: widget

    public function widget($args, $instance)
    {
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->id;
        }
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $number = !empty($instance['number']) ? absint($instance['number']) : 5;
        if (!$number) {
            $number = 5;
        }
        $args_article = array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'order' => $instance['order'], 'orderby' => $instance['orderby']);
        if (is_array($instance['category'])) {
            $args_article['category__in'] = $instance['category'];
        }
        $r = new WP_Query(apply_filters('widget_posts_args', $args_article));
        if ($r->have_posts()) {
            echo $args['before_widget'];
            if ($title) {
                echo $args['before_title'] . $title . $args['after_title'];
            }
            ?>

            <ul class="kt-posts-widget">
                <?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
                    <li>
                        <?php 
                kt_post_thumbnail_image('kt_small', 'img-responsive');
                ?>
                        <div class="content">
                            <a class="title-link" href="<?php 
                the_permalink();
                ?>
"><?php 
                get_the_title() ? the_title() : the_ID();
                ?>
</a>
                            <div class="post-meta">
                                <span class="post-date">November 18, 2015</span>
                            </div>
                        </div>
                    </li>
                <?php 
            }
            ?>
            </ul>
            <?php 
            echo $args['after_widget'];
            // Reset the global $the_post as this query will have stomped on it
            wp_reset_postdata();
        }
    }
开发者ID:websideas,项目名称:Mondova,代码行数:54,代码来源:kt_article.php


示例20: actions_post_content

    /**
     * Display the post content with a link to the single post
     * @since 1.0.0
     */
    function actions_post_content()
    {
        if (is_search()) {
            ?>
		
		
		    <header class="page-header">
				<h1 class="page-title"><?php 
            printf(__('Search Results for: %s', 'actions'), '<span>' . esc_html(get_search_query()) . '</span>');
            ?>
</h1>
			</header><!-- .page-header -->
		
		<?php 
        }
        while (have_posts()) {
            the_post();
            ?>
		    <article id="post-<?php 
            the_ID();
            ?>
" <?php 
            post_class();
            ?>
>
		        <?php 
            actions_post_header();
            ?>
		        <div class="entry-content">
		        <?php 
            actions_post_thumbnail('full');
            if ('post' == get_post_type()) {
                ?>
			            <div class="entry-meta">
			               <?php 
                actions_posted_on();
                ?>
			            </div>
	            <?php 
            }
            if (is_search()) {
                the_excerpt();
            } else {
                the_content(sprintf(__('Continue reading %s', 'actions'), '<span class="screen-reader-text">' . esc_url(get_the_title()) . '</span>'));
            }
            wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'actions'), 'after' => '</div>'));
            //actions_entry_footer();
            ?>
		        </div><!-- .entry-content -->
		    </article><!-- #post-## -->
        <?php 
        }
    }
开发者ID:WPDevHQ,项目名称:actions,代码行数:57,代码来源:post.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP the_archive_description函数代码示例发布时间:2022-05-23
下一篇:
PHP thb_theme函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap