本文整理汇总了PHP中wma_meta_option函数的典型用法代码示例。如果您正苦于以下问题:PHP wma_meta_option函数的具体用法?PHP wma_meta_option怎么用?PHP wma_meta_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wma_meta_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wma_field_slider
/**
* Numeric slider / Range
*
* @since 1.0
* @version 1.2.2
*/
function wma_field_slider($field, $page_template = null)
{
// Helper variables
// Definition
$field = wp_parse_args((array) $field, array('type' => 'slider', 'id' => 'id', 'label' => '', 'description' => '', 'class' => '', 'default' => '', 'min' => 0, 'max' => 10, 'step' => 1, 'zero' => true, 'conditional' => ''));
// Value processing
$value = wma_meta_option($field['id']);
if ($value || $field['zero'] && 0 === intval($value)) {
$value = esc_attr(intval($value));
} else {
$value = esc_attr(intval($field['default']));
}
// Field ID setup
$field['id'] = WM_METABOX_FIELD_PREFIX . $field['id'];
// Output
$output = "\r\n\t" . '<tr class="option range-wrap option-' . esc_attr(trim(sanitize_html_class($field['id']) . ' ' . $field['class'])) . '" data-option="' . esc_attr($field['id']) . '"><th>';
// Label
$output .= "\r\n\t\t" . '<label for="' . esc_attr($field['id']) . '">' . trim(strip_tags($field['label'], WM_METABOX_LABEL_HTML)) . '</label>';
$output .= "\r\n\t" . '</th><td>';
// Input field
$output .= "\r\n\t\t" . '<input type="number" name="' . esc_attr($field['id']) . '" id="' . esc_attr($field['id']) . '" value="' . esc_attr($value) . '" size="5" maxlength="5" />';
$output .= "\r\n\t\t" . '<span class="fieldtype-range"><span id="' . esc_attr($field['id']) . '-slider" data-min="' . esc_attr(intval($field['min'])) . '" data-max="' . esc_attr(intval($field['max'])) . '" data-step="' . esc_attr(intval($field['step'])) . '" data-value="' . esc_attr($value) . '"></span></span>';
// Description
if (trim($field['description'])) {
$output .= "\r\n\t\t" . '<p class="description">' . trim($field['description']) . '</p>';
}
// Reset default value button
if (trim($field['default'])) {
$output .= "\r\n\t\t" . '<a data-option="' . esc_attr($field['id']) . '" class="button-default-value default-slider" title="' . esc_attr__('Use a default value', 'webman-amplifier') . '"><span>' . esc_attr($field['default']) . '</span></a>';
}
echo $output;
// Conditional display
do_action('wmhook_metabox_' . 'conditional', $field, $field['id']);
echo "\r\n\t" . '</td></tr>';
}
示例2: wma_field_checkbox
function wma_field_checkbox($field, $page_template = null)
{
//Field definition array
$field = wp_parse_args((array) $field, array('type' => 'checkbox', 'id' => 'id', 'label' => '', 'description' => '', 'value' => true, 'class' => '', 'attributes' => '', 'repeater' => false, 'conditional' => ''));
//Value processing
$field['value'] = esc_attr($field['value']);
if ($field['repeater'] && is_array($field['repeater']) && isset($field['repeater']['value'])) {
$value = $field['repeater']['value'];
} else {
$value = wma_meta_option($field['id']);
}
$value = esc_attr($value);
//Field ID setup
if ($field['repeater'] && is_array($field['repeater']) && isset($field['repeater']['id'])) {
$field['id'] = $field['repeater']['id'];
} else {
$field['id'] = WM_METABOX_FIELD_PREFIX . $field['id'];
}
//Output
$output = "\r\n\t" . '<tr class="option checkbox-wrap option-' . trim(sanitize_html_class($field['id']) . ' ' . $field['class']) . '" data-option="' . $field['id'] . '"><th colspan="2">';
//Input field
$output .= "\r\n\t\t" . '<input type="' . $field['type'] . '" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . $field['value'] . '" class="fieldtype-checkbox" ' . trim(checked($value, $field['value'], false) . ' ' . $field['attributes'] . ' /') . '>';
//Label
$output .= ' <label for="' . $field['id'] . '">' . trim(strip_tags($field['label'], WM_METABOX_LABEL_HTML)) . '</label>';
//Description
if (trim($field['description'])) {
$output .= "\r\n\t\t" . '<p class="description">' . trim($field['description']) . '</p>';
}
echo $output;
//Conditional display
do_action('wmhook_metabox_' . 'conditional', $field, $field['id']);
echo "\r\n\t" . '</th></tr>';
}
示例3: wma_field_repeater
function wma_field_repeater($field, $page_template = null)
{
//Field definition array
$field = wp_parse_args((array) $field, array('type' => 'repeater', 'id' => 'id', 'label' => '', 'description' => '', 'fields' => '', 'default' => array(''), 'class' => '', 'button-text' => '+', 'conditional' => ''));
//Value processing
$values = (array) wma_meta_option($field['id']);
$values = array_filter($values);
if (!is_array($values) || empty($values)) {
$values = $field['default'];
}
//Field ID setup
$field['id'] = WM_METABOX_FIELD_PREFIX . $field['id'];
//Output
$output = "\r\n\t" . '<tr class="option repeater-wrap option-' . trim($field['id'] . ' ' . $field['class']) . '" data-option="' . $field['id'] . '"><th>';
//Label
$output .= "\r\n\t\t" . '<label for="' . $field['id'] . '">' . trim(strip_tags($field['label'], WM_METABOX_LABEL_HTML)) . '</label>';
$output .= "\r\n\t" . '</th><td>';
//Description
if (trim($field['description'])) {
$output .= "\r\n\t\t" . '<p class="description">' . trim($field['description']) . '</p>';
}
$output .= "\r\n\t\t" . '<div class="repeater-cells">';
echo $output;
//Repeater cells
if (is_array($values) && !empty($values)) {
$i = 0;
foreach ($values as $value) {
if (is_array($field['fields']) && !empty($field['fields'])) {
$output = "\r\n\t\t" . '<table class="repeater-cell">';
//Controls row
$output .= "\r\n\t\t\t" . '<thead class="repeater-cell-controls"><tr><th colspan="2">';
$output .= "\r\n\t\t\t\t" . '<a class="button button-move-cell" data-id="' . $field['id'] . '" title="' . __('Move the item', 'webman-amplifier') . '">≡</a>';
$output .= "\r\n\t\t\t\t" . '<a class="button button-remove-cell" data-id="' . $field['id'] . '" title="' . __('Remove this item', 'webman-amplifier') . '">-</a>';
$output .= "\r\n\t\t\t" . '</th></tr></thead>';
$output .= "\r\n\t\t\t" . '<tbody>';
echo $output;
//Fields row
foreach ($field['fields'] as $cell_field) {
if (isset($cell_field['type']) && in_array($cell_field['type'], array('checkbox', 'color', 'radio', 'text', 'textarea', 'select'))) {
//Passing special repeater values into field generator/renderer
$cell_value = isset($value[$cell_field['id']]) ? $value[$cell_field['id']] : null;
$cell_field['repeater'] = array('id' => $field['id'] . '[' . $i . ']' . '[' . $cell_field['id'] . ']', 'value' => $cell_value);
//Display form fields using action hook (echo the function return)
do_action('wmhook_metabox_' . 'render_' . $cell_field['type'], $cell_field, '');
}
}
echo "\r\n\t\t" . '<!-- /repeater-cell --></tbody></table>';
}
$i++;
}
}
//Add repeater cell button
echo "\r\n\t\t" . '</div> <!-- /repeater-cells -->';
echo "\r\n\t\t" . '<a href="#" class="button button-add-cell" data-id="' . $field['id'] . '">' . $field['button-text'] . '</a>';
//Conditional display
do_action('wmhook_metabox_' . 'conditional', $field, $field['id']);
echo "\r\n\t" . '</td></tr>';
}
示例4: wm_section_markup
/**
* Shortcode markup: section (row)
*/
function wm_section_markup($output, $atts)
{
//Helper variables
$prepend = $append = $sections_layout = '';
$video_formats = array('mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv');
if ('sections' == wma_meta_option('sidebar')) {
$sections_layout = true;
}
//video_url
$atts['video_url'] = array_filter(explode(',', str_replace(' ', '', $atts['video_url'])));
if (!empty($atts['video_url'])) {
if (1 === count($atts['video_url'])) {
$atts['video_url'] = array('src="' . esc_url($atts['video_url'][0]) . '"');
} else {
foreach ($atts['video_url'] as $key => $url) {
foreach ($video_formats as $format) {
if (stripos($url, '.' . $format)) {
$atts['video_url'][$key] = $format . '="' . esc_url($url) . '"';
}
}
}
}
$atts['video_url'] = do_shortcode(apply_filters('wm_section_markup_video_url', '<div class="wm-row-video">[wm_video ' . implode(' ', $atts['video_url']) . ' loop="on" autoplay="on" /]<div class="overlay"></div></div>'), $atts);
} else {
$atts['video_url'] = '';
}
//Modify class
if ($atts['font_color']) {
$atts['class'] .= ' custom-font-color';
}
//Section markup
if ($sections_layout) {
//Modify class
if ($atts['padding']) {
$atts['class'] .= ' no-wrap-inner-padding';
}
//Section HTML wrapper
$prepend .= "\r\n\r\n" . '<div class="wm-section {class}"{attributes}>' . "\r\n\r\n" . $atts['video_url'];
$append .= "\r\n\r\n" . '</div> <!-- /wm-section -->' . "\r\n\r\n";
//Apply default theme section inner wrappers
if (!$atts['disable_container']) {
$prepend .= apply_filters('wmhook_section_inner_wrappers', '');
$append = apply_filters('wmhook_section_inner_wrappers_close', '') . $append;
}
}
//Output
$replacements = array('{attributes}' => implode(' ', $atts['attributes']), '{class}' => $atts['class'], '{content}' => $atts['content']);
$output = strtr($prepend . $atts['html'][$atts['behaviour']] . $append, $replacements);
return $output;
}
示例5: in_array
$link .= in_array($link_atts[2], array('_self', '_blank')) ? ' target="' . esc_attr($link_atts[2]) . '"' : ' data-target="' . esc_attr($link_atts[2]) . '"';
}
// Output the posts item
$output_item = apply_filters('wmhook_shortcode_' . $shortcode . '_item_output_pre', '', $post_id, $atts);
if (empty($output_item)) {
$class_item = '';
// Testimonial title (for accessibility)
$output_item .= '<' . tag_escape($atts['heading_tag']) . ' class="screen-reader-text">' . get_the_title($post_id) . '</' . tag_escape($atts['heading_tag']) . '>';
// Testimonial content
$output_item .= do_shortcode('<blockquote class="wm-testimonials-element wm-html-element content"' . wma_schema_org('review_body') . '>' . wpautop(preg_replace('/<(\\/?)blockquote(.*?)>/', '', get_the_content())) . '</blockquote>');
// Testimonial author
if (trim(wma_meta_option('author', $post_id))) {
$output_item .= '<cite class="wm-testimonials-element wm-html-element source">';
$output_item .= $link ? '<a' . $link . wma_schema_org('bookmark') . '>' : '';
$output_item .= has_post_thumbnail($post_id) ? '<span class="wm-testimonials-element wm-html-element image image-container"' . wma_schema_org('image') . '>' . get_the_post_thumbnail($post_id, $image_size, array('title' => esc_attr(get_the_title(get_post_thumbnail_id($post_id))))) . '</span>' : '';
$output_item .= '<span class="wm-testimonials-element wm-html-element author"' . wma_schema_org('author') . '>' . do_shortcode(strip_tags(wma_meta_option('author', $post_id), '<a><em><i><img><mark><small><strong>')) . '</span>';
$output_item .= $link ? '</a>' : '';
$output_item .= '</cite>';
}
$output_item .= wma_schema_org('itemprop="name" content="' . get_the_title($post_id) . '"', true);
$output_item .= wma_schema_org('itemprop="datePublished" content="' . get_the_date('c') . '"', true);
// Filter the posts item html output
$output_item = apply_filters('wmhook_shortcode_' . $shortcode . '_item_html', $output_item, $post_id, $atts);
// Posts single item output
$class_item .= 'wm-testimonials-item wm-testimonials-item-' . $post_id;
if (!$atts['testimonial']) {
$class_item .= ' wm-column width-1-' . $atts['columns'] . $atts['no_margin'] . $alt;
}
if (!$atts['testimonial'] && (!$atts['no_margin'] || ' with-margin' === $atts['no_margin']) && !$atts['scroll'] && !$masonry_layout && $i % $atts['columns'] === 0) {
$class_item .= ' last';
}
示例6: apply_filters
* @version 1.4
*/
/**
* Homepage redirect
*
* Applies on custom posts that don't need a single post view.
*/
$redirects = (array) apply_filters('wmhook_custom_post_redirects', array('wm_logos' => home_url(), 'wm_modules' => home_url(), 'wm_staff' => home_url(), 'wm_testimonials' => home_url()));
if (in_array(get_post_type($post->ID), array_keys($redirects))) {
wp_redirect($redirects[get_post_type($post->ID)], 301);
exit;
}
/**
* Redirect Projects with custom link applied
*
* @since 1.1
*/
if (function_exists('wma_meta_option') && 'wm_projects' == get_post_type($post->ID) && wma_meta_option('link-action', $post->ID)) {
wp_redirect(esc_url(wma_meta_option('link', $post->ID)), 301);
exit;
}
/**
* Actual single post content
*/
get_header();
if (function_exists('wma_amplifier')) {
get_template_part('loop', 'singular');
} else {
get_template_part('loop', 'post');
}
get_footer();
示例7: get_page_by_path
$page_object = get_page_by_path($link_atts[0]);
$link = $page_object ? ' href="' . esc_url(get_permalink($page_object->ID)) . '"' : '#';
} elseif ($link_atts[1]) {
$link = ' href="' . esc_url($link_atts[1]) . '"';
} else {
$link = '';
}
if ($link && $link_atts[2]) {
$link .= in_array($link_atts[2], array('_self', '_blank')) ? ' target="' . esc_attr($link_atts[2]) . '"' : ' data-target="' . esc_attr($link_atts[2]) . '"';
}
$helpers = array('link' => $link, 'tag' => isset($atts['layout']['tag']) ? 'module_tag' : '');
$helpers = apply_filters('wmhook_shortcode_' . $shortcode . '_layout_elements_helpers', $helpers, $post_id, $atts);
$layout_elements = array('content' => do_shortcode('<div class="wm-content-module-element wm-html-element content">' . wpautop(get_the_content()) . '</div>'), 'image' => '', 'morelink' => $helpers['link'] ? '<div class="wm-content-module-element wm-html-element more-link"><a' . $helpers['link'] . '>' . sprintf(apply_filters('wmhook_shortcode_' . 'read_more_text', __('Read more <span class="screen-reader-text">about "%s"</span>»', 'webman-amplifier'), $shortcode, $post_id, $atts), get_the_title()) . '</a></div>' : '', 'tag' => '', 'title' => $helpers['link'] ? '<div class="wm-content-module-element wm-html-element title"><' . tag_escape($atts['heading_tag']) . '><a' . $helpers['link'] . '>' . get_the_title() . '</a></' . tag_escape($atts['heading_tag']) . '></div>' : '<div class="wm-content-module-element wm-html-element title"><' . tag_escape($atts['heading_tag']) . '>' . get_the_title() . '</' . tag_escape($atts['heading_tag']) . '></div>');
//image layout element
$image = has_post_thumbnail($post_id) ? get_the_post_thumbnail($post_id, $image_size, array('title' => esc_attr(get_the_title(get_post_thumbnail_id($post_id))))) : '';
$icon = array('box' => wma_meta_option('icon-box', $post_id), 'font' => wma_meta_option('icon-font', $post_id), 'color' => wma_meta_option('icon-color', $post_id), 'color-background' => wma_meta_option('icon-color-background', $post_id));
$image_class = ' featured-image';
$style_icon = $icon['color'] ? ' style="color: ' . esc_attr($icon['color']) . '"' : '';
$style_container = $icon['color-background'] ? ' style="background-color: ' . esc_attr($icon['color-background']) . '"' : '';
if ($icon['box'] && $icon['font']) {
$image = '<i class="' . esc_attr($icon['font']) . '"' . $style_icon . '></i>';
$image_class = ' font-icon';
}
if ($image && $helpers['link']) {
$image = '<a' . $helpers['link'] . '>' . $image . '</a>';
}
if ($image) {
$layout_elements['image'] = '<div class="wm-content-module-element wm-html-element image image-container' . esc_attr($image_class) . '"' . $style_container . '>' . $image . '</div>';
}
//tag layout element
if ($helpers['tag']) {
示例8: wma_schema_org
function wma_schema_org($element = '', $output_meta_tag = false)
{
//Requirements check
if (!$element || apply_filters('wmhook_wmamp_' . 'disable_schema_org', true)) {
return;
}
//Helper variables
$output = apply_filters('wmhook_wmamp_' . 'schema_org_output_pre', '', $element, $output_meta_tag);
if ($output) {
return apply_filters('wmhook_wmamp_' . 'wma_schema_org' . '_output', ' ' . $output, $element, $output_meta_tag);
}
$base = apply_filters('wmhook_wmamp_' . 'schema_org_base', 'http://schema.org/', $element, $output_meta_tag);
$post_id = is_home() ? get_option('page_for_posts') : null;
$type = wma_meta_option('schemaorg-type', $post_id);
if (empty($type)) {
$type = get_post_meta($post_id, 'schemaorg_type', true);
}
//Add custom post types that describe a single item to this array
$itempage_array = (array) apply_filters('wmhook_wmamp_' . 'schema_org_itempage_array', array('wm_projects', 'jetpack-portfolio'), $element, $output_meta_tag);
//Generate output
switch ($element) {
case 'article':
$output = 'itemscope itemtype="' . $base . 'Article"';
break;
case 'article_body':
$output = 'itemprop="articleBody"';
break;
case 'author':
$output = 'itemprop="author"';
break;
case 'bookmark':
$output = 'itemprop="url"';
break;
case 'comment':
$output = 'itemprop="comment"';
break;
case 'creative_work':
$output = 'itemscope itemtype="' . $base . 'CreativeWork"';
break;
case 'creator':
$output = 'itemprop="creator" itemscope itemtype="' . $base . 'Person"';
break;
case 'date_modified':
$output = 'itemprop="dateModified"';
break;
case 'date_published':
case 'publish_date':
case 'datePublished':
$output = 'itemprop="datePublished"';
break;
case 'description':
$output = 'itemprop="description"';
break;
case 'entry':
$output = 'itemscope ';
if (is_page()) {
$output .= 'itemtype="' . $base . 'WebPage"';
} elseif (is_singular($itempage_array)) {
$output .= 'itemprop="workExample" itemtype="' . $base . 'CreativeWork"';
} elseif ('audio' === get_post_format()) {
$output .= 'itemtype="' . $base . 'AudioObject"';
} elseif ('gallery' === get_post_format()) {
$output .= 'itemprop="ImageGallery" itemtype="' . $base . 'ImageGallery"';
} elseif ('video' === get_post_format()) {
$output .= 'itemprop="video" itemtype="' . $base . 'VideoObject"';
} else {
$output .= 'itemprop="blogPost" itemtype="' . $base . 'BlogPosting"';
}
break;
case 'entry_body':
if (!is_single()) {
$output = 'itemprop="description"';
} elseif (is_page()) {
$output = 'itemprop="mainContentOfPage"';
} else {
$output = 'itemprop="articleBody"';
}
break;
case 'footer':
case 'WPFooter':
$output = 'itemscope itemtype="' . $base . 'WPFooter"';
break;
case 'header':
case 'WPHeader':
$output = 'itemscope itemtype="' . $base . 'WPHeader"';
break;
case 'headline':
$output = 'itemprop="headline"';
break;
case 'html':
if (!$type) {
if (is_singular($itempage_array)) {
$type = 'ItemPage';
} elseif (is_singular('post')) {
$type = 'BlogPosting';
} elseif (is_single()) {
$type = 'Article';
} elseif (is_author()) {
$type = 'ProfilePage';
} elseif (is_search()) {
//.........这里部分代码省略.........
示例9: wma_field_radio
/**
* Radio buttons
*
* @since 1.0
* @version 1.2.2
*/
function wma_field_radio($field, $page_template = null)
{
// Helper variables
// Definition
$field = wp_parse_args((array) $field, array('type' => 'radio', 'id' => 'id', 'label' => '', 'description' => '', 'class' => '', 'options' => array(), 'default' => '', 'inline' => false, 'filter' => false, 'repeater' => false, 'custom' => '', 'hide-radio' => false, 'conditional' => ''));
// Alter class when custom label HTML used
if (trim($field['custom'])) {
$field['class'] = 'custom-label ' . $field['class'];
}
if ($field['hide-radio']) {
$field['hide-radio'] = ' hide';
}
if ($field['filter']) {
$field['class'] .= ' filterable';
}
// Value processing
if ($field['repeater'] && is_array($field['repeater']) && isset($field['repeater']['value'])) {
$value = $field['repeater']['value'];
} else {
$value = wma_meta_option($field['id']);
}
if ($value) {
$value = esc_attr($value);
} else {
$value = esc_attr($field['default']);
}
// Field ID setup
if ($field['repeater'] && is_array($field['repeater']) && isset($field['repeater']['id'])) {
$field['id'] = $field['repeater']['id'];
} else {
$field['id'] = WM_METABOX_FIELD_PREFIX . $field['id'];
}
// Output
$output = "\r\n\t" . '<tr class="option radio-wrap option-' . esc_attr(trim($field['id'] . ' ' . $field['class'])) . '" data-option="' . esc_attr($field['id']) . '"><th>';
// Radio group label
$output .= "\r\n\t\t" . '<strong class="label">' . trim(strip_tags($field['label'], WM_METABOX_LABEL_HTML)) . '</strong>';
// Description
if (trim($field['description'])) {
$output .= "\r\n\t\t" . '<p class="description">' . trim($field['description']) . '</p>';
}
// Filter
if ($field['filter']) {
$output .= "\r\n\t\t" . '<p class="filter"><input type="text" value="" placeholder="' . esc_attr__('Filter: start typing...', 'webman-amplifier') . '" class="filter-text" /></p>';
}
$output .= "\r\n\t" . '</th><td>';
// Input field
if (is_array($field['options']) && !empty($field['options'])) {
$i = 0;
$output .= "\r\n\t" . '<div class="radio-items">';
foreach ($field['options'] as $option_value => $option) {
$i++;
$output .= "\r\n\t\t";
$output .= !$field['inline'] ? '<p class="radio-item"' : '<span class="radio-item inline-radio"';
$output .= ' data-value="' . esc_attr($option_value) . '">';
$checked = trim(checked($value, $option_value, false) . ' /');
$option = trim(strip_tags($option, WM_METABOX_LABEL_HTML));
if (!trim($field['custom'])) {
$output .= '<input type="' . esc_attr($field['type']) . '" name="' . esc_attr($field['id']) . '" id="' . esc_attr($field['id'] . '-' . $i) . '" value="' . esc_attr($option_value) . '" title="' . esc_attr($option) . '" class="fieldtype-radio" ' . $checked . '> ';
$output .= '<label for="' . esc_attr($field['id'] . '-' . $i) . '">' . $option . '</label>';
} else {
$output .= '<label for="' . esc_attr($field['id'] . '-' . $i) . '">' . trim(str_replace(array('{{value}}', '{{name}}'), array($option_value, $option), $field['custom'])) . '</label>';
$output .= '<input type="' . esc_attr($field['type']) . '" name="' . esc_attr($field['id']) . '" id="' . esc_attr($field['id'] . '-' . $i) . '" value="' . esc_attr($option_value) . '" title="' . esc_attr($option) . '" class="fieldtype-radio' . esc_attr($field['hide-radio']) . '" ' . $checked . '>';
}
$output .= !$field['inline'] ? '</p>' : '</span> ';
}
// /foreach
$output .= "\r\n\t" . '</div>';
}
// Reset default value button
if (trim($field['default'])) {
$output .= "\r\n\t\t" . '<a data-option="' . esc_attr($field['id']) . '" class="button-default-value" title="' . esc_attr__('Use a default value', 'webman-amplifier') . '"><span>' . esc_attr($field['default']) . '</span></a>';
}
echo $output;
// Conditional display
do_action('wmhook_metabox_' . 'conditional', $field, $field['id']);
echo "\r\n\t" . '</td></tr>';
}
示例10: wma_modules_cp_columns_render
function wma_modules_cp_columns_render($column)
{
//Helper variables
global $post;
$prefix = 'wmamp-';
$suffix = '-wm_modules';
//Columns renderers
switch ($column) {
case $prefix . 'link' . $suffix:
$link = esc_url(stripslashes(wma_meta_option('link')));
echo '<a href="' . $link . '" target="_blank">' . $link . '</a>';
break;
case $prefix . 'slug' . $suffix:
echo $post->post_name;
break;
case $prefix . 'tag' . $suffix:
$separator = '';
$terms = get_the_terms($post->ID, 'module_tag');
if (!is_wp_error($terms) && !empty($terms)) {
foreach ($terms as $term) {
$termName = isset($term->name) ? $term->name : null;
echo $separator . $termName;
$separator = ', ';
}
}
break;
case $prefix . 'thumb' . $suffix:
$size = apply_filters('wmhook_wmamp_' . 'cp_admin_thumb_size', 'admin-thumbnail');
$image = has_post_thumbnail() ? get_the_post_thumbnail(null, $size) : '';
$fontIcon = wma_meta_option('icon-font');
$iconColor = wma_meta_option('icon-color');
$iconBgColor = wma_meta_option('icon-color-background');
$styleIcon = $iconColor ? ' style="color: ' . $iconColor . '"' : '';
$styleContainer = $iconBgColor ? ' style="background-color: ' . $iconBgColor . '"' : '';
if ($fontIcon) {
$image = '<i class="' . $fontIcon . '"' . $styleIcon . '></i>';
}
$hasThumb = $image ? ' has-thumb' : ' no-thumb';
echo '<span class="wm-image-container' . $hasThumb . '"' . $styleContainer . '>';
if (get_edit_post_link()) {
edit_post_link($image);
} else {
echo '<a href="' . get_permalink() . '">' . $image . '</a>';
}
echo '</span>';
break;
default:
break;
}
// /switch
}
示例11: apply_filters
* can lay out the sidebar in Sections shortcodes (rows) with columns and
* widget area shortcodes (set class of "sidebar" for widget area shortcode).
*
* @package WebMan WordPress Theme Framework
* @copyright 2014 WebMan - Oliver Juhas
*
* @since 1.0
* @version 1.1.1
*/
/**
* Helper variables
*/
$content_area_class = '';
$sidebar_none_posts = apply_filters('wmhook_sidebar_none_posts', array('wm_projects', 'page'));
$sidebar_none_posts = is_singular($sidebar_none_posts);
if (function_exists('wma_meta_option') && 'sections' == wma_meta_option('sidebar')) {
$sections_layout = true;
} else {
$sections_layout = false;
}
/**
* Sidebar implementation
*
* Variables setup
*/
$sidebar = wm_sidebar_setup();
/**
* Actual page/post output
*/
if (!$sections_layout) {
echo "\r\n\r\n" . '<div class="wrap-inner">';
示例12: esc_attr
// Item_class
$helper['item_class'] = esc_attr('wm-posts-item wm-posts-item-' . $post_id . ' wm-column width-1-' . $atts['columns'] . $atts['no_margin'] . $alt);
if ((!$atts['no_margin'] || ' with-margin' === $atts['no_margin']) && !$atts['filter'] && !$atts['scroll'] && !$masonry_layout && $i % $atts['columns'] === 0) {
$helper['item_class'] .= ' last';
}
if ($atts['filter'] && isset($filter_settings[0])) {
$terms = get_the_terms($post_id, $filter_settings[0]);
if (!is_wp_error($terms) && !empty($terms)) {
foreach ($terms as $term) {
$helper['item_class'] .= ' ' . $filter_settings[0] . '-' . $term->slug;
}
}
}
// Link
$helper['link'] = '';
$link_atts = array(wma_meta_option('link-page', $post_id), wma_meta_option('link', $post_id), wma_meta_option('link-action', $post_id));
if ('wm_projects' == $atts['post_type'] && !$link_atts[2]) {
$helper['link'] = ' href="' . esc_url(get_permalink()) . '"';
} elseif ($link_atts[0]) {
$page_object = get_page_by_path($link_atts[0]);
$helper['link'] = $page_object ? ' href="' . esc_url(get_permalink($page_object->ID)) . '"' : '#';
} elseif ($link_atts[1]) {
$helper['link'] = ' href="' . esc_url($link_atts[1]) . '"';
} else {
$helper['link'] = ' href="' . esc_url(get_permalink()) . '"';
}
if (('wm_staff' == $atts['post_type'] || 'wm_logos' == $atts['post_type']) && !$link_atts[0] && !$link_atts[1]) {
$helper['link'] = '';
}
if ($helper['link'] && $link_atts[2]) {
$helper['link'] .= in_array($link_atts[2], array('_self', '_blank')) ? ' target="' . esc_attr($link_atts[2]) . '"' : ' data-target="' . esc_attr($link_atts[2]) . '"';
示例13: array
$images = array();
if (is_array($media_shortcode[1])) {
$images = $media_shortcode[1];
} else {
$posts_images = wm_get_post_images();
foreach ($posts_images as $image) {
$images[] = $image['id'];
}
}
if (is_array($images) && !empty($images)) {
echo do_shortcode(apply_filters('wmhook_post_format_gallery_slideshow_shortcode', '[wm_slideshow ids="' . implode(',', $images) . '" nav="pagination" size="' . $image_size . '" speed="4000" /]'));
}
}
}
//If no gallery, display featured image (also, always display featured image on single post page)
if ($is_single && !apply_filters('wmhook_disable_single_featured_image', false) && !(function_exists('wma_meta_option') && wma_meta_option('disable-featured-image')) && !$pagination_suffix) {
echo wm_thumb(array('attr-link' => wm_schema_org('image'), 'class' => 'image-container post-thumbnail scale-rotate', 'link' => 'bigimage', 'size' => 'content-width'));
} elseif (!$is_single && (!$media_shortcode[0] || !function_exists('wma_amplifier'))) {
echo wm_thumb(array('attr-link' => wm_schema_org('image'), 'class' => 'image-container post-thumbnail scale-rotate', 'link' => get_permalink(), 'size' => $image_size));
}
?>
</div>
<?php
/**
* Post title
*/
wm_post_title();
/**
* Post content
*/
示例14: array
*
* Simple wm_projects item template
* Consist of:
* image,
* title
*
* @package WebMan Amplifier
* @subpackage Shortcodes
*
* @uses array $helper Contains shortcode $atts array plus additional helper variables.
*/
$link_output = array('', '');
if ($helper['link']) {
$link_output = array('<a' . $helper['link'] . wm_schema_org('bookmark') . '>', '</a>');
}
$project_preview = trim(wma_meta_option('slider'));
?>
<article class="<?php
echo $helper['item_class'];
?>
"<?php
echo wm_schema_org('creative_work');
?>
>
<?php
if ($project_preview) {
echo '<div class="wm-posts-element wm-html-element slider">';
echo $link_output[0] . do_shortcode($project_preview) . $link_output[1];
echo '</div>';
示例15: wm_schema_org
echo '</' . $helper['atts']['heading_tag'] . '>';
?>
</div>
<?php
if (has_post_thumbnail($helper['post_id'])) {
echo '<div class="wm-posts-element wm-html-element image image-container"' . wm_schema_org('image') . '>';
echo $link_output[0];
the_post_thumbnail($helper['image_size'], array('title' => esc_attr(get_the_title(get_post_thumbnail_id($helper['post_id'])))));
echo $link_output[1];
echo '</div>';
}
?>
<?php
$staff_contacts = wma_meta_option('contacts', $helper['post_id']);
if ($staff_contacts && is_array($staff_contacts)) {
$output_contacts = '';
foreach ($staff_contacts as $contact) {
if (!isset($contact['icon']) || !trim($contact['icon'])) {
continue;
}
if (!isset($contact['title'])) {
$contact['title'] = '';
}
if (!isset($contact['link'])) {
$contact['link'] = '';
}
$title_attr = $contact['title'] ? ' title="' . esc_attr(strip_tags($contact['title'])) . '"' : '';
$output_contacts .= '<li class="contacts-item"' . wm_schema_org('itemprop="contactPoint"') . '>';
if ($contact['link']) {