当前位置: 首页>>代码示例>>PHP>>正文


PHP get_post_meta函数代码示例

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


在下文中一共展示了get_post_meta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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