本文整理汇总了PHP中shortcode_atts函数的典型用法代码示例。如果您正苦于以下问题:PHP shortcode_atts函数的具体用法?PHP shortcode_atts怎么用?PHP shortcode_atts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shortcode_atts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render($atts)
{
$this->block_uid = td_global::td_generate_unique_id();
//update unique id on each render
extract(shortcode_atts(array('limit' => 3, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'show_child_cat' => '', 'tag_slug' => '', 'header_color' => ''), $atts));
$buffy = '';
//output buffer
$td_unique_id = td_global::td_generate_unique_id();
$td_query =& td_data_source::get_wp_query($atts);
//by ref do the query
//get the js for this block
$buffy .= $this->get_block_js($atts, $td_query);
$buffy .= '<div class="td_block_wrap td_block7">';
//get the block title
$buffy .= $this->get_block_title($atts);
//get the sub category filter for this block
$buffy .= $this->get_block_sub_cats($atts, $td_unique_id);
$buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
//inner content of the block
$buffy .= $this->inner($td_query->posts);
$buffy .= '</div>';
//get the ajax pagination for this block
$buffy .= $this->get_block_pagination($atts, $td_unique_id);
$buffy .= '</div> <!-- ./block1 -->';
return $buffy;
}
示例2: tt_event_hours
function tt_event_hours($atts, $content)
{
extract(shortcode_atts(array("title" => "Event Hours", "time_format" => "H.i", "class" => "", "hour_category" => "", "text_color" => "", "border_color" => "", "columns" => ""), $atts));
if ($hour_category != null && $hour_category != "-") {
$hour_category = array_values(array_diff(array_filter(array_map('trim', explode(",", $hour_category))), array("-")));
}
if ($columns != "") {
$weekdays_explode = explode(",", $columns);
$weekdays_in_query = "";
foreach ($weekdays_explode as $weekday_explode) {
$weekdays_in_query .= "'" . $weekday_explode . "'" . ($weekday_explode != end($weekdays_explode) ? "," : "");
}
}
global $wpdb;
global $post;
//The actual fields for data entry
$query = "SELECT * FROM `" . $wpdb->prefix . "event_hours` AS t1 LEFT JOIN {$wpdb->posts} AS t2 ON t1.weekday_id=t2.ID \r\n\t\tWHERE t1.event_id='" . $post->ID . "'";
if ($hour_category != null && $hour_category != "-") {
$query .= "\r\n\t\t\tAND t1.category IN('" . join("','", $hour_category) . "')";
}
if ($weekdays_in_query != "") {
$query .= " AND t2.post_name IN(" . $weekdays_in_query . ")";
}
$query .= " ORDER BY t2.menu_order, t1.start, t1.end";
$event_hours = $wpdb->get_results($query);
$event_hours_count = count($event_hours);
if ($event_hours_count) {
//get weekdays
$query = "SELECT ID, post_title FROM {$wpdb->posts}\r\n\t\t\t\tWHERE \r\n\t\t\t\tpost_type='timetable_weekdays'\r\n\t\t\t\tORDER BY menu_order";
$weekdays = $wpdb->get_results($query);
$output = '';
if ($title != "") {
$output .= '<h3 class="tt_event_margin_top_27">' . $title . '<span class="tt_event_hours_count">(' . $event_hours_count . ')</span></h3>';
}
$output .= '
<ul id="event_hours_list" class="timetable_clearfix tt_event_hours' . ($class != "" ? ' ' . $class : '') . '">';
for ($i = 0; $i < $event_hours_count; $i++) {
//get event color
if ($border_color == "") {
$border_color = "#" . get_post_meta($event_hours[$i]->event_id, "timetable_color", true);
}
//get day by id
$current_day = get_post($event_hours[$i]->weekday_id);
$output .= '<li' . ($border_color != "" ? ' style="border-left-color:' . $border_color . ';"' : '') . ' id="event_hours_' . $event_hours[$i]->event_hours_id . '" class="event_hours_' . ($i % 2 == 0 ? 'left' : 'right') . '"><h4' . ($text_color != "" ? ' style="color:' . $text_color . ';"' : '') . '>' . $current_day->post_title . '</h4><h4' . ($text_color != "" ? ' style="color:' . $text_color . ';"' : '') . '>' . date($time_format, strtotime($event_hours[$i]->start)) . ' - ' . date($time_format, strtotime($event_hours[$i]->end)) . '</h4>';
if ($event_hours[$i]->before_hour_text != "" || $event_hours[$i]->after_hour_text != "") {
$output .= '<p' . ($text_color != "" ? ' style="color:' . $text_color . ';"' : '') . ' class="tt_event_padding_bottom_0">';
if ($event_hours[$i]->before_hour_text != "") {
$output .= $event_hours[$i]->before_hour_text;
}
if ($event_hours[$i]->after_hour_text != "") {
$output .= ($event_hours[$i]->before_hour_text != "" ? '<br>' : '') . $event_hours[$i]->after_hour_text;
}
$output .= '</p>';
}
$output .= '</li>';
}
$output .= '</ul>';
}
return $output;
}
示例3: st_vc_single_search
function st_vc_single_search($attr, $content = false)
{
$data = shortcode_atts(array('st_list_form' => '', 'st_style_search' => 'style_1', 'st_direction' => 'horizontal', 'st_box_shadow' => 'no', 'st_search_tabs' => 'yes', 'st_title_search' => '', 'field_size' => '', 'active' => 1), $attr, 'st_single_search');
extract($data);
$txt = st()->load_template('vc-elements/st-single-search/search', 'form', array('data' => $data));
return $txt;
}
示例4: content
protected function content($atts, $content = null)
{
$title = $address = $size = $zoom = $pin_image = $type = $el_position = $width = $el_class = '';
extract(shortcode_atts(array('title' => '', 'full_width' => '', 'address' => '', 'size' => 200, 'zoom' => 14, 'pin_image' => '', 'type' => 'm', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
$output = '';
if ($address == '') {
return null;
}
$el_class = $this->getExtraClass($el_class);
$width = wpb_translateColumnWidthToSpan($width);
$size = str_replace(array('px', ' '), array('', ''), $size);
$map_coords = map_embed($address);
$img_url = wp_get_attachment_image_src($pin_image, 'full');
if ($full_width == "yes") {
$output .= "\n\t" . '<div class="wpb_gmaps_widget full-width wpb_content_element ' . $width . $el_class . '">';
} else {
$output .= "\n\t" . '<div class="wpb_gmaps_widget wpb_content_element ' . $width . $el_class . '">';
}
$output .= "\n\t\t" . '<div class="wpb_wrapper">';
$output .= $title != '' ? "\n\t\t\t" . '<h3 class="wpb_heading wpb_video_heading">' . $title . '</h3>' : '';
$output .= '<div class="wpb_map_wraper"><div class="map-canvas" style="width:100%;height:' . $size . 'px;" data-address="' . $address . '" data-lat="' . $map_coords['lat'] . '" data-long="' . $map_coords['long'] . '" data-zoom="' . $zoom . '" data-maptype="' . $type . '" data-pinimage="' . $img_url[0] . '"></div></div>';
$output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper');
$output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
$output = $this->startRow($el_position) . $output . $this->endRow($el_position);
global $include_maps;
$include_maps = true;
return $output;
}
示例5: wolf_columns_shortcode
/**
* Columns shortcode
*
* @param array $atts
* @param string $content
* @return string
*/
function wolf_columns_shortcode($atts, $content = null)
{
// if ( class_exists( 'Vc_Manager' ) && function_exists( 'vc_map_get_attributes' ) ) {
// $atts = vc_map_get_attributes( 'wolf_column', $atts );
// }
extract(shortcode_atts(array('col' => 'col-6', 'class' => '', 'first' => '', 'last' => '', 'inline_style' => ''), $atts));
$col = esc_attr($col);
$first = esc_attr($first);
$last = esc_attr($last);
$col = esc_attr($col);
$inline_style = sanitize_text_field($inline_style);
$output = '';
$style = '';
$class = $class ? "{$class} " : '';
// add space
if ($inline_style) {
$style .= $inline_style;
}
$style = $style ? " style='{$style}'" : '';
if ($first) {
$class = 'first';
} elseif ($last) {
$class = 'last';
}
if ($class == 'first') {
$output .= '<div class="clear"></div>';
}
$output .= '<div class="' . $col . ' ' . $class . '"' . $style . '>' . do_shortcode($content) . '</div>';
if ($class == 'last') {
$output .= '<div class="clear"></div>';
}
return $output;
}
示例6: calltoaction_sc
function calltoaction_sc($atts, $content = '')
{
extract(shortcode_atts(array("link" => '', "class" => '', "title" => 'Call to actions'), $atts));
$href = '';
if ($link) {
$href = 'href="' . $link . '"';
}
$classes = "btn";
if ($class) {
$classes .= ' ' . $class;
}
$classes = 'class="' . $classes . '"';
ob_start();
?>
<div class="row">
<div class="twelve col text-center">
<?php
echo do_shortcode($content);
?>
<a <?php
echo $href . ' ' . $classes;
?>
><?php
echo $title;
?>
</a>
</div>
</div>
<?php
$data = ob_get_clean();
return $data;
}
示例7: sc_embed_player_templater1_handler
function sc_embed_player_templater1_handler($atts)
{
extract(shortcode_atts(array('fileurl' => '', 'autoplay' => '', 'volume' => '', 'class' => '', 'loops' => ''), $atts));
if (empty($fileurl)) {
return '<div style="color:red;font-weight:bold;">Compact Audio Player Error! You must enter the mp3 file URL via the "fileurl" parameter in this shortcode. Please check the documentation and correct the mistake.</div>';
}
if (empty($class)) {
$class = "sc_fancy_player_container";
//Set default container class
}
if (empty($autoplay)) {
//Set autoplay value
$autoplay = "";
} else {
$autoplay = "on";
}
if (empty($loops)) {
//Set the loops value
$loops = "";
} else {
$loops = "on";
}
$args = array('src' => $fileurl, 'loop' => $loops, 'autoplay' => $autoplay, 'preload' => 'none');
$player_container = "";
$player_container .= '<div class="' . $class . '">';
$player_container .= wp_audio_shortcode($args);
$player_container .= '</div>';
return $player_container;
}
示例8: jigoshop_product_tag
function jigoshop_product_tag($attributes)
{
global $paged;
$jigoshop_options = Jigoshop_Base::get_options();
$attributes = shortcode_atts(array('tag' => '', 'per_page' => $jigoshop_options->get('jigoshop_catalog_per_page'), 'columns' => $jigoshop_options->get('jigoshop_catalog_columns'), 'orderby' => $jigoshop_options->get('jigoshop_catalog_sort_orderby'), 'order' => $jigoshop_options->get('jigoshop_catalog_sort_direction'), 'pagination' => false, 'tax_operator' => 'IN'), $attributes);
if (isset($_REQUEST['tag'])) {
$attributes['tag'] = $_REQUEST['tag'];
}
/** Operator validation. */
if (!in_array($attributes['tax_operator'], array('IN', 'NOT IN', 'AND'))) {
$tax_operator = 'IN';
}
/** Multiple category values. */
if (!empty($slug)) {
$slug = explode(',', esc_attr($slug));
$slug = array_map('trim', $slug);
}
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $attributes['per_page'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order'], 'paged' => $paged, 'meta_query' => array(array('key' => 'visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'tax_query' => array(array('taxonomy' => 'product_tag', 'field' => 'slug', 'terms' => $attributes['tag'], 'operator' => $attributes['tax_operator'])));
query_posts($args);
ob_start();
jigoshop_get_template_part('loop', 'shop');
if ($attributes['pagination']) {
do_action('jigoshop_pagination');
}
wp_reset_query();
return ob_get_clean();
}
示例9: do_shortcode
function do_shortcode($attrs)
{
$attrs = shortcode_atts(array('url' => '', 'width' => '620', 'height' => '378', 'stream' => TRUE, 'chat_width' => '620', 'chat_height' => '400', 'chat' => FALSE, 'autoplay' => TRUE), $attrs);
if (empty($attrs['url'])) {
return '';
}
$api_core = new LSB_API_Core();
$stream_summaries = $api_core->validate_urls(array($attrs['url']));
$stream_summary = !empty($stream_summaries) ? $stream_summaries[0] : NULL;
/** @var $stream_summary LSB_Stream_Summary */
if (empty($stream_summary)) {
return '';
}
$view = NULL;
switch ($stream_summary->api_id) {
case 'twitch':
$view = new LSB_Embedded_Twitch_View();
break;
}
if (empty($view)) {
return '';
}
$attrs['stream_summary'] = $stream_summary;
return $view->get_html($attrs);
}
示例10: icon_list_item_shortcode
function icon_list_item_shortcode($atts, $content = null)
{
$icon_type = $icon_img = $img_width = $icon = $icon_color = $icon_color_bg = $icon_size = $icon_style = $icon_border_style = $icon_border_radius = $icon_color_border = $icon_border_size = $icon_border_spacing = $icon_link = $el_class = $icon_animation = $tooltip_disp = $tooltip_text = $icon_margin = '';
extract(shortcode_atts(array('icon_type' => 'selector', 'icon' => '', 'icon_img' => '', 'icon_color' => '#333333', 'icon_style' => 'none', 'icon_color_bg' => '#ffffff', 'icon_color_border' => '#333333', 'icon_border_style' => '', 'icon_border_size' => '1', 'icon_border_radius' => '500', 'icon_border_spacing' => '50', "icon_size" => "", "icon_margin" => "", 'el_class' => ''), $atts));
global $vc_list_icon_size, $vc_list_icon_margin;
if (empty($icon_size)) {
$icon_size = $vc_list_icon_size;
}
if (empty($icon_margin)) {
$icon_margin = $vc_list_icon_margin;
}
if ($icon_animation !== 'none') {
$css_trans = 'data-animation="' . $icon_animation . '" data-animation-delay="03"';
}
$output = $style = $link_sufix = $link_prefix = $target = $href = $icon_align_style = '';
if ($icon_margin !== '') {
$style .= 'margin-right:' . $icon_margin . 'px;';
}
$icon_animation = $icon_link = '';
$output .= '<div class="uavc-list-content">';
if ($icon !== "" || $icon_img !== '') {
if ($icon_type == 'custom') {
$icon_style = 'none';
}
$main_icon = do_shortcode('[just_icon icon_type="' . $icon_type . '" icon="' . $icon . '" icon_img="' . $icon_img . '" img_width="' . $icon_size . '" icon_size="' . $icon_size . '" icon_color="' . $icon_color . '" icon_style="' . $icon_style . '" icon_color_bg="' . $icon_color_bg . '" icon_color_border="' . $icon_color_border . '" icon_border_style="' . $icon_border_style . '" icon_border_size="' . $icon_border_size . '" icon_border_radius="' . $icon_border_radius . '" icon_border_spacing="' . $icon_border_spacing . '" icon_link="' . $icon_link . '" icon_animation="' . $icon_animation . '"]');
$output .= "\n" . '<div class="uavc-list-icon ' . $el_class . '" ' . $css_trans . ' style="' . $style . '">';
$output .= $main_icon;
$output .= "\n" . '</div>';
}
$output .= '<span class="uavc-list-desc">' . do_shortcode($content) . '</span>';
$output .= '</div>';
$output = '<li>' . $output . '</li>';
return $output;
}
示例11: x_shortcode_toc_item
function x_shortcode_toc_item($atts)
{
extract(shortcode_atts(array('id' => '', 'class' => '', 'style' => '', 'title' => '', 'page' => ''), $atts, 'x_toc_item'));
$id = $id != '' ? 'id="' . esc_attr($id) . '"' : '';
$class = $class != '' ? 'x-toc-item ' . esc_attr($class) : 'x-toc-item';
$style = $style != '' ? 'style="' . $style . '"' : '';
$title = $title != '' ? $title : '';
switch ($page) {
case 0:
$page = '';
break;
case 1:
$page = '';
break;
default:
$page = $page;
if (get_post_status(get_the_ID()) == "draft") {
$page = '&page=' . $page;
} else {
$page = get_the_ID() == get_option('page_on_front') ? 'page/' . $page . '/' : $page . '/';
}
}
$link = esc_url(get_permalink());
$output = "<li {$id} class=\"{$class}\" {$style}><a href=" . $link . $page . " title=\"Go to {$title}\">" . $title . '</a></li>';
return $output;
}
示例12: content
/**
* @param $atts
* @param null $content
*
* @return mixed|void
*/
protected function content($atts, $content = null)
{
$key = '';
/**
* @var string $el_class
* @var string $post_type
* @var string $product_field_key
* @var string $order_field_key
* @var string $product_custom_key
* @var string $order_custom_key
* @var string $show_label
* @var string $align
*/
$atts = shortcode_atts(array('el_class' => '', 'post_type' => 'product', 'product_field_key' => 'sku', 'product_custom_key' => '', 'order_field_key' => 'order_number', 'order_custom_key' => '', 'show_label' => '', 'align' => ''), $atts);
extract($atts);
if ('product' === $post_type) {
$key = '_custom_' === $product_field_key ? $product_custom_key : $product_field_key;
} elseif ('order' === $post_type) {
$key = '_custom_' === $order_field_key ? $order_custom_key : $order_field_key;
}
if ('yes' === $show_label) {
$key .= '_labeled';
}
$css_class = 'vc_gitem-woocommerce vc_gitem-woocommerce-' . $post_type . '-' . $key . (strlen($el_class) ? ' ' . $el_class : '') . (strlen($align) ? ' vc_gitem-align-' . $align : '');
return '<div class="' . esc_attr($css_class) . '">' . '{{ woocommerce_' . $post_type . ':' . $key . ' }}' . '</div>';
}
示例13: output
/**
* Output the shortcode.
*
* @param array $atts
*/
public static function output($atts)
{
// Check cart class is loaded or abort
if (is_null(WC()->cart)) {
return;
}
extract(shortcode_atts(array(), $atts));
global $post;
if (!empty($_REQUEST['orderid']) && isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'woocommerce-order_tracking')) {
$order_id = empty($_REQUEST['orderid']) ? 0 : esc_attr($_REQUEST['orderid']);
$order_email = empty($_REQUEST['order_email']) ? '' : esc_attr($_REQUEST['order_email']);
if (!$order_id) {
echo '<p class="woocommerce-error">' . __('Please enter a valid order ID', 'woocommerce') . '</p>';
} elseif (!$order_email) {
echo '<p class="woocommerce-error">' . __('Please enter a valid order email', 'woocommerce') . '</p>';
} else {
$order = wc_get_order(apply_filters('woocommerce_shortcode_order_tracking_order_id', $order_id));
if ($order && $order->get_id() && $order_email) {
if (strtolower($order->get_billing_email()) == strtolower($order_email)) {
do_action('woocommerce_track_order', $order->get_id());
wc_get_template('order/tracking.php', array('order' => $order));
return;
}
} else {
echo '<p class="woocommerce-error">' . sprintf(__('Sorry, we could not find that order ID in our database.', 'woocommerce'), get_permalink($post->ID)) . '</p>';
}
}
}
wc_get_template('order/form-tracking.php');
}
示例14: osc_theme_dlitem
function osc_theme_dlitem($params, $content = null)
{
extract(shortcode_atts(array('heading' => ''), $params));
$out = '<dt>' . do_shortcode($heading) . '</dt>';
$out .= '<dd>' . do_shortcode($content) . '</dd>';
return $out;
}
示例15: product_cat_shortcode
/**
* Defines [show_categories] shortcode
*
* @global type $cat_shortcode_query
* @param type $atts
* @return string
*/
function product_cat_shortcode($atts)
{
global $cat_shortcode_query, $product_sort, $archive_template;
$cat_shortcode_query = array();
$cat_shortcode_query['current'] = 0;
$args = shortcode_atts(array('exclude' => array(), 'include' => array(), 'archive_template' => get_option('archive_template', 'default'), 'parent' => '', 'sort' => 0, 'shortcode_query' => 'yes'), $atts);
$div = '<div class="product-subcategories ' . $args['archive_template'] . ' ' . product_list_class('category-list') . '">';
$cats = get_terms('al_product-cat', $args);
$cat_shortcode_query['count'] = count($cats);
$cat_shortcode_query['enable'] = $args['shortcode_query'];
$product_sort = intval($args['sort']);
$inside = '';
if ($args['parent'] == '' && empty($args['include'])) {
$old_args = $args;
$args['parent'] = 0;
$cats = get_terms('al_product-cat', $args);
foreach ($cats as $cat) {
$inside .= get_product_category_template($args['archive_template'], $cat);
$cat_shortcode_query['current']++;
$inside .= get_sub_product_subcategories($args, $cat);
}
} else {
foreach ($cats as $cat) {
$inside .= get_product_category_template($args['archive_template'], $cat);
$cat_shortcode_query['current']++;
}
}
if (!empty($inside)) {
do_action('before_category_list', $archive_template);
$inside = $div . $inside;
$inside .= '</div>';
}
reset_row_class();
return $inside;
}