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

PHP get_the_ID函数代码示例

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

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



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

示例1: 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


示例2: epl_button_floor_plan

/**
 * Outputs any floor plan links for virtual tours on the property templates
 *
 * When the hook epl_buttons_single_property is used and the property 
 * has floor plans links they will be output on the template
 */
function epl_button_floor_plan()
{
    $floor_plan = get_post_meta(get_the_ID(), 'property_floorplan', true);
    $floor_plan_2 = get_post_meta(get_the_ID(), 'property_floorplan_2', true);
    $links = array();
    if (!empty($floor_plan)) {
        $links[] = $floor_plan;
    }
    if (!empty($floor_plan_2)) {
        $links[] = $floor_plan_2;
    }
    if (!empty($links)) {
        foreach ($links as $k => $link) {
            if (!empty($link)) {
                $number_string = '';
                if ($k > 0) {
                    $number_string = ' ' . $k + 1;
                }
                ?>
<span class="epl-floor-plan-button-wrapper<?php 
                echo $number_string;
                ?>
">
				<button type="button" class="epl-button epl-floor-plan" onclick="location.href='<?php 
                echo $link;
                ?>
'"><?php 
                echo apply_filters('epl_button_label_floorplan', __('Floor Plan', 'epl')) . $number_string;
                ?>
</button></span><?php 
            }
        }
    }
}
开发者ID:ksan5835,项目名称:rankproperties,代码行数:40,代码来源:hook-floorplan.php


示例3: parse_lists_in_post

 public function parse_lists_in_post($content)
 {
     $this->post_ID = get_the_ID();
     $this->comment_ID = '';
     $this->user_can_edit_object = $this->current_user_can_edit_checklist('post', $this->post_ID);
     return $this->parse_lists($content);
 }
开发者ID:BE-Webdesign,项目名称:o2,代码行数:7,代码来源:load.php


示例4: widget

 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
     $sticky = get_option('sticky_posts');
     $number = empty($instance['number']) ? 1 : (int) $instance['number'];
     $cat = empty($instance['category']) ? 0 : (int) $instance['category'];
     if (is_single()) {
         array_push($sticky, get_the_ID());
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     } else {
         echo '<br />';
     }
     $featuredPosts = new WP_Query(array('posts_per_page' => $number, 'cat' => $cat, 'post__not_in' => $sticky, 'no_found_rows' => true));
     while ($featuredPosts->have_posts()) {
         $featuredPosts->the_post();
         global $mb_content_area, $more;
         $mb_content_area = 'sidebar';
         get_template_part('content', get_post_format());
     }
     wp_reset_postdata();
     echo $after_widget;
 }
开发者ID:pavlinov,项目名称:1b.school59.eu,代码行数:26,代码来源:widget_feature.php


示例5: ewic_popup_content

function ewic_popup_content()
{
    if (strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php')) {
        if (get_post_type(get_the_ID()) != 'easyimageslider') {
            // START GENERATE POPUP CONTENT
            ?>
<div id="ewicmodal" style="display:none;">
<div id="tinyform" style="width: 550px;">
<form method="post">

<div class="ewic_input" id="ewictinymce_select_slider_div">
<label class="label_option" for="ewictinymce_select_slider">Slider</label>
	<select class="ewic_select" name="ewictinymce_select_slider" id="ewictinymce_select_slider">
    <option id="selectslider" type="text" value="select">- Select Slider -</option>
</select>
<div class="clearfix"></div>
</div>

<div class="ewic_button">
<input type="button" value="Insert Shortcode" name="ewic_insert_scrt" id="ewic_insert_scrt" class="button-secondary" />	
<div class="clearfix"></div>
</div>

</form>
</div>
</div>
<?php 
        }
    }
    //END
}
开发者ID:NgocSon2412,项目名称:website_banhang,代码行数:31,代码来源:ewic-tinymce.php


示例6: moxie_press_endpoint_data

function moxie_press_endpoint_data()
{
    global $wp_query;
    // get query vars
    $json = $wp_query->get('json');
    $name = $wp_query->get('name');
    // use this template redirect only if json is requested
    if ($json != 'true') {
        return;
    }
    // build the query
    $movie_data = array();
    // default args
    $args = array('post_type' => 'movie', 'posts_per_page' => 100);
    if ($name != '') {
        $args['name'] = $name;
    }
    // add name if provided in query
    // check if this particular request is cached, if not, perform the query
    if (false === ($moxie_cached_request = get_transient('moxie_cached_request_' . json_encode($args)))) {
        $moxie_cached_request = new WP_Query($args);
        set_transient('moxie_cached_request_' . json_encode($args), $moxie_cached_request);
    }
    // prepare the object we want to send as response
    if ($moxie_cached_request->have_posts()) {
        while ($moxie_cached_request->have_posts()) {
            $moxie_cached_request->the_post();
            $id = get_the_ID();
            $movie_data[] = array('id' => $id, 'title' => get_the_title(), 'poster_url' => get_post_meta($id, 'moxie_press_poster_url', true), 'rating' => get_post_meta($id, 'moxie_press_rating', true), 'year' => get_post_meta($id, 'moxie_press_year', true), 'short_description' => get_post_meta($id, 'moxie_press_description', true), 'mdbid' => get_post_meta($id, 'moxie_press_mdbid', true));
        }
        wp_reset_postdata();
    }
    // send json data using built-in WP function
    wp_send_json(array('data' => $movie_data));
}
开发者ID:camilodelvasto,项目名称:MoxiePress,代码行数:35,代码来源:json-api.php


示例7: cats

 function cats()
 {
     foreach (wp_get_post_categories(get_the_ID()) as $c) {
         $cat = get_category($c);
         return ' - <a href="' . get_category_link($cat) . '" title="' . $cat->name . '" class="category">' . $cat->name . '</a>';
     }
 }
开发者ID:rollandwalsh,项目名称:third-rail-wp,代码行数:7,代码来源:entry-meta.php


示例8: widget

 public function widget($args, $instance)
 {
     if (!is_singular()) {
         return;
     }
     $the_id = get_the_ID();
     if (!comments_open($the_id)) {
         return;
     } else {
         $html = $args['before_widget'];
         if (!empty($instance['title'])) {
             $html .= $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
         }
         $api_url = esc_url(home_url('/')) . 'wp-json/wp/v2/comments';
         $author = __('NAME:', 'rest-api-widgets');
         $mailaddress = __('MAIL:', 'rest-api-widgets');
         $content = __('COMMENTS:', 'rest-api-widgets');
         $send_btn = __('SEND', 'rest-api-widgets');
         $success_text = __('Success! Reload now.', 'rest-api-widgets');
         $fail_text = __('Fail :(', 'rest-api-widgets');
         $html .= "<form action={$api_url} method='post' id='rest-api-widgets-comment'>";
         $html .= '<dl>';
         $html .= "<dt>{$author}</dt><dd><input name='author_name' value=''></dd>";
         $html .= "<dt>{$mailaddress}</dt><dd><input name='author_email' value=''></dd>";
         $html .= "<dt>{$content}</dt><dd><textarea name='content' id=' cols='30' rows='10'></textarea></dd>";
         $html .= '</dl>';
         $html .= "<input type='hidden' name='post' value='{$the_id}'>";
         $html .= "<input type='hidden' name='success_text' value='{$success_text}'>";
         $html .= "<input type='hidden' name='fail_text' value='{$fail_text}'>";
         $html .= "<button>{$send_btn}</button>";
         $html .= '</form>';
     }
     echo $html . $args['after_widget'];
 }
开发者ID:hideokamoto,项目名称:rest-api-widget,代码行数:34,代码来源:class.commentform.php


示例9: wanderlist_place_data

/**
 * This is a reusable function that allows us to grab place-specific data and
 * return it in a consistent way across our plugin scripts, and in theme
 * template files as well.
 */
function wanderlist_place_data($data, $post_ID = null)
{
    switch ($data) {
        case 'country':
            // We need to figure out our place's country. Here we go.
            $countries = wp_get_object_terms(get_the_ID(), 'wanderlist-country', array('fields' => 'names'));
            if ($countries) {
                $count = 0;
                foreach ($countries as $country => $name) {
                    if (0 === $count) {
                        $output = $name;
                    } else {
                        $output .= ', ' . $name;
                    }
                    $count++;
                }
            } else {
                $output = '';
            }
            break;
        case 'city':
            $output = get_post_meta($post_ID, 'wanderlist-city', true);
            break;
        case 'lat':
            $output = get_post_meta($post_ID, 'wanderlist-lat', true);
            break;
        case 'lng':
            $output = get_post_meta($post_ID, 'wanderlist-lng', true);
            break;
    }
    return $output;
}
开发者ID:sarahmonster,项目名称:wanderlist,代码行数:37,代码来源:wanderlist.php


示例10: change_add_to_cart_button_text

 /**
  * change_add_to_cart_button_text.
  */
 public function change_add_to_cart_button_text($add_to_cart_text, $single_or_archive)
 {
     $product_categories = get_the_terms(get_the_ID(), 'product_cat');
     if (empty($product_categories)) {
         return $add_to_cart_text;
     }
     for ($i = 1; $i <= apply_filters('wcj_get_option_filter', 1, get_option('wcj_add_to_cart_per_category_total_groups_number', 1)); $i++) {
         if ('yes' !== get_option('wcj_add_to_cart_per_category_enabled_group_' . $i)) {
             continue;
         }
         //			$categories = array_filter( explode( ',', get_option( 'wcj_add_to_cart_per_category_group_' . $i ) ) );
         $categories = get_option('wcj_add_to_cart_per_category_ids_group_' . $i);
         if (empty($categories)) {
             continue;
         }
         foreach ($product_categories as $product_category_id => $product_category) {
             foreach ($categories as $category) {
                 if ($product_category_id == $category) {
                     return get_option('wcj_add_to_cart_per_category_text_' . $single_or_archive . '_group_' . $i, $add_to_cart_text);
                 }
             }
         }
     }
     return $add_to_cart_text;
 }
开发者ID:sawan34,项目名称:tanzi,代码行数:28,代码来源:class-wcj-add-to-cart-per-category.php


示例11: si_client_address

 /**
  * Echo the client address
  * @param  integer $id
  * @return string
  */
 function si_client_address($id = 0)
 {
     if (!$id) {
         $id = get_the_ID();
     }
     echo apply_filters('si_client_address', si_address(si_get_client_address($id)), $id);
 }
开发者ID:danielbachhuber,项目名称:marcgratch.com,代码行数:12,代码来源:clients.php


示例12: edd_wl_render_admin_columns

/**
 * Render Wish List Columns
 *
 * @since 1.0
 * @param string $column_name Column name
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_wl_render_admin_columns($column_name, $post_id)
{
    if (get_post_type($post_id) == 'edd_wish_list') {
        $items = get_post_meta(get_the_ID(), 'edd_wish_list', true);
        switch ($column_name) {
            case 'downloads':
                if ($items) {
                    echo count($items);
                } else {
                    echo 0;
                }
                break;
            case 'total':
                echo edd_wl_get_list_total(get_the_ID());
                break;
            case 'list_author':
                $post = get_post();
                if (0 == $post->post_author) {
                    echo __('Guest', 'edd-wish-lists');
                } else {
                    printf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'author' => get_the_author_meta('ID')), 'edit.php')), get_the_author());
                }
                break;
        }
    }
}
开发者ID:SelaInc,项目名称:eassignment,代码行数:34,代码来源:dashboard-columns.php


示例13: add_doctrinal_statement_JS

function add_doctrinal_statement_JS()
{
    wp_register_script('doctrinal-statement', get_stylesheet_directory_uri() . '/JS/doctrine.min.js', array('jquery'));
    if (get_the_ID() == '8') {
        wp_enqueue_script('doctrinal-statement');
    }
}
开发者ID:macbookandrew,项目名称:gbc-townsville-qld,代码行数:7,代码来源:functions.php


示例14: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $number = $instance['number'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
		<div class="recent-works-items clearfix">
		<?php 
        $args = array('post_type' => 'evolve_portfolio', 'posts_per_page' => $number, 'has_password' => false);
        $portfolio = new WP_Query($args);
        if ($portfolio->have_posts()) {
            ?>
		<?php 
            while ($portfolio->have_posts()) {
                $portfolio->the_post();
                ?>
		<?php 
                if (has_post_thumbnail()) {
                    ?>
		<?php 
                    $link_target = "";
                    $url_check = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
                    if (!empty($url_check)) {
                        $new_permalink = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
                        if (get_post_meta(get_the_ID(), 'pyre_link_icon_target', true) == "yes") {
                            $link_target = ' target="_blank"';
                        }
                    } else {
                        $new_permalink = get_permalink();
                    }
                    ?>
		<a href="<?php 
                    echo $new_permalink;
                    ?>
"<?php 
                    echo $link_target;
                    ?>
 title="<?php 
                    the_title();
                    ?>
">
			<?php 
                    the_post_thumbnail('recent-works-thumbnail');
                    ?>
		</a>
		<?php 
                }
            }
        }
        wp_reset_query();
        ?>
		</div>

		<?php 
        echo $after_widget;
    }
开发者ID:berniecultess,项目名称:infirev,代码行数:60,代码来源:recent-works-widget.php


示例15: shortcode_output

 /**
  * Output for Shortcode
  *
  * @since 1.1.9
  *
  * @param $atts
  *
  * @return mixed|null
  */
 function shortcode_output($atts)
 {
     $default_atts = array('key' => '', 'field' => '', 'job_id' => get_the_ID());
     $merged_atts = array_merge($default_atts, $atts);
     try {
         // Attributes
         $args = shortcode_atts($merged_atts, $atts, 'jmfe');
         if (empty($args['key']) && empty($args['field'])) {
             throw new Exception(__('Meta Key was not specified!', 'wp-job-manager-field-editor'));
         }
         if (empty($args['job_id'])) {
             throw new Exception(__('Unable to determine correct job/resume/post ID!', 'wp-job-manager-field-editor'));
         }
         if ($args['key']) {
             $meta_key = $args['key'];
         }
         if ($args['field']) {
             $meta_key = $args['field'];
         }
         ob_start();
         the_custom_field($meta_key, $args['job_id'], $args);
         $shortcode_output = ob_get_contents();
         ob_end_clean();
         return $shortcode_output;
     } catch (Exception $error) {
         error_log('Shortcode output error: ' . $error->getMessage());
     }
 }
开发者ID:Atlas-Solutions-Group,项目名称:mn-wp-job-manager-field-editor,代码行数:37,代码来源:shortcodes.php


示例16: foundation_featured_setup

function foundation_featured_setup()
{
    if (function_exists('add_theme_support')) {
        add_theme_support('post-thumbnails');
        add_image_size('foundation-featured-image', 900, 9999, false);
    }
    global $foundation_featured_posts;
    $settings = foundation_get_settings();
    $args = foundation_featured_get_args();
    if ($settings->featured_enabled) {
        $slides = foundation_featured_get_slides();
        $slide_count = 0;
        if ($slides->post_count > 0) {
            while ($slides->have_posts() && $slide_count < $args['num']) {
                $slides->the_post();
                $image = foundation_featured_has_image();
                if ($image) {
                    $slide_count++;
                    $foundation_featured_posts[] = get_the_ID();
                }
            }
        }
    }
    add_filter('parse_query', 'foundation_featured_modify_query');
}
开发者ID:ahua,项目名称:www,代码行数:25,代码来源:featured.php


示例17: wpex_gallery_is_lightbox_enabled

function wpex_gallery_is_lightbox_enabled()
{
    $link_images = get_post_meta(get_the_ID(), '_easy_image_gallery_link_images', true);
    if ('on' == $link_images) {
        return true;
    }
}
开发者ID:shazadmaved,项目名称:vizblog,代码行数:7,代码来源:gmb-display.php


示例18: filter_content

 public function filter_content($content)
 {
     // Get Templates
     $templates = self::get_option('rwp_templates');
     $terms = wp_get_object_terms(get_the_ID(), array_keys(get_taxonomies()));
     $terms_keys = array();
     foreach ($terms as $term) {
         $terms_keys[$term->taxonomy][] = $term->term_id;
     }
     //self::pretty_print( $terms_keys );
     foreach ($templates as $template) {
         if (isset($template['template_auto_reviews']) && !empty($template['template_auto_reviews'])) {
             if (is_singular($template['template_auto_reviews']) && is_main_query()) {
                 if (isset($template['template_exclude_terms'])) {
                     $to_exclude = false;
                     foreach ($template['template_exclude_terms'] as $id) {
                         $i = explode('-', $id);
                         if (in_array($i[1], $terms_keys[$i[0]])) {
                             $to_exclude = true;
                             break;
                         }
                     }
                     if ($to_exclude) {
                         continue;
                     }
                 }
                 $new_content = '[rwp-review id="-1" template="' . $template['template_id'] . '"]';
                 $content .= $new_content;
             }
         }
     }
     return $content;
 }
开发者ID:jprdev,项目名称:S.J-Enterprise,代码行数:33,代码来源:class-reviewer.php


示例19: x_shortcode_toc_item

function x_shortcode_toc_item($atts)
{
    extract(shortcode_atts(array('id' => '', 'class' => '', 'style' => '', 'title' => '', 'page' => ''), $atts, 'x_toc_item'));
    $id = $id != '' ? 'id="' . esc_attr($id) . '"' : '';
    $class = $class != '' ? 'x-toc-item ' . esc_attr($class) : 'x-toc-item';
    $style = $style != '' ? 'style="' . $style . '"' : '';
    $title = $title != '' ? $title : '';
    switch ($page) {
        case 0:
            $page = '';
            break;
        case 1:
            $page = '';
            break;
        default:
            $page = $page;
            if (get_post_status(get_the_ID()) == "draft") {
                $page = '&page=' . $page;
            } else {
                $page = get_the_ID() == get_option('page_on_front') ? 'page/' . $page . '/' : $page . '/';
            }
    }
    $link = esc_url(get_permalink());
    $output = "<li {$id} class=\"{$class}\" {$style}><a href=" . $link . $page . " title=\"Go to {$title}\">" . $title . '</a></li>';
    return $output;
}
开发者ID:elinberg,项目名称:ericlinberg,代码行数:26,代码来源:toc.php


示例20: al_portfolio_meta_tags

function al_portfolio_meta_tags()
{
    $post_type = get_post_type();
    if ('portfolio' == $post_type) {
        $title = get_post_meta(get_the_ID(), "al_pf_og_title", TRUE);
        $title = !empty($title) ? $title : get_the_title();
        $meta = array('og:title' => $title, 'og:url' => get_permalink());
        $desc = get_post_meta(get_the_ID(), "al_pf_og_description", TRUE);
        $desc = !empty($desc) ? $desc : false;
        if ($desc) {
            $meta['og:description'] = $desc;
        }
        if (has_post_thumbnail()) {
            $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $meta['og:image'] = $thumbnail[0];
        }
        if (get_post_format() == 'gallery') {
            $images = rwmb_meta('al_pf_gallery_images', 'type=image&size=full');
            if (is_array($images)) {
                foreach ($images as $image) {
                    $meta['images'][] = $image['url'];
                }
            }
        }
        foreach ($meta as $key => $value) {
            if ($key == 'images') {
                foreach ($value as $image) {
                    echo '<meta property="og:image" content="' . $image . '" />';
                }
            } else {
                echo '<meta property="' . $key . '" content="' . $value . '" />';
            }
        }
    }
}
开发者ID:azeemgolive,项目名称:thefunkidsgame,代码行数:35,代码来源:artless-portfolio.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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