function html_field_display($title = '', $class = '', $info_contents = '') { if ($info_contents == '') { return; } if ($title != '') { $info = jacket_core_html_tag(array('tag' => 'strong', 'tag_content' => $title . ':', 'tag_content_after' => $info_contents, 'return' => true)); } else { $info = $info_contents; } jacket_core_html_tag(array('tag' => 'div', 'class' => $class, 'tag_content' => $info, 'tag_content_after' => "\n")); echo $contents; }
function column_shortcode($atts, $content = null) { extract(shortcode_atts(array('width' => '0', 'padding' => '0', 'style' => false, 'class' => ''), $atts)); $content = column_clean_shortcode_content($content); $column_defaults = array('tag' => 'div', 'tag_content' => $content, 'class' => 'column- ' . $class, 'return' => true); if (!$style) { $column_defaults['style'] = 'width:' . $width . '; float: left; padding-right: ' . $padding . '; display: inline;'; } else { $column_defaults['style'] = $style; } if ($width == 0 && $padding == 0) { unset($column_defaults['style']); } return jacket_core_html_tag($column_defaults); }
function list_pages_shortcode($atts, $content = null) { // Defaults $the_toc_arr_defaults = array('depth' => 0, 'show_date' => false, 'date_format' => get_option('date_format'), 'child_of' => get_the_id(), 'exclude' => false, 'include' => false, 'title_li' => '', 'authors' => false, 'sort_column' => 'menu_order, post_title', 'link_before' => false, 'link_after' => false, 'exclude_tree' => false, 'toc_container_tag' => 'div', 'toc_container_class' => 'list-pages-container', 'toc_title_tag' => 'h3', 'toc_title_class' => 'list-pages-title', 'toc_title_text' => 'Contents', 'toc_wrapper_tag' => 'ul'); $toc_settings = array(); $toc_query = array(); $the_toc_arr = shortcode_atts($the_toc_arr_defaults, $atts); foreach ($the_toc_arr as $the_toc_key => $the_toc_value) { if (!$the_toc_value && $the_toc_key != 'title_li') { continue; } if (!strstr($the_toc_key, 'toc')) { $toc_query[$the_toc_key] = $the_toc_value; } else { $toc_settings[$the_toc_key] = $the_toc_value; } } if (isset($toc_settings['toc_title_text'])) { $toc_title_defaults = array('tag' => $toc_settings['toc_title_tag'], 'tag_content' => $toc_settings['toc_title_text'], 'return' => true); if (isset($toc_settings['toc_title_class'])) { $toc_title_defaults['class'] = $toc_settings['toc_title_class']; } $toc_title = jacket_core_html_tag($toc_title_defaults); } // Never Echo $toc_query['echo'] = 0; $toc_list = wp_list_pages($toc_query); $toc = jacket_core_html_tag(array('tag' => $toc_settings['toc_wrapper_tag'], 'tag_content' => $toc_list, 'return' => true)); if (isset($toc_settings['toc_container_tag'])) { $toc_defaults = array('tag' => $toc_settings['toc_container_tag'], 'return' => true); if (isset($toc_settings['container_class'])) { $toc_defaults['class'] = $toc_settings['toc_container_class']; } $toc_defaults['tag_content'] = $toc_title . $toc; $contents = jacket_core_html_tag($toc_defaults); } else { $contents = $toc_title . $toc; } return $contents; }
function jacket_core_form_input() { $arg_list = func_get_args(); if (!is_array($arg_list[0])) { return; } $input_tag = array('tag_type' => 'single', 'tag' => 'input', 'id' => $arg_list[0]['name'], 'name' => $arg_list[0]['name'], 'class' => 'input-' . $arg_list[0]['name'] . '-', 'type' => $arg_list[0]['type'], 'value' => $arg_list[0]['value'], 'return' => $arg_list[0]['return']); if (isset($arg_list[1]) && is_array($arg_list[1])) { $input_tag = array_merge($input_tag, $arg_list[1]); } if ($arg_list[0]['return'] == true) { return jacket_core_html_tag($input_tag); } jacket_core_html_tag($input_tag); }
/** * Post List Events * * Formats date output for posts using "The Event Calendar" WordPress plugin. * * @since 1.0 * @echo string */ function the_events_abbr($the_postid, $the_event_meta, $the_date, $the_date_class) { $event_start_date = date('Y-m-d', strtotime(get_post_meta($the_postid, $the_event_meta, true))); $event_start_time = date('H:i:sO', strtotime(get_post_meta($the_postid, $the_event_meta, true))); $the_event = jacket_core_html_tag(array('tag' => 'abbr', 'class' => $the_date_class, 'title' => $event_start_date . 'T' . $event_start_time, 'tag_content' => $the_date, 'return' => true)); return $the_event; }
/** * Custom Query Shortcode * * Uses WordPress shortcode api to insert a custom query into contant areas with shortcode support. * Format is [list-posts] using standard WP_Query arguments [list-posts more=1 tag='tag' category_name='category' cat=cat_num gs_content=number] * qs_more can be set to 0 to ignore the more separator * qs_content value with shorten the content area to number of characters and HTML for the_content is stripped out. A 0 value excludes content. * qs_thumbnail value other than false will include the post thumbnail * qs_container_style to set the style attribute for container * qs_container_class to set the class attribute for container * qs_template formats the li output { = <div>, } = </div> and use terms %title%, %date%, %thumbnail%, %content% * * Currently accespet WP_Query values are: * posts_per_page, tag, cat, category_name * * @since 1.0 * @echo string */ function custom_query_shortcode($atts) { global $more, $wp_query, $posts, $post; // Defaults $qs_query_arr = shortcode_atts(array('qs_title_tag' => 'div', 'qs_more' => 1, 'qs_content' => 0, 'qs_thumbnail' => false, 'qs_container_style' => false, 'qs_container_class' => false, 'qs_template' => '%title% %date% %thumbnail% %content%', 'posts_per_page' => -1, 'tag' => false, 'cat' => false, 'category_name' => false, 'category__not_in' => false), $atts); foreach ($qs_query_arr as $qs_query_key => $qs_query_value) { if ($qs_query_value == false) { unset($qs_query_arr[$qs_query_key]); continue; } if (strstr($qs_query_key, 'qs_')) { $the_query_arr[$qs_query_key] = $qs_query_value; if ($qs_query_key == 'category__not_in') { $the_query_arr['category__not_in'] = explode(',', $qs_query_arr['category__not_in']); } unset($qs_query_arr[$qs_query_key]); } } $the_query_custom = new WP_Query($qs_query_arr); $more = $the_query_arr['qs_more']; $the_query_custom->in_the_loop = true; if ($the_query_custom->have_posts()) { $list_posts_container_defaults = array('tag_type' => 'open', 'tag' => 'div', 'class' => 'list-posts-container', 'return' => true); if (isset($the_query_arr['qs_container_style'])) { $list_posts_container_defaults['style'] = $the_query_arr['qs_container_style']; } if (isset($the_query_arr['qs_container_class'])) { $list_posts_container_defaults['class'] .= ' ' . $the_query_arr['qs_container_class']; } $output = jacket_core_html_tag($list_posts_container_defaults); $output .= jacket_core_html_tag(array('tag_type' => 'open', 'tag' => 'ul', 'class' => 'list-posts-list', 'return' => true)); while ($the_query_custom->have_posts()) { $the_query_custom->the_post(); setup_postdata($the_query_custom->post); // Thumbnail $thumbnail = ''; if (isset($the_query_arr['qs_thumbnail'])) { if (!empty($the_query_arr['qs_thumbnail'])) { list($t_height, $t_width) = split('x', $the_query_arr['qs_thumbnail']); if (empty($t_height)) { $t_height = $t_width; } if (empty($t_width)) { $t_width = $t_height; } if (is_numeric($t_height) && is_numeric($t_width)) { $t_size = array($t_height, $t_width); } else { $t_size = $the_query_arr['qs_thumbnail']; } $thumbnail = fnbx_get_the_post_thumbnail($the_query_custom->post->ID, $t_size); } else { $thumbnail = fnbx_get_the_post_thumbnail(); } } // Content $content = ''; if (!empty($the_query_arr['qs_content']) || $the_query_arr['qs_content'] != 0) { $this_content = get_the_content(); $this_content = strip_shortcodes($this_content); // Strip http:// urls incase of oembeds $this_content = preg_replace('/\\b(https?|ftp|file):\\/\\/[-A-Z0-9+&@#\\/%?=~_|$!:,.;]*[A-Z0-9+&@#\\/%=~_|$]/i', '', $this_content); $this_content = strip_tags($this_content); $this_content_length = intval($the_query_arr['qs_content']); // Trim to word length. $this_content = wp_trim_words($this_content, $this_content_length); $content = jacket_core_html_tag(array('tag' => 'div', 'class' => 'list-posts-item-content', 'tag_content' => $this_content . '...', 'return' => true)); } else { $more = 0; $this_content = get_the_content('Read more »'); $content = jacket_core_html_tag(array('tag' => 'div', 'class' => 'list-posts-item-content', 'tag_content' => $this_content, 'return' => true)); } // Title $temp_title = get_the_title($the_query_custom->post->ID); $entry_title_link = jacket_core_html_tag(array('tag' => 'a', 'class' => 'permalink', 'title' => $temp_title, 'href' => get_permalink($the_query_custom->post->ID), 'tag_content' => $temp_title, 'return' => true)); $title = jacket_core_html_tag(array('tag' => $the_query_arr['qs_title_tag'], 'class' => 'list-posts-item-title', 'tag_content' => $entry_title_link, 'return' => true)); // Date $temp_date = mysql2date(get_option('date_format'), $the_query_custom->post->post_date) . ' at ' . get_the_time('', $the_query_custom->post->ID); $temp_date_abbr = jacket_core_html_tag(array('tag' => 'abbr', 'class' => 'published', 'title' => get_the_time('Y-m-d', $the_query_custom->post->ID) . 'T' . get_the_time('H:i:sO', $the_query_custom->post->ID), 'tag_content' => $temp_date, 'return' => true)); $date = jacket_core_html_tag(array('tag' => 'div', 'class' => 'list-posts-item-date', 'tag_content' => $temp_date_abbr, 'return' => true)); $output .= jacket_core_html_tag(array('tag' => 'li', 'tag_type' => 'open', 'class' => 'list-posts-item', 'return' => true)); // $output .= $title . $date. $thumbnail . $content; $t_search = array('{', '}', '%title%', '%thumbnail%', '%date%', '%content%'); $t_replace = array('<div>', '</div>', $title, $thumbnail, $date, $content); $t_result = str_replace($t_search, $t_replace, $the_query_arr['qs_template']); $output .= $t_result . $ttest; $output .= jacket_core_html_tag(array('tag' => 'li', 'tag_type' => 'close', 'return' => true)); } $output .= jacket_core_html_tag(array('tag_type' => 'close', 'tag' => 'ul', 'return' => true)); $output .= jacket_core_html_tag(array('tag_type' => 'close', 'tag' => 'div', 'return' => true)); } return $output; }