本文整理汇总了PHP中rwmb_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP rwmb_meta函数的具体用法?PHP rwmb_meta怎么用?PHP rwmb_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rwmb_meta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: img_link
/**
* Heli the format content link.
*
* Set up the content.
*
* @package WordPress
* @subpackage Heli
* @since Heli 1.0
*/
function img_link()
{
$images = rwmb_meta('as_bg_link', 'type=image');
foreach ($images as $image) {
echo "{$image['full_url']}";
}
}
示例2: al_portfolio_meta_tags
function al_portfolio_meta_tags()
{
$post_type = get_post_type();
if ('portfolio' == $post_type) {
$title = get_post_meta(get_the_ID(), "al_pf_og_title", TRUE);
$title = !empty($title) ? $title : get_the_title();
$meta = array('og:title' => $title, 'og:url' => get_permalink());
$desc = get_post_meta(get_the_ID(), "al_pf_og_description", TRUE);
$desc = !empty($desc) ? $desc : false;
if ($desc) {
$meta['og:description'] = $desc;
}
if (has_post_thumbnail()) {
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$meta['og:image'] = $thumbnail[0];
}
if (get_post_format() == 'gallery') {
$images = rwmb_meta('al_pf_gallery_images', 'type=image&size=full');
if (is_array($images)) {
foreach ($images as $image) {
$meta['images'][] = $image['url'];
}
}
}
foreach ($meta as $key => $value) {
if ($key == 'images') {
foreach ($value as $image) {
echo '<meta property="og:image" content="' . $image . '" />';
}
} else {
echo '<meta property="' . $key . '" content="' . $value . '" />';
}
}
}
}
示例3: entry_content_close
function entry_content_close()
{
if (rwmb_meta('mak_desc') != '') {
echo '<p class="short-desc">' . rwmb_meta('mak_desc') . '</p>';
}
echo '</div>';
}
示例4: widget
public function widget ($args, $instance) {
echo $args["before_widget"];
if(!empty($instance["title"]))
echo $args["before_title"] . apply_filters("widget_title", $instance["title"]) . $args["after_title"];
$testimonials = new WP_Query(array(
"post_type" => "team-members",
"orderby" => "rand"
));
if($testimonials->have_posts()) {
$testimonials->the_post();
?>
<div id="team-random" class="media">
<div class="media-left">
<img class="media-object" src="<? echo wp_get_attachment_image_src
(array_values(rwmb_meta("team_member_footer_image"))[0]["ID"], "full")[0]; ?>"/>
</div>
<div class="media-body">
<h4 class="media-heading"><? echo get_the_title(); ?></h4>
<p>"<? echo rwmb_meta("team_member_quote"); ?>"</p>
</div>
</div>
<?
wp_reset_postdata();
} else echo "<p>Sorry, there are no team members to be displayed</p>";
echo $args["after_widget"];
}
示例5: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
global $icon;
$icon = $instance['icon'];
$title = apply_filters('widget_title', $instance['title']);
$number = $instance['number'];
/* before widget */
echo $before_widget;
/* display title */
if ($title && $icon) {
echo $before_title . '<i class="fa ' . $icon . ' "></i>' . $title . $after_title;
} elseif ($title) {
echo $before_title . $title . $after_title;
}
/* display the widget */
?>
<div <?php
post_class();
?>
id="images-widget-<?php
the_ID();
?>
">
<div class="gallery-widget">
<ul>
<?php
global $post;
$args = array('order' => 'DESC', 'post_type' => 'gallery', 'posts_per_page' => 1);
$loop = new WP_Query($args);
while ($loop->have_posts()) {
$loop->the_post();
$images = rwmb_meta('gxg_gallery_images', 'type=image&size=square2', false);
$i = 0;
foreach ($images as $image) {
$imageurl = $image['url'];
$imagefull = $image['full_url'];
if ($i++ < $number) {
echo "<li class='prettyimage-wrap'><a class='pretty_image' title='' data-rel='prettyPhoto[pp_gallery]' href='{$imagefull}'><span class='image-rollover'><i class='gallery-resize-icon fa fa-expand'></i></span><img src='{$imageurl}' alt='' /></a></li>";
}
}
}
wp_reset_query();
?>
</ul>
</div><!-- .gallery-widget -->
</div><!-- .post-? -->
<?php
/* after widget */
echo $after_widget;
}
示例6: ac_get_meta
function ac_get_meta($key, $args = array(), $post_id = null)
{
// Page level meta is only relevant on singulars, or is blog page (which WP thinks is not singular)
if (function_exists('rwmb_meta') && (is_singular() || ac_is_blog_page())) {
return rwmb_meta('ac_' . $key, $args, $post_id);
} else {
return null;
// return null for all options
}
}
示例7: get
protected function get()
{
global $post;
// SLIDER
$sliderPostsID = rwmb_meta('GAL_slider_art', array('type' => 'autocomplete', 'multiple' => 'true'), $post->ID);
$sliderPosts = array();
foreach ($sliderPostsID as $id) {
$sliderPosts[] = get_post($id);
}
return array('slides' => $sliderPosts);
}
示例8: home_banners_func
function home_banners_func($atts, $content = null)
{
// New function parameter $content is added!
extract(shortcode_atts(array('width' => '1/2', 'el_position' => '', 'section_height' => '', 'loop' => '', 'slideshow' => '', 'time' => '', 'transition_time' => ''), $atts));
$output = '';
global $post;
// get recent posts
$args = array('post_type' => 'banner', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'caller_get_posts' => 1);
$posts = new wp_query($args);
// if posts exist
if ($posts->have_posts()) {
$output .= '<section class="flexslider std-slider" data-height="' . $section_height . '" data-loop="' . $loop . '" data-smooth="false" data-slideshow="' . $slideshow . '" data-speed="' . $time . '" data-animspeed="' . $transition_time . '" data-controls="true" data-dircontrols="true">';
$output .= '<ul class="slides">';
// loop through and display them
while ($posts->have_posts()) {
$posts->the_post();
if (rwmb_meta('_wp_banner_image', $post->ID)) {
$images = rwmb_meta('_wp_banner_image', 'type=plupload_image', $post->ID);
if (count($images) > 0) {
foreach ($images as $image) {
$image_url = wp_get_attachment_image_src($image['ID'], 'full');
$output .= '<li data-bg="' . $image_url[0] . '">';
}
}
}
$output .= '<div class="container">';
$output .= '<div class="inner">';
$output .= '<div class="row">';
$output .= '<div class="text-center animated" data-fx="fadeIn">';
if (rwmb_meta('_wp_title', get_the_ID())) {
$output .= '<h2>' . rwmb_meta('_wp_title', get_the_ID()) . '</h2>';
}
if (rwmb_meta('_wp_sub_title', get_the_ID())) {
$output .= '<p>' . rwmb_meta('_wp_sub_title', get_the_ID()) . '</p>';
}
if (rwmb_meta('_wp_show_button_1', get_the_ID()) == 1) {
$output .= '<a href="' . rwmb_meta('_wp_button_1_url', get_the_ID()) . '" class="btn btn-primary btn-lg local">' . rwmb_meta('_wp_button_1_text', get_the_ID()) . '</a>';
}
if (rwmb_meta('_wp_show_button_2', get_the_ID()) == 1) {
$output .= '<a href="' . rwmb_meta('_wp_button_2_url', get_the_ID()) . '" class="btn btn-default btn-lg">' . rwmb_meta('_wp_button_2_text', get_the_ID()) . '</a>';
}
$output .= '</div>';
$output .= '<div class="col-md-6"></div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</li>';
}
$output .= '</ul>';
$output .= '</section>';
}
wp_reset_query();
return $output;
}
示例9: staff_func
function staff_func($atts, $content = null)
{
// New function parameter $content is added!
extract(shortcode_atts(array('width' => '1/2', 'el_position' => '', 'staff_exclude' => ''), $atts));
$output = '';
global $post;
if ($staff_exclude) {
$exclude = $staff_exclude;
} else {
$exclude = '';
}
$staff = get_posts(array('post_type' => 'staff', 'order' => 'ASC', 'orderby' => 'menu_order', 'exclude' => $exclude));
if (count($staff) > 0) {
//$output .= '<div class="row">';
foreach ($staff as $post) {
setup_postdata($post);
$output .= '<div class="col-md-3 col-sm-6">';
$output .= '<div class="personBox">';
if (rwmb_meta('_wp_staff_image', $post->ID)) {
$images = rwmb_meta('_wp_staff_image', 'type=plupload_image', $post->ID);
if (count($images) > 0) {
foreach ($images as $image) {
$image_url = wp_get_attachment_image_src($image['ID'], 'staff');
$output .= '<img src="' . $image_url[0] . '" alt="' . $image['alt'] . '" />';
}
}
}
$output .= '<h4>' . get_the_title();
if (get_post_meta($post->ID, '_wp_staff_position', true)) {
$output .= '<span>' . get_post_meta($post->ID, '_wp_staff_position', true) . '</span>';
}
$output .= '</h4>';
if (get_post_meta($post->ID, '_wp_staff_facebook', true) || get_post_meta($post->ID, '_wp_staff_twitter', true) || get_post_meta($post->ID, '_wp_staff_linkedin', true)) {
$output .= '<hr>';
$output .= '<ul class="socialNormal list-inline">';
if (get_post_meta($post->ID, '_wp_staff_facebook', true)) {
$output .= '<li><a href="' . get_post_meta($post->ID, '_wp_staff_facebook', true) . '" data-toggle="tooltip" title="Facebook"><i class="fa fa-facebook-square"></i></a></li>';
}
if (get_post_meta($post->ID, '_wp_staff_twitter', true)) {
$output .= '<li><a href="' . get_post_meta($post->ID, '_wp_staff_twitter', true) . '" data-toggle="tooltip" title="Twitter"><i class="fa fa-twitter"></i></a></li>';
}
if (get_post_meta($post->ID, '_wp_staff_linkedin', true)) {
$output .= '<li><a href="' . get_post_meta($post->ID, '_wp_staff_linkedin', true) . '" data-toggle="tooltip" title="LinkedIn"><i class="fa fa-linkedin-square"></i></a></li>';
}
$output .= '</ul>';
}
$output .= '</div>';
$output .= '</div>';
}
wp_reset_query();
//$output .= '</div>';
}
return $output;
}
示例10: ciGetNormalizedMeta
/**
* @param string $fieldID The string identifier for the meta field you're looking for
* @param mixed $valueIfNotSet The default value, in the event this meta value isn't set for the current post
* @param {int|null} $overridePostID The post ID to search for. If empty, we will use whatever get_the_id() returns.
* @return mixed The current post's value for the field you requested
*/
function ciGetNormalizedMeta($fieldID, $valueIfNotSet, $overridePostID = null)
{
if (function_exists('rwmb_meta')) {
$field = rwmb_meta(CI_THEME_PREFIX . "_{$fieldID}", array(), $overridePostID);
if ($field === "") {
$field = $valueIfNotSet;
}
return $field;
} else {
return $valueIfNotSet;
}
}
示例11: blog_shortcode
public function blog_shortcode($atts)
{
$output = $category = $author = $posts_per_page = $type = $orderby = $order = '';
extract(shortcode_atts(array('type' => '1', 'posts_per_page' => 5, 'category' => '', 'author' => '', 'orderby' => 'date', 'order' => 'DESC'), $atts));
// Explode all categories and authors ids into arrays
if ($category == '') {
$categories = array();
} else {
$categories = explode(",", $category);
}
if ($author == '') {
$authors = array();
} else {
$authors = explode(",", $author);
}
$prefix = 'zen_';
if (function_exists('rwmb_meta')) {
$option = rwmb_meta("{$prefix}page_sidebar");
if ($option == 'none') {
$this->has_widgets = false;
$this->content_class = 'col-sm-12';
} else {
$this->has_widgets = true;
$this->content_class = 'col-sm-9';
}
}
// Construct the query
if (get_query_var('paged')) {
$paged = get_query_var('paged');
} elseif (get_query_var('page')) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
$args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => $paged, 'posts_per_page' => (int) $posts_per_page, 'orderby' => $orderby, 'order' => $order, 'category__in' => $categories, 'author__in' => $authors);
$query = new WP_Query($args);
$this->blog_query = $query;
switch ($type) {
case '1':
$this->blog_style_1($query);
break;
case '2':
$this->blog_style_2($query);
break;
case '3':
$this->blog_style_3($query);
break;
}
return $output;
}
示例12: onehost_get_meta
/**
* Get post meta
*
* @since 1.0
*
* @param string $key
* @param array $args
* @param int $post_id
*
* @return mixed
*/
function onehost_get_meta($key, $args = array(), $post_id = null)
{
if (function_exists('rwmb_meta')) {
return rwmb_meta($key, $args, $post_id);
}
/**
* Base on Meta Box plugin function
*/
$post_id = empty($post_id) ? get_the_ID() : $post_id;
$args = wp_parse_args($args, array('type' => 'text'));
// Set 'multiple' for fields based on 'type'
if (!isset($args['multiple'])) {
$args['multiple'] = in_array($args['type'], array('checkbox_list', 'file', 'file_advanced', 'image', 'image_advanced', 'plupload_image', 'thickbox_image'));
}
$meta = get_post_meta($post_id, $key, !$args['multiple']);
// Get uploaded files info
if (in_array($args['type'], array('file', 'file_advanced'))) {
if (is_array($meta) && !empty($meta)) {
$files = array();
foreach ($meta as $id) {
$path = get_attached_file($id);
$files[$id] = array('ID' => $id, 'name' => basename($path), 'path' => $path, 'url' => wp_get_attachment_url($id), 'title' => get_the_title($id));
}
$meta = $files;
}
} elseif (in_array($args['type'], array('image', 'plupload_image', 'thickbox_image', 'image_advanced'))) {
global $wpdb;
$meta = $wpdb->get_col($wpdb->prepare("SELECT meta_value FROM {$wpdb->postmeta}\r\n\t\t\t\t\tWHERE post_id = %d AND meta_key = '%s'\r\n\t\t\t\t\tORDER BY meta_id ASC\r\n\t\t\t\t", $post_id, $key));
if (is_array($meta) && !empty($meta)) {
$images = array();
foreach ($meta as $id) {
$images[$id] = fastlat_get_image_info($id, $args);
}
$meta = $images;
}
} elseif ('taxonomy_advanced' == $args['type']) {
if (!empty($args['taxonomy'])) {
$term_ids = array_map('intval', array_filter(explode(',', $meta . ',')));
// Allow to pass more arguments to "get_terms"
$func_args = wp_parse_args(array('include' => $term_ids, 'hide_empty' => false), $args);
unset($func_args['type'], $func_args['taxonomy'], $func_args['multiple']);
$meta = get_terms($args['taxonomy'], $func_args);
} else {
$meta = array();
}
} elseif ('taxonomy' == $args['type']) {
$meta = empty($args['taxonomy']) ? array() : wp_get_post_terms($post_id, $args['taxonomy']);
}
return $meta;
}
示例13: clients_table_content
function clients_table_content($column_name, $post_id)
{
$c_opt_file = rwmb_meta("Cfile");
$c_opt_author = rwmb_meta("uploaded_by");
$c_opt_type = rwmb_meta("type");
if ($column_name == 'uploaded_by') {
echo $c_opt_author;
}
if ($column_name == 'categories') {
echo get_categories();
}
if ($column_name == 'type') {
echo $c_opt_type;
}
}
示例14: get_rwmb_meta
function get_rwmb_meta($field_id, $args = array(), $post_id = null)
{
$custom_fields = klasik_get_customdata();
if (function_exists('rwmb_meta')) {
if (rwmb_meta($field_id, $args, $post_id)) {
return rwmb_meta($field_id, $args, $post_id);
} elseif (isset($custom_fields[$field_id])) {
//return $custom_fields['klasik_layout'];
}
} elseif (isset($custom_fields[$field_id])) {
return $custom_fields[$field_id];
} else {
return false;
}
}
示例15: added_copy
/**
* Genesis Framework.
*
* WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
* Please do all modifications in the form of a child theme.
*
* @package Genesis\Templates
* @author StudioPress
* @license GPL-2.0+
* @link http://my.studiopress.com/themes/genesis/
*/
function added_copy()
{
$process = rwmb_meta('mak_process');
$ordering = rwmb_meta('mak_ordering');
if ($process != '' && $ordering != '') {
?>
<div class="first one-half process">
<h3 class="small">Process</h3>
<div class="entry-content">
<?php
echo $process;
?>
</div>
</div>
<div class="one-half ordering">
<h3 class="small">Ordering</h3>
<div class="entry-content">
<?php
echo $ordering;
?>
</div>
</div>
<?php
} elseif ($process != '' && $ordering == '') {
?>
<div class="process">
<h3 class="small">Process</h3>
<div class="entry-content">
<?php
echo $process;
?>
</div>
</div>
<?php
} elseif ($process == '' && $ordering != '') {
?>
<div class="process">
<h3 class="small">Ordering</h3>
<div class="entry-content">
<?php
echo $ordering;
?>
</div>
</div>
<?php
}
}