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

PHP get_post_custom_keys函数代码示例

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

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



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

示例1: test_if_post_or_page_has_embed

 /**
  * Thanks to http://t31os.wordpress.com/2010/05/24/post-has-embed/ for a nicer solution than mine
  */
 function test_if_post_or_page_has_embed($post_id = false)
 {
     if (!$post_id) {
         $post_id = get_the_ID();
     } else {
         $post_id = absint($post_id);
     }
     if (!$post_id) {
         return false;
     }
     // Get meta keys for current post
     $post_meta = get_post_custom_keys($post_id);
     if (empty($post_meta)) {
         return false;
     }
     // Search for the first meta_key [$value] that begins with the oembed string [$string]
     // After the first hits: continue to return true
     if (is_array($post_meta) || $post_meta instanceof Traversable) {
         foreach ($post_meta as $meta) {
             $first_seven_chars = substr(trim($meta), 0, 7);
             if ($first_seven_chars == 'oembed_' || $first_seven_chars == '_oembed') {
                 return true;
             }
             // '_oembed' is used by WordPress standardly; 'oembed_' is used by some plugins and themes
         }
         return false;
     } else {
         return false;
     }
 }
开发者ID:R33D3M33R,项目名称:lazy-load-for-videos,代码行数:33,代码来源:class-general.php


示例2: fyb_all_custom_fields

function fyb_all_custom_fields($fyb_allposts)
{
    $fyb_customfields = array();
    foreach ($fyb_allposts as $fyb_post) {
        setup_postdata($fyb_post);
        $fyb_post_id = $fyb_post->ID;
        $fyb_fields = get_post_custom_keys($fyb_post_id);
        if ($fyb_fields) {
            foreach ($fyb_fields as $fyb_key => $fyb_value) {
                if ($fyb_value[0] != '_') {
                    if (!isset($fyb_customfields[$fyb_value])) {
                        $fyb_customfields[$fyb_value] = array();
                        #$fyb_customfields[$fyb_value]['html'] = '<option value="'.$fyb_value.'">'.$fyb_value.'</option>';
                        $fyb_customfields[$fyb_value]['count'] = 1;
                        $fyb_customfields[$fyb_value]['userPost'] = array();
                        $fyb_customfields[$fyb_value]['userPost'][] = $fyb_post->ID;
                        $fyb_customfields[$fyb_value]['usedPostType'] = array();
                        $fyb_customfields[$fyb_value]['usedPostType'][] = $fyb_post->post_type;
                    } else {
                        $fyb_customfields[$fyb_value]['count'] = $fyb_customfields[$fyb_value]['count'] + 1;
                        $fyb_customfields[$fyb_value]['userPost'][] = $fyb_post->ID;
                        if (!in_array($fyb_post->post_type, $fyb_customfields[$fyb_value]['usedPostType'])) {
                            $fyb_customfields[$fyb_value]['usedPostType'][] = $fyb_post->post_type;
                        }
                    }
                }
            }
        }
    }
    wp_reset_postdata();
    return $fyb_customfields;
}
开发者ID:technofreaky,项目名称:funny-branding,代码行数:32,代码来源:settings_replacecustomfields.php


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


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


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


示例6: get_fields

function get_fields($post_id = false)
{
    // vars
    global $post;
    if (!$post_id) {
        $post_id = $post->ID;
    } elseif ($post_id == "options") {
        $post_id = 999999999;
    }
    // default
    $value = array();
    $keys = get_post_custom_keys($post_id);
    if ($keys) {
        foreach ($keys as $key) {
            if (substr($key, 0, 1) != "_") {
                $value[$key] = get_field($key, $post_id);
            }
        }
    }
    // no value
    if (empty($value)) {
        return false;
    }
    return $value;
}
开发者ID:rigelstpierre,项目名称:Everlovin-Press,代码行数:25,代码来源:api.php


示例7: clear_meta

 private function clear_meta($post_id)
 {
     $post_meta_keys = get_post_custom_keys($post_id);
     $blacklist = $this->get_meta_key_whitelist($post_id);
     $post_meta_keys = array_diff($post_meta_keys, $blacklist);
     foreach ($post_meta_keys as $key) {
         delete_post_meta($post_id, $key);
     }
 }
开发者ID:TakenCdosG,项目名称:chefs,代码行数:9,代码来源:Post_Meta_Copier.php


示例8: job_notification_templates

function job_notification_templates($post_id, $notification_receiver)
{
    // Applied job title
    $job_title = get_the_title($post_id);
    // Site URL
    $site_url = get_option('siteurl');
    $parent_id = wp_get_post_parent_id($post_id);
    $job_post_keys = get_post_custom_keys($parent_id);
    $applicant_post_keys = get_post_custom_keys($post_id);
    if (NULL != $job_post_keys) {
        if (in_array('jobfeature_company_name', $job_post_keys)) {
            $company_name = get_post_meta($parent_id, 'jobfeature_company_name', TRUE);
        }
    }
    if (NULL != $applicant_post_keys) {
        if (in_array('jobapp_name', $applicant_post_keys)) {
            $applicant_name = get_post_meta($post_id, 'jobapp_name', TRUE);
        }
    }
    if ('applicant' != $notification_receiver) {
        $message = '<div style="width:700px; margin:0 auto;  border: 1px solid #95B3D7;font-family:Arial;">' . '<div style="border: 1px solid #95B3D7; background-color:#95B3D7;">' . ' <h2 style="text-align:center;">Job Application </h2>' . ' </div>' . '<div  style="margin:10px;">' . '<p>' . date("Y/m/d") . '</p>' . '<p>';
        if (NULL != $notification_receiver) {
            $message .= 'Hi ' . $notification_receiver . ',';
        }
        $message .= '</p>' . '<p>I ';
        if (NULL != $applicant_name) {
            $message .= $applicant_name . '';
        }
        $message .= ',would like to apply for the post of ' . $job_title . ' at your company ';
        if (NULL != $company_name) {
            $message .= $company_name . '';
        }
        $message .= '.</p>' . '<p>I have gone through the application criterion and requirements for the particular job and have posted my resume at given address  ' . $site_url . '<br/>' . 'I have also filled the detail of the online application form on ' . date("Y/m/d") . '.' . '</p>' . '<p>I sincerely believe that my educational qualifications and extra-curricular activities will be appropriate for the job and the type of applicant it possible requires.' . 'I promiss to devote my heart and soul to the job once selected to serve your company ';
        if (NULL != $company_name) {
            $message .= $company_name . '';
        }
        $message .= '.</p>' . 'I will be extremely grateful if you kindly glance through my application and consider me for the interview and the adjacent processes.' . '</p>' . '<p>I will be eagerly looking forward to your reply mail.</p>' . '<p>Thank you</p>' . '<p>Sincerely,</p>';
        if (NULL != $applicant_name) {
            $message .= $applicant_name . '';
        }
        $message .= '</div>' . ' </div>';
    } else {
        $message = '<div style="width:700px; margin:0 auto;  border: 1px solid #95B3D7;font-family:Arial;">' . '<div style="border: 1px solid #95B3D7; background-color:#95B3D7;">' . ' <h2 style="text-align:center;">Job Application Acknowledgement</h2>' . ' </div>' . '<div  style="margin:10px;">' . '<p>' . date("Y/m/d") . '</p>' . '<p>';
        $message .= 'Hi ';
        if (NULL != $applicant_name) {
            $message .= '' . $applicant_name . ',';
        }
        $message .= '<p>Thank you for your interest in ';
        if (NULL != $company_name) {
            $message .= $company_name . '.';
        }
        $message .= 'We acknowledge receipt of your resume and application for a position ' . $job_title . ' and sincerely appreciate your interest in our company.' . '</p>' . '<p>We will screen all applicants and select candidates whose qualifications seem to meet our needs.' . ' We will carefully consider your application during the initial screening and will contact you if you are selected to continue in the recruitment process. ' . 'We wish you every success.</p>' . '<p>Regards,</p>' . '<p>Admin,</p>' . '<p>' . get_bloginfo('name') . '</p>';
        $message .= '</div>' . ' </div>';
    }
    return $message;
}
开发者ID:anurag-singh,项目名称:as-simple-job-board,代码行数:56,代码来源:simple-job-board-notification.php


示例9: jobpost_applicants_detail_page_content

    /**
     * Creates Detail Page for Applicants
     * 
     * 
     * @access  public
     * @since   1.0.0
     * @return  void
     */
    public function jobpost_applicants_detail_page_content()
    {
        global $post;
        if (!empty($post) and 'jobpost_applicants' === $post->post_type) {
            $keys = get_post_custom_keys($post->ID);
            do_action('sjb_applicants_details_before');
            ?>

            <div class="wrap"><div id="icon-tools" class="icon32"></div>
                <h3>
                    <?php 
            if (in_array('jobapp_name', $keys)) {
                echo get_post_meta($post->ID, 'jobapp_name', true);
            }
            if (in_array('resume', $keys)) {
                ?>
                        &nbsp; &nbsp; <small><a href="<?php 
                echo get_post_meta($post->ID, 'resume', true);
                ?>
" target="_blank" ><?php 
                echo __('Resume', 'simple-job-board');
                ?>
</a></small>
                    <?php 
            }
            ?>

                </h3>                
                <table class="widefat striped">
                    <?php 
            do_action('sjb_applicants_details_start');
            foreach ($keys as $key) {
                if (substr($key, 0, 7) == 'jobapp_') {
                    echo '<tr><td>' . ucwords(str_replace('_', ' ', substr($key, 7))) . '</td><td>' . get_post_meta($post->ID, $key, true) . '</td></tr>';
                }
            }
            do_action('sjb_applicants_details_end');
            ?>
                </table>
            </div>

            <?php 
            do_action('sjb-applicants-details-after');
            ?>

            <h2><?php 
            _e('Application Notes', 'simple-job-board');
            ?>
</h2>
            
            <?php 
            do_action('sjb_applicantion_notes');
        }
    }
开发者ID:jep-heroes,项目名称:wp,代码行数:62,代码来源:class-simple-job-board-applicants.php


示例10: save_post

 function save_post($post_ID, $post)
 {
     $post_metas = get_post_custom_keys($post->ID);
     if (empty($post_metas)) {
         return;
     }
     foreach ($post_metas as $post_meta_key) {
         if (0 === strpos($post_meta_key, '_npr_api_')) {
             delete_post_meta($post->ID, $post_meta_key);
         }
     }
 }
开发者ID:appliaison,项目名称:WP-NPR-API,代码行数:12,代码来源:embed.php


示例11: tt_acf_fields_required

 function tt_acf_fields_required($group_id)
 {
     $acf_field_keys = get_post_custom_keys($group_id);
     $acf_field_label = array();
     foreach ($acf_field_keys as $key => $value) {
         if (stristr($value, 'field_')) {
             $acf_field = get_field_object($value, $group_id);
             $acf_field_label[] = $acf_field['required'];
         }
     }
     return $acf_field_label;
 }
开发者ID:raindolf,项目名称:Kasemor,代码行数:12,代码来源:advanced-custom-fields.php


示例12: get_saved_meta_option

 function get_saved_meta_option()
 {
     global $post;
     $keys = @get_post_custom_keys($post->ID);
     if (is_array($keys)) {
         foreach ($keys as $key) {
             $metas[preg_replace('/_/', '', $key, 1)] = get_post_meta($post->ID, $key, true);
         }
         return $metas;
     }
     return false;
 }
开发者ID:ahoymehearties,项目名称:responsiblegamer,代码行数:12,代码来源:input-tool.php


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


示例14: cloneMeta

 /**
  * Copies post meta data
  * @param  int $oldId
  * @param  int $newId
  * @return boolean
  */
 protected function cloneMeta($oldId, $newId)
 {
     $metaKeys = get_post_custom_keys($oldId);
     if (empty($metaKeys)) {
         return false;
     }
     foreach ($metaKeys as $metaKey) {
         $metaValues = get_post_custom_values($metaKey, $oldId);
         foreach ($metaValues as $metaValue) {
             $metaValue = maybe_unserialize($metaValue);
             update_post_meta($newId, $metaKey, $metaValue);
         }
     }
     return true;
 }
开发者ID:kyscastellanos,项目名称:arepa,代码行数:21,代码来源:clone_page.php


示例15: tool_acf_get_post_custom_keys

function tool_acf_get_post_custom_keys($p = array())
{
    $p += array('post_id' => false, 'filter' => '_');
    $ret = false;
    if ($p['post_id']) {
        $ret = get_post_custom_keys($p['post_id']);
        if (count($ret) > 0) {
            foreach ($ret as $key => $item) {
                if ($p['filter'] == '_' && $item[0] === '_') {
                    unset($ret[$key]);
                }
            }
        }
    }
    return $ret;
}
开发者ID:kikinangulo,项目名称:wordpress-toolset,代码行数:16,代码来源:index.php


示例16: ddleetspeak_filter_the_content

function ddleetspeak_filter_the_content($content)
{
    global $DDLeetSpeak, $post;
    // Check if the there is a meta keyword for this page/post.
    if (in_array('leet', get_post_custom_keys($post->ID))) {
        $content = $DDLeetSpeak->leetize($content);
    } else {
        // Find all tagged text -- [leet][/leet]
        preg_match_all('!\\[leet\\].*?\\[/leet\\]!', $content, $matches);
        $matches = $matches[0];
        foreach ($matches as $string) {
            $content = str_replace($string, htmlspecialchars($DDLeetSpeak->leetize(str_replace(array('[leet]', '[/leet]'), '', $string)), ENT_COMPAT, 'UTF-8'), $content);
        }
    }
    return $content;
}
开发者ID:veloper,项目名称:Leet-Speak-WordPress-Plugin,代码行数:16,代码来源:filters.php


示例17: nprstory_api_push

/**
 * push the contents and fields for a post to the NPR API
 *
 * Limited to users that can publish posts
 *
 * @param unknown_type $post_ID
 * @param unknown_type $post
 */
function nprstory_api_push($post_ID, $post)
{
    if (!current_user_can('publish_posts')) {
        wp_die(__('You do not have permission to publish posts, and therefore you do not have permission to push posts to the NPR API.'), __('NPR Story API Error'), 403);
    }
    $push_post_type = get_option('ds_npr_push_post_type');
    if (empty($push_post_type)) {
        $push_post_type = 'post';
    }
    //if the push url isn't set, don't even try to push.
    $push_url = get_option('ds_npr_api_push_url');
    if (!empty($push_url)) {
        // For now, only submit regular posts, and only on publish.
        if ($post->post_type != $push_post_type || $post->post_status != 'publish') {
            return;
        }
        //we may be able to have a custom body, so we need to check for that.
        $content = $post->post_content;
        $use_custom = get_option('dp_npr_push_use_custom_map');
        $body_field = 'Body';
        if ($use_custom) {
            //get the list of metas available for this post
            $post_metas = get_post_custom_keys($post->ID);
            $custom_content_meta = get_option('ds_npr_api_mapping_body');
            $body_field = $custom_content_meta;
            if (!empty($custom_content_meta) && $custom_content_meta != '#NONE#' && in_array($custom_content_meta, $post_metas)) {
                $content = get_post_meta($post->ID, $custom_content_meta, true);
            }
        }
        // Abort pushing to NPR if the post has no content
        if (empty($content)) {
            update_post_meta($post_ID, NPR_PUSH_STORY_ERROR, $body_field . ' is required for a post to be pushed to the NPR API.');
            return;
        } else {
            delete_post_meta($post_ID, NPR_PUSH_STORY_ERROR, $body_field . ' is required for a post to be pushed to the NPR API.');
        }
        $api = new NPRAPIWordpress();
        // Don't push stories to the NPR story API if they were originally pulled from the NPR Story API
        $retrieved = get_post_meta($post_ID, NPR_RETRIEVED_STORY_META_KEY, true);
        if (empty($retrieved) || $retrieved == 0) {
            $api->send_request($api->create_NPRML($post), $post_ID);
        } else {
            nprstory_error_log('Not pushing the story with post_ID ' . $post_ID . ' to the NPR Story API because it came from the API');
        }
    }
}
开发者ID:nprds,项目名称:nprapi-wordpress,代码行数:54,代码来源:push_story.php


示例18: wcff_post_listing

 function wcff_post_listing($column, $post_id)
 {
     global $post;
     switch ($column) {
         case 'fields':
             $count = 0;
             $keys = get_post_custom_keys($post_id);
             if ($keys) {
                 foreach ($keys as $key) {
                     if ((strpos($key, 'wccpf_') !== false || strpos($key, 'wccaf_') !== false) && (strpos($key, 'group_rules') === false && strpos($key, 'condition_rules') === false && strpos($key, 'location_rules') === false)) {
                         $count++;
                     }
                 }
             }
             echo $count;
             break;
     }
 }
开发者ID:pacificano,项目名称:sweet-tooth-sweets,代码行数:18,代码来源:wcff-post-form.php


示例19: content

 /**
  * Modifies the output of the post content.
  * 
  * This method is called in the single page of this class post type.
  * 
  * Alternatively, you may use the 'content_{instantiated class name}' method,
  */
 public function content($sContent)
 {
     // 1. To retrieve the meta box data - get_post_meta( $post->ID ) will return an array of all the meta field values.
     // or if you know the field id of the value you want, you can do $value = get_post_meta( $post->ID, $field_id, true );
     $_iPostID = $GLOBALS['post']->ID;
     $_aPostData = array();
     foreach ((array) get_post_custom_keys($_iPostID) as $sKey) {
         // This way, array will be unserialized; easier to view.
         $_aPostData[$sKey] = get_post_meta($_iPostID, $sKey, true);
     }
     // Or you may do this but the nested elements will be a serialized array.
     // $_aPostData = get_post_custom( $_iPostID ) ;
     // 2. To retrieve the saved options in the setting pages created by the framework - use the get_option() function.
     // The key name is the class name by default. The key can be changed by passing an arbitrary string
     // to the first parameter of the constructor of the AdminPageFramework class.
     $_aSavedOptions = get_option('APF_Demo');
     return "<h3>" . __('Saved Meta Field Values', 'admin-page-framework-demo') . "</h3>" . $this->oDebug->getArray($_aPostData) . "<h3>" . __('Saved Setting Options', 'admin-page-framework-demo') . "</h3>" . $this->oDebug->getArray($_aSavedOptions);
 }
开发者ID:robbenz,项目名称:plugs,代码行数:25,代码来源:APF_PostType.php


示例20: _fillOptionsArrayFromPostMeta

 private function _fillOptionsArrayFromPostMeta(array &$aOptions, $iPostID, array $aFields)
 {
     $_aMetaKeys = $this->oUtil->getAsArray(get_post_custom_keys($iPostID));
     foreach ($aFields as $_sSectionID => $_aFields) {
         if ('_default' == $_sSectionID) {
             foreach ($_aFields as $_aField) {
                 if (!in_array($_aField['field_id'], $_aMetaKeys)) {
                     continue;
                 }
                 $aOptions[$_aField['field_id']] = get_post_meta($iPostID, $_aField['field_id'], true);
             }
         }
         if (!in_array($_sSectionID, $_aMetaKeys)) {
             continue;
         }
         $aOptions[$_sSectionID] = get_post_meta($iPostID, $_sSectionID, true);
     }
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:18,代码来源:AdminPageFramework_MetaBox_Model.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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