本文整理汇总了PHP中thb_get_post_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP thb_get_post_meta函数的具体用法?PHP thb_get_post_meta怎么用?PHP thb_get_post_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了thb_get_post_meta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: thb_wp_migration_36
/**
* Function to be run when migrating to a WordPress version after 3.6.
*
* - Post format adaptation: image, link, video, audio, quote
*
* @return void
*/
function thb_wp_migration_36()
{
$posts = get_posts(array('posts_per_page' => -1, 'post_status' => array('image', 'link', 'audio', 'video', 'quote')));
$posts = (array) $posts;
if (count($posts) > 0) {
foreach ($posts as $post) {
$format = get_post_format($post->ID);
switch ($format) {
case 'image':
$featured_image = thb_get_featured_image($post->ID);
if (!empty($featured_image)) {
update_post_meta($post->ID, '_format_image', $featured_image);
// delete_post_meta($post->ID, '_thumbnail_id');
}
break;
case 'link':
$link_url = thb_get_post_meta($post->ID, 'link_url');
if (!empty($link_url)) {
update_post_meta($post->ID, '_format_link_url', $link_url);
// delete_post_meta($post->ID, THB_META_KEY . 'link_url');
}
break;
case 'video':
case 'audio':
$url = thb_get_post_meta($post->ID, $format . '_url');
if (!empty($url)) {
update_post_meta($post->ID, '_format_' . $format . '_embed', $url);
// delete_post_meta($post->ID, THB_META_KEY . $format . '_url');
}
break;
case 'quote':
$quote_text = thb_get_post_meta($post->ID, 'quote');
$quote_url = thb_get_post_meta($post->ID, 'quote_url');
$quote_url = str_replace('http://', '', $quote_url);
$quote_author = thb_get_post_meta($post->ID, 'quote_author');
wp_update_post(array('ID' => $post->ID, 'post_content' => $quote_text));
update_post_meta($post->ID, '_format_quote_source_url', $quote_url);
update_post_meta($post->ID, '_format_quote_source_name', $quote_author);
// delete_post_meta($post->ID, THB_META_KEY . 'quote');
// delete_post_meta($post->ID, THB_META_KEY . 'quote_url');
// delete_post_meta($post->ID, THB_META_KEY . 'quote_author');
break;
}
wp_save_post_revision($post->ID);
}
}
}
示例2: sidebars_body_classes
function sidebars_body_classes($classes)
{
$entry_id = thb_get_page_ID();
if ($entry_id != 0) {
$is_sidebar_page = in_array(thb_get_page_template($entry_id), thb_config('core/sidebars', 'templates')) || is_single();
if ($is_sidebar_page) {
$sidebar = thb_get_post_meta($entry_id, 'sidebar');
if ($sidebar != '0' && is_active_sidebar($sidebar)) {
$classes[] = 'w-sidebar';
// Checking the sidebar position
$position = thb_get_post_meta($entry_id, 'sidebar_position');
$classes[] = $position;
}
}
} else {
if (!is_archive() && !is_search() && !is_404()) {
if (is_active_sidebar('post-sidebar')) {
$classes[] = 'w-sidebar';
}
}
}
return $classes;
}
示例3: thb_layout_body_classes
function thb_layout_body_classes($classes)
{
$id = thb_get_page_ID();
if (thb_get_post_meta($id, 'page_boxed')) {
$classes[] = 'thb-page-boxed';
}
if (thb_get_post_meta($id, 'pageheader_disable') == "1") {
$classes[] = 'thb-pageheader-disabled';
}
if (thb_check_template_config('core/layout', 'meta_options_gutter')) {
$classes[] = 'thb-gutter-' . thb_get_post_meta($id, 'gutter');
}
$classes[] = thb_get_option('logo_position');
return $classes;
}
示例4: get_the_ID
* @since BigFoot 1.0
*/
$thb_page_id = get_the_ID();
$work_categories = wp_get_object_terms($thb_page_id, 'portfolio_categories');
$cats = array();
foreach ($work_categories as $cat) {
$cats[] = $cat->name;
}
$prj_info = thb_duplicable_get('prj_info', $thb_page_id);
$has_prj_info = !empty($prj_info);
get_header();
?>
<!-- Page header -->
<?php
if (thb_get_post_meta($thb_page_id, 'pageheader_disable') == 0) {
?>
<header class="pageheader">
<h1><?php
the_title();
?>
</h1>
<?php
if (!empty($cats)) {
?>
<h2><?php
echo implode(', ', $cats);
?>
</h2>
<?php
}
示例5: thb_get_post_meta
<div id="footer-stripe">
<div class="wrapper">
<div class="thb-footer-stripe-content">
<?php
$content_type = thb_get_post_meta($footer_stripe_id, 'footerstripes_content_type');
if ($content_type == 'social') {
echo do_shortcode('[thb_social show="' . thb_get_post_meta($footer_stripe_id, 'footerstripes_social_services') . '"]');
} elseif ($content_type == 'twitter') {
echo '<div class="thb-twitter-livefeed">';
echo do_shortcode('[thb_twitter user="' . thb_get_post_meta($footer_stripe_id, 'footerstripes_twitter_username') . '" num="' . thb_get_post_meta($footer_stripe_id, 'footerstripes_twitter_num') . '"]');
echo '</div>';
} elseif ($content_type == 'call-to-action') {
$big_text = thb_get_post_meta($footer_stripe_id, 'footerstripes_call-to-action_big_text');
$small_text = thb_get_post_meta($footer_stripe_id, 'footerstripes_call-to-action_small_text');
$btn_label = thb_get_post_meta($footer_stripe_id, 'footerstripes_call-to-action_btn_text');
$btn_url = thb_get_post_meta($footer_stripe_id, 'footerstripes_call-to-action_btn_url');
echo '<div class="thb-call-to-container">';
if (!empty($big_text) || !empty($small_text)) {
echo '<div class="thb-call-to-message">';
echo '<p class="thb-call-big-text">' . $big_text . '</p>';
echo '<p class="thb-call-small-text">' . nl2br($small_text) . '</p>';
echo '</div>';
if (!empty($btn_label) && !empty($btn_url)) {
echo '<a class="btn" href="' . $btn_url . '">' . $btn_label . '</a>';
}
}
echo '</div>';
}
?>
</div>
</div>
示例6: get_the_author_meta
<?php
$author_description = get_the_author_meta('user_description');
if (!empty($author_description)) {
?>
<div class="thb-text">
<?php
echo thb_text_format($author_description, true);
?>
</div>
<?php
}
?>
</aside>
<?php
if (thb_get_post_meta($thb_page_id, 'disable_navigation_block') != '1') {
?>
<?php
thb_pagination(array('type' => 'links', 'previousPostTitle' => __('Previous', 'thb_text_domain'), 'nextPostTitle' => __('Next', 'thb_text_domain')));
?>
<?php
}
?>
<?php
if (thb_show_related()) {
?>
<section class="related">
<h3><?php
_e('You might also like', 'thb_text_domain');
?>
示例7: get_the_ID
<?php
$post_id = get_the_ID();
$post_layout = thb_get_post_meta($post_id, 'single_layout');
$video_url = thb_get_post_meta($post_id, 'video_url');
?>
<header class="item-header<?php
if (!empty($video_url)) {
?>
w-featured-image<?php
}
?>
">
<h1>
<a href="<?php
the_permalink();
?>
" rel="permalink"><?php
the_title();
?>
</a>
</h1>
<footer class="item-footer">
<span class="author"><?php
_e('Posted by', 'thb_text_domain');
?>
<?php
the_author_posts_link();
?>
</span>
示例8: get_the_ID
<?php
$post_id = get_the_ID();
$post_layout = thb_get_post_meta($post_id, 'single_layout');
?>
<div class="item-content">
<?php
if (get_the_excerpt() != '') {
?>
<div class="text">
<?php
the_content();
?>
</div>
<?php
}
?>
</div>
示例9: thb_get_post_meta
<?php
if (empty($id)) {
$id = 0;
}
$slideshow_type = thb_get_post_meta($id, 'slideshow_type');
$slideshow_path = thb_get_module_path('core/slideshows/submodules/' . $slideshow_type);
$slideshow = new THB_Slideshow($id);
$slideshow->setBaseTemplate($slideshow_path . '/templates');
$slideshow->setSize(thb_config('core/slideshows/submodules/' . $slideshow_type, 'image_size'));
$slideshow->setMarkupId($markup_id);
$slideshow->render();
示例10: reset
reset($image_sizes);
$image_size = current($image_sizes);
if (isset($image_size[$slides_size])) {
$slideshow->setSize($image_size[$slides_size]);
} else {
$slideshow->setSize($image_size);
}
}
} else {
$slideshow->setSize($slides_size);
}
} else {
$slideshow->setSize($image_size);
}
$slides = $slideshow->getSlides();
$slides_per_page = thb_get_post_meta($thb_page_id, 'slides_per_page');
$ajaxloading = !empty($slides_per_page);
$offset = 0;
if ($ajaxloading) {
$total_slides = count($slides);
$offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
$slides = array_slice($slides, $offset * $slides_per_page, $slides_per_page);
}
?>
<?php
if (count($slides) > 0) {
?>
<ul class="thb-photogallery-container" data-url="<?php
echo add_query_arg('offset', $offset + 1);
?>
示例11: do_shortcode
?>
<div class="thb-twitter-livefeed">
<?php
echo do_shortcode('[thb_twitter user="' . thb_get_post_meta($page_id, 'twitter_home_username') . '" num="' . thb_get_post_meta($page_id, 'twitter_home_count') . '"]');
?>
</div>
<?php
}
?>
<?php
if (thb_get_post_meta($page_id, 'enable_social_home') == '1') {
?>
<div class="thb-social-home">
<?php
$thb_services = explode(',', thb_get_post_meta($page_id, 'social_home_services'));
$thb_services_names = array('twitter' => 'Twitter', 'facebook' => 'Facebook', 'googleplus' => 'Google+', 'flickr' => 'Flickr', 'youtube' => 'YouTube', 'vimeo' => 'Vimeo', 'pinterest' => 'Pinterest', 'dribbble' => 'Dribbble', 'forrst' => 'Forrst', 'linkedin' => 'LinkedIn');
$thb_services_dataicon = array('twitter' => '1', 'facebook' => '2', 'googleplus' => '3', 'flickr' => '4', 'youtube' => '5', 'vimeo' => '6', 'pinterest' => '7', 'dribbble' => '8', 'forrst' => '9', 'linkedin' => 'v');
$services = $thb_services;
if (!empty($show)) {
$show = explode(',', $show);
$services = array();
foreach ($show as $service_id) {
$service_id = trim($service_id);
if (in_array($service_id, $thb_services)) {
$services[] = $service_id;
}
}
}
?>
<?php
示例12: get_the_ID
<?php
$post_id = get_the_ID();
$post_layout = thb_get_post_meta($post_id, 'single_layout');
$link_url = thb_get_post_meta($post_id, 'link_url');
?>
<header class="item-header">
<h1>
<a href="<?php
the_permalink();
?>
" rel="permalink"><?php
the_title();
?>
</a>
</h1>
<a class="linkurl" href="<?php
echo $link_url;
?>
" title="<?php
the_title();
?>
">
<?php
echo $link_url;
?>
</a>
<footer class="item-footer">
<span class="author"><?php
_e('Posted by', 'thb_text_domain');
示例13: thb_get_post_meta
<?php
$link_url = thb_get_post_meta(get_the_ID(), 'link_url');
?>
<a class="linkurl" href="<?php
echo $link_url;
?>
" title="<?php
the_title();
?>
">
<?php
echo $link_url;
?>
</a>
<div class="item-wrapper">
<header class="item-header">
<h1>
<a href="<?php
the_permalink();
?>
" rel="permalink"><?php
the_title();
?>
</a>
</h1>
<time pubdate class="pubdate">
<?php
echo get_the_date();
示例14: array
<?php
$thb_pagination_config = array('type' => 'links', 'id' => 'thb-portfolio-pagination');
if (isset($previousText)) {
$thb_pagination_config['previousText'] = $previousText;
}
if (isset($nextText)) {
$thb_pagination_config['nextText'] = $nextText;
}
if (isset($arrowPreviousText)) {
$thb_pagination_config['arrowPreviousText'] = $arrowPreviousText;
}
if (isset($arrowNextText)) {
$thb_pagination_config['arrowNextText'] = $arrowNextText;
}
thb_pagination($thb_pagination_config);
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$.thb.config.set('portfolio', $.thb.config.defaultKeyName, {
useAJAX: <?php
echo (int) thb_get_post_meta(thb_get_page_ID(), 'works_ajax_pagination');
?>
});
});
</script>
示例15: isset
if ($fields_container->getTitle() != '') {
?>
<h4><?php
echo $fields_container->getTitle();
?>
</h4>
<?php
}
?>
<?php
echo $container_intro_text;
?>
<?php
global $post;
$post_id = isset($_GET['post']) ? $_GET['post'] : $post->ID;
foreach ($fields_container->getFields() as $field) {
if ($field->isComplex()) {
$value = array();
foreach ($field->getSubkeys() as $subKey) {
$value[$subKey] = thb_get_post_meta($post_id, $field->getName() . '_' . $subKey);
}
} else {
$value = thb_get_post_meta($post_id, $field->getName());
}
$field->setValue($value);
$field->render();
}
?>
</div>