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

PHP get_post_custom_values函数代码示例

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

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



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

示例1: property_post_list

function property_post_list()
{
    $propid_array = array();
    $args = array('numberposts' => -1, 'meta_key' => 'property_id');
    $posts_array = get_posts($args);
    if (count($posts_array) > 0) {
        foreach ($posts_array as $p) {
            //print_r($posts_array);exit();
            $propid = get_post_custom_values('property_id', $p->ID);
            if (!empty($propid)) {
                $prop_array[$p->ID] = $propid;
            }
        }
    }
    ?>
	<script>
		var prop_post_array = new Array();
	<?php 
    foreach ($prop_array as $po => $pr) {
        ?>
		prop_post_array[<?php 
        echo $pr[0];
        ?>
] = <?php 
        echo $po;
        ?>
;
		<?php 
    }
    ?>
	</script>
    <?php 
}
开发者ID:alfiedawes,项目名称:WP-InstaSites,代码行数:33,代码来源:property.php


示例2: ktz_jsscripts

function ktz_jsscripts()
{
    global $is_IE, $post;
    if (!is_admin()) {
        if (is_object($post)) {
            $ktz_self_video_youtube_mt = get_post_custom_values('ktz_youtube_id', $post->ID);
            $ktz_self_video_vimeo_mt = get_post_custom_values('ktz_vimeo_id', $post->ID);
            $ktz_self_video_dailymotion_mt = get_post_custom_values('ktz_dailymotion_url', $post->ID);
            global $post;
            $meta_values = get_post_custom($post->ID);
        }
        if (is_singular()) {
            wp_enqueue_script('comment-reply');
        }
        wp_enqueue_script('modernizr-respon');
        wp_enqueue_script('ktz-jsscript-js');
        wp_enqueue_script('ktz-rating-js');
        if (is_single() && has_post_format('video')) {
            wp_enqueue_script('ktz-video-js');
        }
        if (is_single() && $ktz_self_video_youtube_mt && has_post_format('video')) {
            wp_enqueue_script('ktz-video-youtube-js');
        }
        if (is_single() && $ktz_self_video_vimeo_mt && has_post_format('video')) {
            wp_enqueue_script('ktz-video-vimeo-js');
        }
        if (is_single() && $ktz_self_video_dailymotion_mt && has_post_format('video')) {
            wp_enqueue_script('ktz-video-dailymotion-js');
        }
        wp_enqueue_script('ktz-main-js');
        wp_localize_script('ktz-rating-js', 'ktz_ajax_data', array('ajax_url' => admin_url('admin-ajax.php'), 'codes' => array('SUCCESS' => 1, 'PREVIOUSLY_VOTED' => 0, 'REQUEST_ERROR' => 2, 'UNKNOWN' => -1), 'messages' => array('success' => __('You\'ve voted correctly', ktz_theme_textdomain), 'previously_voted' => __('You had previously voted', ktz_theme_textdomain), 'request_error' => __('The request was malformed, try again', ktz_theme_textdomain), 'unknown' => __('An unknown error has occurred, try to vote again', ktz_theme_textdomain))));
    }
}
开发者ID:jjpango,项目名称:JJTeam,代码行数:33,代码来源:_js_ktz.php


示例3: wp_ozh_yourls_newpost

function wp_ozh_yourls_newpost($post)
{
    global $wp_ozh_yourls;
    $post_id = $post->ID;
    $url = get_permalink($post_id);
    if ($post->post_type != 'post' && $post->post_type != 'page') {
        return;
    }
    // Generate short URL ?
    if (!wp_ozh_yourls_generate_on($post->post_type)) {
        return;
    }
    $title = get_the_title($post_id);
    $url = get_permalink($post_id);
    $short = wp_ozh_yourls_get_new_short_url($url);
    // Tweet short URL ?
    if (!wp_ozh_yourls_tweet_on($post->post_type)) {
        return;
    }
    if (!get_post_custom_values('yourls_tweeted', $post_id)) {
        // Not tweeted yet
        $tweet = wp_ozh_yourls_maketweet($short, $title);
        if (wp_ozh_yourls_send_tweet($tweet)) {
            update_post_meta($post_id, 'yourls_tweeted', 1);
        }
    }
}
开发者ID:voitto,项目名称:dbscript,代码行数:27,代码来源:core.php


示例4: post_thumbnail_src

function post_thumbnail_src()
{
    global $post;
    if ($values = get_post_custom_values("thumb")) {
        //输出自定义域图片地址
        $values = get_post_custom_values("thumb");
        $post_thumbnail_src = $values[0];
    } elseif (has_post_thumbnail()) {
        //如果有特色缩略图,则输出缩略图地址
        $thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
        $post_thumbnail_src = $thumbnail_src[0];
    } else {
        $post_thumbnail_src = '';
        ob_start();
        ob_end_clean();
        $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
        $post_thumbnail_src = $matches[1][0];
        //获取该图片 src
        if (empty($post_thumbnail_src)) {
            //如果日志中没有图片,则显示随机图片
            $random = mt_rand(1, 10);
            echo get_bloginfo('template_url');
            echo '/images/random/' . $random . '.jpg';
            //如果日志中没有图片,则显示默认图片
            //echo '/images/default_thumb.jpg';
        }
    }
    echo $post_thumbnail_src;
}
开发者ID:Germey,项目名称:SflBlog,代码行数:29,代码来源:functions.php


示例5: tumblrLinkBacks

function tumblrLinkBacks($content)
{
    global $wp_query, $post;
    $post_id = get_post($post->ID);
    $posttitle = $post_id->post_title;
    $permalink = get_permalink(get_post($post->ID));
    $tumblr_keys = get_post_custom_keys($post->ID);
    if (get_post_meta($wp_query->post->ID, 'TumblrURL', true)) {
        if ($tumblr_keys) {
            foreach ($tumblr_keys as $tumblr_key) {
                if ($tumblr_key == 'TumblrURL') {
                    $tumblr_vals = get_post_custom_values($tumblr_key);
                }
            }
            if ($tumblr_vals) {
                if (is_feed()) {
                    $content .= '<p><a href="' . $tumblr_vals[0] . '" title="Direct link to featured article">Direct Link to Article</a> &#8212; ';
                    $content .= '<a href="' . $permalink . '">Permalink</a></p>';
                    return $content;
                } else {
                    return $content;
                }
            }
        }
    } else {
        $content = $content;
        return $content;
    }
}
开发者ID:joasssko,项目名称:css-tricks-functionality-plugin,代码行数:29,代码来源:template-functions.php


示例6: AB_external_permalink

function AB_external_permalink($permalink)
{
    global $post;
    $thePostID = $post->ID;
    $internal_post = get_post($thePostID);
    $title = $internal_post->post_title;
    $post_keys = array();
    $post_val = array();
    $post_keys = get_post_custom_keys($thePostID);
    if (!empty($post_keys)) {
        foreach ($post_keys as $pkey) {
            if ($pkey == 'original_source') {
                $post_val = get_post_custom_values($pkey, $thePostID);
                break;
            }
        }
        if (empty($post_val)) {
            $link = $permalink;
        } else {
            $link = $post_val[0];
        }
    } else {
        $link = $permalink;
    }
    return $link;
}
开发者ID:hscale,项目名称:webento,代码行数:26,代码来源:useoriginalpermalinks.php


示例7: custom_actions

 /**
  * Adds the custom actions to the Commits list.
  * @access public
  * @param  array $actions The default array of actions.
  */
 public function custom_actions($actions)
 {
     if (get_post_type() == 'revisr_commits') {
         if (isset($actions)) {
             unset($actions['edit']);
             unset($actions['view']);
             unset($actions['trash']);
             unset($actions['inline hide-if-no-js']);
             $id = get_the_ID();
             $url = get_admin_url() . 'post.php?post=' . get_the_ID() . '&action=edit';
             $actions['view'] = "<a href='{$url}'>" . __('View', 'revisr') . "</a>";
             $branch_meta = get_post_custom_values('branch', get_the_ID());
             $db_hash_meta = get_post_custom_values('db_hash', get_the_ID());
             $backup_method = get_post_custom_values('backup_method', get_the_ID());
             $commit_hash = Revisr_Git::get_hash($id);
             $revert_nonce = wp_nonce_url(admin_url("admin-post.php?action=process_revert&commit_hash={$commit_hash}&branch={$branch_meta[0]}&post_id=" . get_the_ID()), 'revert', 'revert_nonce');
             $actions['revert'] = "<a href='" . $revert_nonce . "'>" . __('Revert Files', 'revisr') . "</a>";
             if (is_array($db_hash_meta)) {
                 $db_hash = str_replace("'", "", $db_hash_meta);
                 if (isset($backup_method) && $backup_method[0] == 'tables') {
                     $revert_db_nonce = wp_nonce_url(admin_url("admin-post.php?action=revert_db&db_hash={$db_hash[0]}&branch={$branch_meta[0]}&backup_method=tables&post_id=" . get_the_ID()), 'revert_db', 'revert_db_nonce');
                 } else {
                     $revert_db_nonce = wp_nonce_url(admin_url("admin-post.php?action=revert_db&db_hash={$db_hash[0]}&branch={$branch_meta[0]}&post_id=" . get_the_ID()), 'revert_db', 'revert_db_nonce');
                 }
                 if ($db_hash[0] != '') {
                     $actions['revert_db'] = "<a href='" . $revert_db_nonce . "'>" . __('Revert Database', 'revisr') . "</a>";
                 }
             }
         }
     }
     return $actions;
 }
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:37,代码来源:class-revisr-commits.php


示例8: get_post_thumb

function get_post_thumb($post_id, $width, $height, $custom = "image")
{
    //universal thumb function
    $show_no_image = get_option("bordeaux_show_first_thumb");
    $custom_image = get_post_custom_values($custom, $post_id);
    //get custom field value
    $custom_image = $custom_image[0];
    if ($custom_image == "" && $custom != "image") {
        $custom = "bordeaux_slider_image";
        $custom_image = get_post_custom_values($custom, $post_id);
        //get custom field value
        $custom_image = $custom_image[0];
    }
    $meta = get_post_meta($post_id, "_thumbnail_id", true);
    //get wordpress built in thumbnail value
    $first_from_post = get_first_image($post_id);
    //get first image form post
    if ($custom_image != "") {
        //custom field value
        $file = $custom_image;
        if (strpos($file, "wp-content") !== false) {
            $pos = strpos($file, "/wp-content");
            $file = substr($file, $pos);
        }
        $src = get_template_directory_uri();
        $src .= "/timthumb.php?src=";
        $src .= $file;
        $src .= "&amp;w={$width}&amp;h={$height}&amp;zc=1&amp;q=100";
        $show_image = true;
    } elseif ($meta) {
        //built in thumb
        $file = site_url() . "/wp-content/uploads/" . get_post_meta($meta, "_wp_attached_file", true);
        $src = get_template_directory_uri();
        $src .= "/timthumb.php?src=";
        $src .= $file;
        $src .= "&amp;w={$width}&amp;h={$height}&amp;zc=1&amp;q=100";
        $show_image = true;
    } elseif ($first_from_post != false && $custom != "bordeaux_slider_image") {
        //first attached image
        $file = $first_from_post;
        if (strpos($file, "wp-content") !== false) {
            $pos = strpos($file, "/wp-content");
            $file = substr($file, $pos);
        }
        $src = get_template_directory_uri();
        $src .= "/timthumb.php?src=";
        $src .= $file;
        $src .= "&amp;w={$width}&amp;h={$height}&amp;zc=1&amp;q=100";
        $show_image = true;
    } else {
        //no image
        $src = get_template_directory_uri() . '/images/no-image-' . $width . 'x' . $height . '.jpg';
        if ($show_no_image == "on") {
            $show_image = true;
        } else {
            $show_image = false;
        }
    }
    return array("src" => $src, "show" => $show_image);
}
开发者ID:bangjojo,项目名称:wp,代码行数:60,代码来源:thumbs.php


示例9: cs_external_permalink

function cs_external_permalink($permalink)
{
    global $post;
    $thePostID = $post->ID;
    $post_id = get_post($thePostID);
    $title = $post_id->post_title;
    $post_keys = array();
    $post_val = array();
    $post_keys = get_post_custom_keys($thePostID);
    if (!empty($post_keys)) {
        foreach ($post_keys as $pkey) {
            if ($pkey == 'url1' || $pkey == 'title_url' || $pkey == 'url_title' || $pkey == 'external') {
                $post_val = get_post_custom_values($pkey);
            }
        }
        if (empty($post_val)) {
            $link = $permalink;
        } else {
            $link = $post_val[0];
        }
    } else {
        $link = $permalink;
    }
    return $link;
}
开发者ID:ryanlane,项目名称:LinkGrab-O-Matic,代码行数:25,代码来源:index.php


示例10: format_custom_field

function format_custom_field($field, $format = '', $date_format = 'F j, Y')
{
    $fetch = get_post_custom_values($field);
    $fetch = $fetch[0];
    // Test if anything was fetched or return false.
    if (!$fetch) {
        return false;
    }
    switch ($format) {
        case 'date':
            return date($date_format, $fetch);
            break;
        case 'text_block':
            return wpautop($fetch);
            break;
        case 'link':
            return '<a href="' . $fetch . '" class="custom_link">' . $fetch . '</a>';
            break;
        case 'html':
            return html_entity_decode($fetch);
            break;
        case 'google_map':
            return display_google_map($fetch);
            break;
        default:
            // If you're not processing(formatting) the var at all
            // why even use this function? Just use the WP custom field funcs.
            return $fetch;
    }
}
开发者ID:rigelstpierre,项目名称:Everlovin-Press,代码行数:30,代码来源:custom_field_functions.php


示例11: woo_get_page_template

/**
 * Get the current page template
 *
 * Get the current page template in use.
 *
 * @since 4.0
 *
 * @package WooFramework
 * @subpackage Template
 */
function woo_get_page_template()
{
    global $wp_query;
    $page = $wp_query->get_queried_object();
    $custom_fields = get_post_custom_values('_wp_page_template', $page->ID);
    $page_template = $custom_fields[0];
    return $page_template;
}
开发者ID:jospintedjou,项目名称:wordpress,代码行数:18,代码来源:theme-advanced.php


示例12: cftpb_get_term_custom_values

 function cftpb_get_term_custom_values($term_id, $taxonomy, $key)
 {
     $return_val = null;
     $term_post = cf_taxonomy_post_type_binding::get_term_post($term_id, $taxonomy);
     if (!empty($term_post) && !is_wp_error($term_post)) {
         $return_val = get_post_custom_values($key, $term_post->ID);
     }
     return $return_val;
 }
开发者ID:Juni4567,项目名称:mycashflow,代码行数:9,代码来源:cf-tax-post-binding.php


示例13: custom_field

function custom_field($field, $post_id)
{
    $cf = get_post_custom_values($field, $post_id);
    if (count($cf) > 1) {
        return $cf;
    } else {
        return array_shift($cf);
    }
}
开发者ID:cleansafi,项目名称:porto,代码行数:9,代码来源:functions.php


示例14: ta_modified_post_title

function ta_modified_post_title($title)
{
    if (in_the_loop() && !is_page()) {
        $title_word_count = get_post_custom_values('wc_the_word_count');
        if ($title_word_count) {
            $title = $title . ' (Word Count: ' . $title_word_count[0] . ')';
        }
    }
    return $title;
}
开发者ID:mmatthews1981,项目名称:wp-nanowrimo,代码行数:10,代码来源:wp-nanowrimo.php


示例15: get_reservation_page

function get_reservation_page()
{
    $pages = get_pages();
    foreach ($pages as $p) {
        $meta = get_post_custom_values("_wp_page_template", $p->ID);
        if ($meta[0] == "template-reservations.php") {
            return $p->ID;
        }
    }
    return false;
}
开发者ID:bangjojo,项目名称:wp,代码行数:11,代码来源:other.php


示例16: ktz_posted_title_a

 function ktz_posted_title_a()
 {
     global $post;
     // post format link
     $ktz_link_pf = get_post_custom_values('ktz_link_postformat', $post->ID);
     if ($ktz_link_pf && has_post_format('link')) {
         printf(__('<a href="%1$s" title="External link to %2$s" rel="nofollow" target="_blank"><span class="glyphicon glyphicon-link"></span> %3$s</a>', ktz_theme_textdomain), esc_url($ktz_link_pf[0]), esc_url($ktz_link_pf[0]), esc_attr(get_the_title()));
     } else {
         // standard post format
         printf(__('<a href="%1$s" title="Permalink to %2$s" rel="bookmark">%3$s</a>', ktz_theme_textdomain), esc_url(get_permalink()), esc_attr(get_the_title()), esc_attr(get_the_title()));
     }
 }
开发者ID:jjpango,项目名称:JJTeam,代码行数:12,代码来源:_loop_ktz.php


示例17: is_linked_list

function is_linked_list()
{
    // global $wp_query;
    // $postid = $wp_query->post->ID;
    // $url = get_post_meta($postid, 'linked_list_url', true);
    $url = get_post_custom_values('linked_list_url');
    if (!empty($url)) {
        $GLOBALS['dfllCustomFieldValue'] = $url;
        return true;
    }
    return false;
    // return (!empty($url));
}
开发者ID:peiche,项目名称:wp-linked-list,代码行数:13,代码来源:linked_list.php


示例18: get_newspapermeta

function get_newspapermeta($field, $echo = 1, $before = '', $after = '')
{
    $newspapermeta = get_post_custom_values('_newspapermeta_fields', $post->ID);
    $fields = unserialize($newspapermeta[0]);
    if ($fields[$field] !== NULL) {
        $output = $fields[$field];
        if ($echo == 0) {
            return $output;
        } else {
            echo $before . $output . $after;
        }
    }
}
开发者ID:Jonatan,项目名称:wp-newspapermeta,代码行数:13,代码来源:newspapermeta.php


示例19: copy_meta_info

 static function copy_meta_info($new_id, $old_id)
 {
     $post_meta_keys = get_post_custom_keys($old_id);
     if (empty($post_meta_keys)) {
         return;
     }
     foreach ($post_meta_keys as $meta_key) {
         $meta_values = get_post_custom_values($meta_key, $old_id);
         foreach ($meta_values as $meta_value) {
             $meta_value = maybe_unserialize($meta_value);
             update_post_meta($new_id, $meta_key, $meta_value);
         }
     }
 }
开发者ID:radscheit,项目名称:unicorn,代码行数:14,代码来源:class-sendpress-posts.php


示例20: alimir_cfn

function alimir_cfn()
{
    if (get_post_custom_values('warning') || get_post_custom_values('information') || get_post_custom_values('success') || get_post_custom_values('failure') || get_post_custom_values('lightbulb') || get_post_custom_values('messages')) {
        $string = '';
        $string .= '<div class="notification_container" style="margin-top:20px;">';
        $warning = get_post_meta(get_the_ID(), 'warning', true);
        if (get_post_custom_values('warning')) {
            $string .= '<div class="notification ' . wp_cfn_theme() . 'warning hideit">';
            $string .= '<p>' . $warning . '</p>';
            $string .= '</div>';
        }
        $string .= '<div class="notification_container" style="margin-top:20px;">';
        $information = get_post_meta(get_the_ID(), 'information', true);
        if (get_post_custom_values('information')) {
            $string .= '<div class="notification ' . wp_cfn_theme() . 'information hideit">';
            $string .= '<p>' . $information . '</p>';
            $string .= '</div>';
        }
        $string .= '<div class="notification_container" style="margin-top:20px;">';
        $success = get_post_meta(get_the_ID(), 'success', true);
        if (get_post_custom_values('success')) {
            $string .= '<div class="notification ' . wp_cfn_theme() . 'success hideit">';
            $string .= '<p>' . $success . '</p>';
            $string .= '</div>';
        }
        $string .= '<div class="notification_container" style="margin-top:20px;">';
        $failure = get_post_meta(get_the_ID(), 'failure', true);
        if (get_post_custom_values('failure')) {
            $string .= '<div class="notification ' . wp_cfn_theme() . 'failure hideit">';
            $string .= '<p>' . $failure . '</p>';
            $string .= '</div>';
        }
        $string .= '<div class="notification_container" style="margin-top:20px;">';
        $lightbulb = get_post_meta(get_the_ID(), 'lightbulb', true);
        if (get_post_custom_values('lightbulb')) {
            $string .= '<div class="notification ' . wp_cfn_theme() . 'lightbulb hideit">';
            $string .= '<p>' . $lightbulb . '</p>';
            $string .= '</div>';
        }
        $string .= '<div class="notification_container" style="margin-top:20px;">';
        $messages = get_post_meta(get_the_ID(), 'messages', true);
        if (get_post_custom_values('messages')) {
            $string .= '<div class="notification ' . wp_cfn_theme() . 'messages hideit">';
            $string .= '<p>' . $messages . '</p>';
            $string .= '</div>';
        }
        return $string;
    }
}
开发者ID:Alimir,项目名称:custom-fields-notifications,代码行数:49,代码来源:wp-functions.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_post_data函数代码示例发布时间:2022-05-15
下一篇:
PHP get_post_custom_keys函数代码示例发布时间: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