本文整理汇总了PHP中the_ID函数的典型用法代码示例。如果您正苦于以下问题:PHP the_ID函数的具体用法?PHP the_ID怎么用?PHP the_ID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_ID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例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();
}
}
}
示例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
}
示例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;
}
示例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
}
示例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');
}
示例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';
}
}
示例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
}
示例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;}
示例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;
}
示例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');
}
示例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
}
示例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
}
示例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
}
}
示例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
}
}