本文整理汇总了PHP中get_post_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_meta函数的具体用法?PHP get_post_meta怎么用?PHP get_post_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_post_meta函数的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: all_for_post
public static function all_for_post($post_id, $args = array())
{
$enclosures = array();
$file_types_for_this_episode = array();
$wordpress_enclosures = get_post_meta($post_id, 'enclosure', false);
foreach ($wordpress_enclosures as $enclosure_data) {
$enclosure = Enclosure::from_enclosure_meta($enclosure_data, $post_id);
if ($enclosure->file_type && !in_array($enclosure->file_type->id, $file_types_for_this_episode)) {
$file_types_for_this_episode[] = $enclosure->file_type->id;
}
$enclosures[] = $enclosure;
}
// process podPress files
$podPress_enclosures = get_post_meta($post_id, '_podPressMedia', false);
if (is_array($podPress_enclosures) && !empty($podPress_enclosures)) {
foreach ($podPress_enclosures[0] as $file) {
$enclosure = Enclosure::from_enclosure_podPress($file, $post_id);
if (in_array($enclosure->file_type->id, $file_types_for_this_episode)) {
continue;
}
$file_types_for_this_episode[] = $enclosure->file_type->id;
$enclosures[] = $enclosure;
}
}
// if ( isset( $args['only_valid'] ) && $args['only_valid'] ) {
// foreach ( $enclosures as $enclosure ) {
// if ( $enclosure->errors ) {
// // unset( current( $enclosure ) );
// }
// }
// }
return $enclosures;
}
开发者ID:johannes-mueller,项目名称:podlove-publisher,代码行数:33,代码来源:enclosure.php
示例3: 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
示例4: 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
示例5: add_custom_nav_fields
/**
* Add custom fields to $item nav object
* in order to be used in custom Walker
*
* @access public
* @since 1.0
* @return void
*/
function add_custom_nav_fields($menu_item)
{
foreach ($this->custom_fields as $key) {
$menu_item->{$key} = get_post_meta($menu_item->ID, '_menu_item_megamenu_' . $key, true);
}
return $menu_item;
}
开发者ID:TruongTuyen,项目名称:thuctapcoso,代码行数:15,代码来源:nav.php
示例6: setup_slider
static function setup_slider($slider_id, $settings)
{
self::set_active_skin(get_post_meta($slider_id, 'skin', true));
self::$slider_id = $slider_id;
self::$slider_shortcode_atts = $settings;
self::$slider_settings = muneeb_ssp_slider_options($slider_id);
}
开发者ID:acordelabs,项目名称:espiral,代码行数:7,代码来源:ssp_skin.php
示例7: ultimatum_meta
function ultimatum_meta() {
global $wpdb;
$table=$wpdb->prefix.ULTIMATUM_PREFIX.'_layout';
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
wp_nonce_field( 'ultimatum_additional_meta', 'ultimatum_additional_meta_nonce' );
echo '<p><label for="ultimatum_author">';
_e("Show Author Info", 'ultimatum');
echo '</label>';
echo '<select name="ultimatum_author">';
$cura= get_post_meta($post_id,'ultimatum_author',true);
echo '<option value="false"';
if($cura=='false') { echo ' selected="selected" '; }
echo '>OFF</option>';
echo '<option value="true"';
if($cura=='true') { echo ' selected="selected" '; }
echo '>ON</option>';
echo '</select></p>';
echo '<p><label for="ultimatum_video">';
_e("Video URL", 'ultimatum');
echo '</label>';
$curv= get_post_meta($post_id,'ultimatum_video',true);
echo '<input type="text" name="ultimatum_video" value="'.$curv.'" size="50" />';
_e("Used in slideshows as post info ", 'ultimatum');
echo '</p>';
}
开发者ID:polaris610,项目名称:medicalhound,代码行数:26,代码来源:ultimatum-meta.php
示例8: swp_buffer_button_html
function swp_buffer_button_html($array)
{
// If we've already generated this button, just use our existing html
if (isset($_GLOBALS['sw']['buttons'][$array['postID']]['buffer'])) {
$array['resource']['buffer'] = $_GLOBALS['sw']['buttons'][$array['postID']]['buffer'];
// If not, let's check if Buffer is activated and create the button HTML
} elseif (isset($array['options']['newOrderOfIcons']['buffer']) && !isset($array['buttons']) || isset($array['buttons']) && isset($array['buttons']['buffer'])) {
// Collect the Title
$title = get_post_meta($array['postID'], 'nc_ogTitle', true);
if (!$title) {
$title = get_the_title();
}
$array['totes'] += $array['shares']['buffer'];
++$array['count'];
$array['resource']['buffer'] = '<div class="nc_tweetContainer swp_buffer" data-id="' . $array['count'] . '" data-network="buffer">';
$link = urlencode(urldecode(swp_process_url($array['url'], 'buffer', $array['postID'])));
$array['resource']['buffer'] .= '<a target="_blank" href="http://bufferapp.com/add?url=' . $link . '&text=' . urlencode(html_entity_decode($title, ENT_COMPAT, 'UTF-8')) . '" data-link="http://bufferapp.com/add?url=' . $link . '&text=' . urlencode(html_entity_decode($title, ENT_COMPAT, 'UTF-8')) . '" class="nc_tweet buffer_link">';
if ($array['options']['totesEach'] && $array['shares']['totes'] >= $array['options']['minTotes'] && $array['shares']['buffer'] > 0) {
$array['resource']['buffer'] .= '<span class="iconFiller">';
$array['resource']['buffer'] .= '<span class="spaceManWilly">';
$array['resource']['buffer'] .= '<i class="sw sw-buffer"></i>';
$array['resource']['buffer'] .= '<span class="swp_share"> ' . __('Buffer', 'social-warfare') . '</span>';
$array['resource']['buffer'] .= '</span></span>';
$array['resource']['buffer'] .= '<span class="swp_count">' . swp_kilomega($array['shares']['buffer']) . '</span>';
} else {
$array['resource']['buffer'] .= '<span class="swp_count swp_hide"><span class="iconFiller"><span class="spaceManWilly"><i class="sw sw-buffer"></i><span class="swp_share"> ' . __('Buffer', 'social-warfare') . '</span></span></span></span>';
}
$array['resource']['buffer'] .= '</a>';
$array['resource']['buffer'] .= '</div>';
// Store these buttons so that we don't have to generate them for each set
$_GLOBALS['sw']['buttons'][$array['postID']]['buffer'] = $array['resource']['buffer'];
}
return $array;
}
开发者ID:warfare-plugins,项目名称:social-warfare,代码行数:34,代码来源:buffer.php
示例9: display_seller_review
/**
* Displaying Prodcuts
*
* Does prepare the data for displaying the products in the table.
*/
function display_seller_review()
{
$data = array();
$prefix = FARMTOYOU_META_PREFIX;
//if search is call then pass searching value to function for displaying searching values
$args = array('post_type' => FARMTOYOU_SELLER_REVIEW_POST_TYPE, 'post_status' => 'any', 'posts_per_page' => '-1');
//get seller_review data from database
$all_seller_review = get_posts($args);
foreach ($all_seller_review as $key => $value) {
$seller_id = get_post_meta($value->ID, $prefix . 'seller_id', true);
$store_info = dokan_get_store_info($seller_id);
$store_name = isset($store_info['store_name']) ? esc_html($store_info['store_name']) : __('N/A', 'dokan');
$curr_user_id = get_post_meta($value->ID, $prefix . 'current_user_id', true);
$user_info = get_userdata($curr_user_id);
$first_name = $user_info->first_name;
$last_name = $user_info->last_name;
$user_email = $user_info->user_email;
$data[$key]['ID'] = isset($value->ID) ? $value->ID : '';
$data[$key]['seller_store'] = $store_name;
$data[$key]['curr_user_name'] = $first_name . " " . $last_name;
$data[$key]['curr_user_email'] = $user_email;
$data[$key]['user_rating'] = get_post_meta($value->ID, $prefix . 'seller_rating', true);
$data[$key]['user_comment'] = get_post_meta($value->ID, $prefix . 'user_comment', true);
$data[$key]['post_status'] = isset($value->post_status) ? $value->post_status : '';
$data[$key]['post_date'] = isset($value->post_date) ? $value->post_date : '';
}
return $data;
}
开发者ID:abcode619,项目名称:wpstuff,代码行数:33,代码来源:custom-seller-review.php
示例10: 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
示例11: tz_save_data_page
function tz_save_data_page($post_id)
{
global $meta_box_category;
// verify nonce
if (!isset($_POST['tz_meta_box_nonce']) || !wp_verify_nonce($_POST['tz_meta_box_nonce'], basename(__FILE__))) {
return $post_id;
}
// check autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $post_id;
}
// check permissions
if ('page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id)) {
return $post_id;
}
} elseif (!current_user_can('edit_post', $post_id)) {
return $post_id;
}
foreach ($meta_box_category['fields'] as $field) {
$old = get_post_meta($post_id, $field['id'], true);
$new = $_POST[$field['id']];
if ($new && $new != $old) {
update_post_meta($post_id, $field['id'], stripslashes(htmlspecialchars($new)));
} elseif ('' == $new && $old) {
delete_post_meta($post_id, $field['id'], $old);
}
}
}
开发者ID:woniu123360,项目名称:CherryFramework,代码行数:29,代码来源:theme-pagemeta.php
示例12: metabox_edit
public function metabox_edit($post, $metabox)
{
wp_nonce_field(MI_PREFIX . 'meta_box', MI_PREFIX . 'meta_box_nonce');
$html .= '
<input type="hidden" name="metabox[]" id="metabox[]" value="' . $metabox['id'] . '">
<table class="form-table">
<tbody>
';
$mi_forms = new MI_Forms();
foreach ($metabox['args']['fields'] as $id => $field) {
$form = $mi_forms->field($id, $field, get_post_meta($post->ID, MI_PREFIX . $id, true));
$html .= '
<tr>
<th scope="row"><label for="' . $form->name . '">' . $form->label . '</label></th>
<td>
';
$html .= $form->field;
$html .= $form->desc ? '<p class="description">' . $form->desc . '</p>' : '';
$html .= '
</td>
</tr>
';
}
$html .= '
</tbody>
</table>
';
echo $html;
}
开发者ID:milanezlucas,项目名称:move-it,代码行数:29,代码来源:MI_Metabox.php
示例13: create_page_option_elements
function create_page_option_elements()
{
global $post;
$option_value = gdlr_decode_preventslashes(get_post_meta($post->ID, $this->setting['option_name'], true));
if (!empty($option_value)) {
$option_value = json_decode($option_value, true);
}
$option_generator = new gdlr_admin_option_html();
echo '<div class="gdlr-page-option-wrapper position-' . $this->setting['position'] . '" >';
foreach ($this->option as $option_section) {
echo '<div class="gdlr-page-option">';
echo '<div class="gdlr-page-option-title">' . $option_section['title'] . '</div>';
echo '<div class="gdlr-page-option-input-wrapper">';
foreach ($option_section['options'] as $option_slug => $option) {
$option['slug'] = $option_slug;
$option['name'] = '';
if (!empty($option_value) && isset($option_value[$option_slug])) {
$option['value'] = $option_value[$option_slug];
}
$option_generator->generate_admin_option($option);
}
echo '</div>';
// page-option-input-wrapper
echo '</div>';
// page-option-title
}
echo '<textarea class="gdlr-input-hidden" name="' . $this->setting['option_name'] . '"></textarea>';
echo '</div>';
// gdlr-page-option-wrapper
}
开发者ID:refazul-refat,项目名称:bcc,代码行数:30,代码来源:gdlr-page-options.php
示例14: save_newsletter
function save_newsletter($post_id)
{
// verify nonce
if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__))) {
return $post_id;
}
// check autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $post_id;
}
// check permissions
if ('newsletter' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id)) {
return $post_id;
}
} elseif (!current_user_can('edit_post', $post_id)) {
return $post_id;
}
$old = get_post_meta($post_id, "name", true);
$new = $_POST["name"];
if ($new && $new != $old) {
update_post_meta($post_id, "name", $new);
} elseif ('' == $new && $old) {
delete_post_meta($post_id, "name", $old);
}
}
开发者ID:JonathanCosta,项目名称:Vou-de-Marisa,代码行数:26,代码来源:marisa-newsletter.php
示例15: like_post
function like_post($post_id, $action = 'get')
{
if (!is_numeric($post_id)) {
return;
}
switch ($action) {
case 'get':
$like_count = get_post_meta($post_id, '_qode-like', true);
if (!$like_count) {
$like_count = 0;
add_post_meta($post_id, '_qode-like', $like_count, true);
}
return '<span class="qode-like-count">' . $like_count . '</span>';
break;
case 'update':
$like_count = get_post_meta($post_id, '_qode-like', true);
if (isset($_COOKIE['qode-like_' . $post_id])) {
return $like_count;
}
$like_count++;
update_post_meta($post_id, '_qode-like', $like_count);
setcookie('qode-like_' . $post_id, $post_id, time() * 20, '/');
return '<span class="qode-like-count">' . $like_count . '</span>';
break;
}
}
开发者ID:sdxlgc,项目名称:net-wp_sdgcxl-htdocs,代码行数:26,代码来源:qode-like.php
示例16: mango_add_custom_nav_fields
function mango_add_custom_nav_fields($menu_item)
{
$menu_item->icon = get_post_meta($menu_item->ID, '_menu_item_icon', true);
$menu_item->icon_pos = get_post_meta($menu_item->ID, '_menu_item_icon_pos', true);
$menu_item->nolink = get_post_meta($menu_item->ID, '_menu_item_nolink', true);
$menu_item->hide = get_post_meta($menu_item->ID, '_menu_item_hide', true);
$menu_item->mobile_hide = get_post_meta($menu_item->ID, '_menu_item_mobile_hide', true);
$menu_item->hide_cat_image = get_post_meta($menu_item->ID, '_menu_item_hide_cat_image', true);
$menu_item->hide_subcats_list = get_post_meta($menu_item->ID, '_menu_item_hide_subcats_list', true);
$menu_item->hide_empty_subcats = get_post_meta($menu_item->ID, '_menu_item_hide_empty_subcats', true);
$menu_item->cols = get_post_meta($menu_item->ID, '_menu_item_cols', true);
$menu_item->tip_label = get_post_meta($menu_item->ID, '_menu_item_tip_label', true);
$menu_item->tip_color = get_post_meta($menu_item->ID, '_menu_item_tip_color', true);
$menu_item->tip_bg = get_post_meta($menu_item->ID, '_menu_item_tip_bg', true);
$menu_item->popup_type = get_post_meta($menu_item->ID, '_menu_item_popup_type', true);
$menu_item->popup_pos = get_post_meta($menu_item->ID, '_menu_item_popup_pos', true);
$menu_item->popup_cols = get_post_meta($menu_item->ID, '_menu_item_popup_cols', true);
$menu_item->popup_bg_image = get_post_meta($menu_item->ID, '_menu_item_popup_bg_image', true);
$menu_item->popup_bg_pos = get_post_meta($menu_item->ID, '_menu_item_popup_bg_pos', true);
$menu_item->popup_bg_repeat = get_post_meta($menu_item->ID, '_menu_item_popup_bg_repeat', true);
$menu_item->popup_bg_size = get_post_meta($menu_item->ID, '_menu_item_popup_bg_size', true);
$menu_item->popup_style = get_post_meta($menu_item->ID, '_menu_item_popup_style', true);
$menu_item->subpopup_bg_image = get_post_meta($menu_item->ID, '_menu_item_subpopup_bg_image', true);
$menu_item->subpopup_bg_pos = get_post_meta($menu_item->ID, '_menu_item_subpopup_bg_pos', true);
$menu_item->subpopup_bg_repeat = get_post_meta($menu_item->ID, '_menu_item_subpopup_bg_repeat', true);
$menu_item->subpopup_bg_size = get_post_meta($menu_item->ID, '_menu_item_subpopup_bg_size', true);
$menu_item->subpopup_style = get_post_meta($menu_item->ID, '_menu_item_subpopup_style', true);
$menu_item->block = get_post_meta($menu_item->ID, '_menu_item_block', true);
$menu_item->show_category_img = get_post_meta($menu_item->ID, '_menu_item_show_category_img', true);
return $menu_item;
}
开发者ID:nickkoskowski,项目名称:Work-Depot,代码行数:31,代码来源:menu.php
示例17: comcon_meta_save
function comcon_meta_save()
{
global $post;
$post_id = $post->ID;
if (!isset($_POST['comcon-form-nonce']) || !wp_verify_nonce($_POST['comcon-form-nonce'], basename(__FILE__))) {
return $post->ID;
}
$post_type = get_post_type_object($post->post_type);
if (!current_user_can($post_type->cap->edit_post, $post_id)) {
return $post->ID;
}
$input = array();
$input['position'] = isset($_POST['comcon-form-position']) ? $_POST['comcon-form-position'] : '';
$input['major'] = isset($_POST['comcon-form-major']) ? $_POST['comcon-form-major'] : '';
$input['order'] = str_pad($input['order'], 3, "0", STR_PAD_LEFT);
foreach ($input as $field => $value) {
$old = get_post_meta($post_id, 'comcon-form-' . $field, true);
if ($value && '' == $old) {
add_post_meta($post_id, 'comcon-form-' . $field, $value, true);
} else {
if ($value && $value != $old) {
update_post_meta($post_id, 'comcon-form-' . $field, $value);
} else {
if ('' == $value && $old) {
delete_post_meta($post_id, 'comcon-form-' . $field, $old);
}
}
}
}
}
开发者ID:ucf-design-group,项目名称:vucf,代码行数:30,代码来源:functions-comcon.php
示例18: __construct
/**
* Create a simple subscription product object.
*
* @access public
* @param mixed $product
*/
public function __construct($product)
{
parent::__construct($product);
$this->product_type = 'subscription';
// Load all meta fields
$this->product_custom_fields = get_post_meta($this->id);
// Convert selected subscription meta fields for easy access
if (!empty($this->product_custom_fields['_subscription_price'][0])) {
$this->subscription_price = $this->product_custom_fields['_subscription_price'][0];
}
if (!empty($this->product_custom_fields['_subscription_period'][0])) {
$this->subscription_period = $this->product_custom_fields['_subscription_period'][0];
}
if (!empty($this->product_custom_fields['_subscription_period_interval'][0])) {
$this->subscription_period_interval = $this->product_custom_fields['_subscription_period_interval'][0];
}
if (!empty($this->product_custom_fields['_subscription_length'][0])) {
$this->subscription_length = $this->product_custom_fields['_subscription_length'][0];
}
if (!empty($this->product_custom_fields['_subscription_trial_length'][0])) {
$this->subscription_trial_length = $this->product_custom_fields['_subscription_trial_length'][0];
}
if (!empty($this->product_custom_fields['_subscription_trial_period'][0])) {
$this->subscription_trial_period = $this->product_custom_fields['_subscription_trial_period'][0];
}
if (!empty($this->product_custom_fields['_subscription_sign_up_fee'][0])) {
$this->subscription_sign_up_fee = $this->product_custom_fields['_subscription_sign_up_fee'][0];
}
$this->limit_subscriptions = !isset($this->product_custom_fields['_subscription_limit'][0]) ? 'no' : $this->product_custom_fields['_subscription_limit'][0];
}
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:36,代码来源:class-wc-product-subscription.php
示例19: karma_post
function karma_post($post_id, $action = 'get')
{
if (!is_numeric($post_id)) {
return;
}
$karma_count = get_post_meta($post_id, $this->option_key, true);
switch ($action) {
case 'get':
if (!$karma_count) {
$karma_count = 0;
add_post_meta($post_id, $this->option_key, $karma_count, true);
}
return $karma_count;
break;
case 'update':
if (isset($_COOKIE[$this->option_key . $post_id])) {
return $karma_count;
}
$karma_count++;
update_post_meta($post_id, $this->option_key, $karma_count);
setcookie($this->option_key . $post_id, $post_id, time() * 20, '/');
return $karma_count;
break;
}
}
开发者ID:taeche,项目名称:SoDoEx,代码行数:25,代码来源:utils.karma.php
示例20: znpb_add_kallyas_template
function znpb_add_kallyas_template($current_layout, $post, $post_id)
{
if (!is_page($post_id)) {
return $current_layout;
}
$sidebar_pos = get_post_meta($post_id, 'zn_page_layout', true);
$sidebar_to_use = get_post_meta($post_id, 'zn_sidebar_select', true);
$subheader_style = get_post_meta($post_id, 'zn_subheader_style', true) !== '0' ? get_post_meta($post_id, 'zn_subheader_style', true) : 'zn_def_header_style';
$sidebar_saved_data = zget_option('page_sidebar', 'unlimited_sidebars', false, array('layout' => 'right_sidebar', 'sidebar' => 'defaultsidebar'));
if ($sidebar_pos == 'default' || empty($sidebar_pos)) {
$sidebar_pos = $sidebar_saved_data['layout'];
}
if ($sidebar_to_use == 'default' || empty($sidebar_to_use)) {
$sidebar_to_use = $sidebar_saved_data['sidebar'];
}
// We will add the new elements here
$sidebar = ZNPB()->add_module_to_layout('TH_Sidebar', array('sidebar_select' => $sidebar_to_use));
$sidebar_column = ZNPB()->add_module_to_layout('ZnColumn', array(), array($sidebar), 'col-sm-3');
$sections[] = ZNPB()->add_module_to_layout('TH_CustomSubHeaderLayout', array('hm_header_style' => $subheader_style));
// If the sidebar was saved as left sidebar
if ($sidebar_pos == 'left_sidebar') {
$columns[] = $sidebar_column;
}
// Add the main shop content
$archive_columns = $sidebar_pos == 'no_sidebar' ? 4 : 3;
$textbox = ZNPB()->add_module_to_layout('TH_TextBox', array('stb_title' => $post->post_title, 'stb_content' => $post->post_content));
$columns[] = ZNPB()->add_module_to_layout('ZnColumn', array(), array($textbox), 'col-sm-9');
// If the sidebar was saved as right sidebar
if ($sidebar_pos == 'right_sidebar') {
$columns[] = $sidebar_column;
}
$sections[] = ZNPB()->add_module_to_layout('ZnSection', array(), $columns, 'col-sm-12');
return $sections;
}
开发者ID:rock1media,项目名称:wordpress,代码行数:34,代码来源:functions.php
注:本文中的get_post_meta函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论