function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $text = apply_filters('widget_text_morelink', empty($instance['text']) ? '' : $instance['text'], $instance); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } ?> <div class="textwidget"><?php echo !empty($instance['filter']) ? wpautop($text) : $text; ?> </div> <?php if (!empty($instance['more_link']) && !empty($instance['more_link_text'])) { ?> <span class="sidebar-more"><a href="<?php echo $instance['more_link']; ?> "><?php echo $instance['more_link_text']; ?> </a></span> <?php } ?> <?php echo $after_widget; }
protected function check_get_post_response($response, $post_obj, $context = 'view') { $response = json_ensure_response($response); $response_data = $response->get_data(); $this->assertEquals($post_obj->ID, $response_data['ID']); $this->assertEquals($post_obj->post_name, $response_data['slug']); $this->assertEquals($post_obj->post_status, $response_data['status']); $this->assertEquals($post_obj->post_author, $response_data['author']); $this->assertArrayHasKey('parent', $response_data); $this->assertEquals(get_permalink($post_obj->ID), $response_data['link']); $this->assertEquals($post_obj->menu_order, $response_data['menu_order']); $this->assertEquals($post_obj->comment_status, $response_data['comment_status']); $this->assertEquals($post_obj->ping_status, $response_data['ping_status']); $this->assertEquals($post_obj->post_password, $response_data['password']); $this->assertEquals(is_sticky($post_obj->ID), $response_data['sticky']); // Check post parent. if ($post_obj->post_parent) { if (is_int($response_data['parent'])) { $this->assertEquals($post_obj->post_parent, $response_data['parent']); } else { $this->assertEquals($post_obj->post_parent, $response_data['parent']['ID']); $this->check_get_post_response($response_data['parent'], get_post($response_data['parent']['ID']), 'view-parent'); } } else { $this->assertEmpty($response_data['parent']); } // Check post format. $post_format = get_post_format($post_obj->ID); if (empty($post_format)) { $this->assertEquals('standard', $response_data['format']); } else { $this->assertEquals(get_post_format($post_obj->ID), $response_data['format']); } // Check post dates. if ($post_obj->post_date_gmt === '0000-00-00 00:00:00') { $this->assertNull($response_data['date']); $this->assertNull($response_data['date_gmt']); } else { $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_date), $response_data['date']); $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_date_gmt), $response_data['date_gmt']); } if ($post_obj->post_modified_gmt === '0000-00-00 00:00:00') { $this->assertNull($response_data['modified']); $this->assertNull($response_data['modified_gmt']); } else { $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_modified), $response_data['modified']); $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_modified_gmt), $response_data['modified_gmt']); } // Check filtered values. $this->assertEquals(get_the_title($post_obj->ID), $response_data['title']); // TODO: apply content filter for more accurate testing. $this->assertEquals(wpautop($post_obj->post_content), $response_data['content']); // TODO: apply excerpt filter for more accurate testing. $this->assertEquals(wpautop($post_obj->post_excerpt), $response_data['excerpt']); $this->assertEquals($post_obj->guid, $response_data['guid']); if ($context === 'edit') { $this->assertEquals($post_obj->post_content, $response_data['content_raw']); $this->assertEquals($post_obj->post_excerpt, $response_data['excerpt_raw']); } }
/** * Echo the widget content. * * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget */ function widget($args, $instance) { extract($args); //* Merge with defaults $instance = wp_parse_args((array) $instance, $this->defaults); echo $before_widget; if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; } $text = ''; if (!empty($instance['alignment'])) { $text .= '<span class="align' . esc_attr($instance['alignment']) . '">'; } $text .= get_avatar($instance['user'], $instance['size']); if (!empty($instance['alignment'])) { $text .= '</span>'; } if ('text' === $instance['author_info']) { $text .= $instance['bio_text']; } else { $text .= get_the_author_meta('description', $instance['user']); } $text .= $instance['page'] ? sprintf(' <a class="pagelink" href="%s">%s</a>', get_page_link($instance['page']), $instance['page_link_text']) : ''; //* Echo $text echo wpautop($text); //* If posts link option checked, add posts link to output if ($instance['posts_link']) { printf('<div class="posts_link posts-link"><a href="%s">%s</a></div>', get_author_posts_url($instance['user']), __('View My Blog Posts', 'genesis')); } echo $after_widget; }
/** * @see wm_add_notice */ public static function add_notice($message, $type = 'info', $title = null, $backtrace = false) { $message = rtrim(ucfirst(trim((string) $message)), '.') . '.'; $content = wpautop($title ? "<strong class=\"wm-notice-title\">{$title}</strong><br />{$message}" : $message); if (false !== $backtrace) { if (is_array($backtrace)) { $content .= self::get_backtrace($backtrace); } else { if ($stack = array_slice(debug_backtrace(), 2)) { if (true === $backtrace) { $content .= "<ol start=\"0\" class=\"wm-notice-backtrace\">"; foreach ($stack as $i => $backtrace) { $content .= "<li>" . self::get_backtrace($backtrace) . "</li>"; } $content .= "</ol>"; } else { if (isset($stack[$backtrace])) { $content .= self::get_backtrace($stack[$backtrace]); } } } } } self::$notices[] = "<div class=\"wm-notice notice {$type}\">{$content}</div>"; // Cache alerts until they're shown set_transient('wm_notices', self::$notices); }
public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } $numberposts = isset($instance['numberposts']) ? $instance['numberposts'] : 1; $termargs = array('post_type' => 'glossary', 'post_status' => 'publish', 'numberposts' => $numberposts, 'orderby' => 'rand'); if ($group = $instance['group']) { $termargs['tax_query'] = array(array('taxonomy' => 'wpglossarygroup', 'field' => 'slug', 'terms' => $group)); } $terms = get_posts($termargs); if ($terms && count($terms)) { echo '<ul class="wpglossary widget-list">'; foreach ($terms as $term) { setup_postdata($term); $title = '<a href="' . apply_filters('wpg_term_link', get_post_permalink($term->ID)) . '">' . get_the_title($term->ID) . '</a>'; $desc = ''; $display = $instance['display']; if ($display && $display != 'title') { $desc = $display == 'full' ? apply_filters('the_content', get_the_content(), $main = false) : wpautop(get_the_excerpt()); $desc = '<br>' . $desc; } echo '<li>' . $title . $desc . '</li>'; } wp_reset_postdata(); echo '</ul>'; } else { echo '<em>' . __('No terms available', 'wp-glossary') . '</em>'; } echo $after_widget; }
/** * The Shortcode */ function ebor_top_left_icon_block_shortcode($atts, $content = null) { extract(shortcode_atts(array('duration' => '1', 'icon' => '', 'delay' => '0', 'layout' => 'on-top'), $atts)); if ('behind' == $layout) { $output = ' <div class="process"> <div class="content wow fadeIn" data-wow-duration="' . esc_attr($duration) . 's" data-wow-delay="' . esc_attr($delay) . 's"> <span class="icon"> <i class="' . esc_attr($icon) . '"></i> </span> ' . wpautop(do_shortcode(htmlspecialchars_decode($content))) . ' </div> </div> '; } else { $output = ' <div class="services"> <div class="service wow fadeInUp" data-wow-duration="' . esc_attr($duration) . 's" data-wow-delay="' . esc_attr($delay) . 's"> <span class="icon icon-s"> <i class="' . esc_attr($icon) . '"></i> </span> ' . wpautop(do_shortcode(htmlspecialchars_decode($content))) . ' </div> </div> '; } return $output; }
function format_custom_field($field, $format = '', $date_format = 'F j, Y') { $fetch = get_post_custom_values($field); $fetch = $fetch[0]; // Test if anything was fetched or return false. if (!$fetch) { return false; } switch ($format) { case 'date': return date($date_format, $fetch); break; case 'text_block': return wpautop($fetch); break; case 'link': return '<a href="' . $fetch . '" class="custom_link">' . $fetch . '</a>'; break; case 'html': return html_entity_decode($fetch); break; case 'google_map': return display_google_map($fetch); break; default: // If you're not processing(formatting) the var at all // why even use this function? Just use the WP custom field funcs. return $fetch; } }
function cuisine_intro($atts, $content = null) { $html = '<div class="intro">'; $html .= do_shortcode(wpautop($content)); $html .= '</div>'; return $html; }
function st_remove_wpautop($content) { if (function_exists('wpb_js_remove_wpautop')) { $content = wpautop(preg_replace('/<\\/?p\\>/', "\n", $content) . "\n"); return do_shortcode(shortcode_unautop($content)); } }
/** * Display meta in a formatted list. * * @param bool $flat (default: false) * @param bool $return (default: false) * @param string $hideprefix (default: _) * @param string $delimiter Delimiter used to separate items when $flat is true * @return string|void */ public function display($flat = false, $return = false, $hideprefix = '_', $delimiter = ", \n") { $output = ''; $formatted_meta = $this->get_formatted($hideprefix); if (!empty($formatted_meta)) { $meta_list = array(); foreach ($formatted_meta as $meta) { if ($flat) { $meta_list[] = wp_kses_post($meta['label'] . ': ' . $meta['value']); } else { $meta_list[] = ' <dt class="variation-' . sanitize_html_class(sanitize_text_field($meta['key'])) . '">' . wp_kses_post($meta['label']) . ':</dt> <dd class="variation-' . sanitize_html_class(sanitize_text_field($meta['key'])) . '">' . wp_kses_post(wpautop(make_clickable($meta['value']))) . '</dd> '; } } if (!empty($meta_list)) { if ($flat) { $output .= implode($delimiter, $meta_list); } else { $output .= '<dl class="variation">' . implode('', $meta_list) . '</dl>'; } } } $output = apply_filters('woocommerce_order_items_meta_display', $output, $this); if ($return) { return $output; } else { echo $output; } }
/** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget($args, $instance) { if ($this->get_cached_widget($args)) { return; } ob_start(); extract($args); $title = $instance['title']; $color = $instance['color']; $description = $instance['description']; echo $before_widget; ?> <div class="pricing-table-widget-title" style="background-color: <?php echo esc_attr($color); ?> "> <?php echo esc_attr($title); ?> </div> <div class="pricing-table-widget-description"> <?php echo wpautop(apply_filters('jobify_price_option_description', $description)); ?> </div> <?php echo $after_widget; $content = apply_filters('jobify_widget_price_option', ob_get_clean(), $instance, $args); echo $content; $this->cache_widget($args, $content); }
/** * Generate the output for the widget. * @action eventspot_output Triggers the action to generate the output for the events. * @filter constant_contact_event_widget_ouput Modify widget output. Passes $output and $instance. * @uses CTCT_EventSpot::events_output() * @param array $args Widget args * @param array $instance Widget settings * @return void */ function widget($args = array(), $instance = array()) { $output = ''; extract($instance); $widget_title = $title; $widget_description = $description; extract($args); $output .= isset($before_widget) ? $before_widget : ''; if (!empty($widget_title)) { $output .= isset($before_title, $after_title) ? $before_title : '<h2>'; $output .= isset($widget_title) ? esc_html($widget_title) : ''; $output .= isset($after_title, $before_title) ? $after_title : '</h2>'; } $output .= !empty($widget_description) ? "\n\t" . '<div class="cc_event_description">' . "\n\t\t" . wpautop(wptexturize($widget_description)) . '</div>' : ''; // Get the output from CTCT_EventSpot::events_output() ob_start(); $instance['sidebar'] = true; do_action('eventspot_output', $instance, true); $output .= ob_get_clean(); $output .= isset($after_widget) ? $after_widget : ''; // Modify the output by calling add_filter('constant_contact_event_widget', 'your_function'); // Passes the output to the function, needs return $output coming from the function. $output = apply_filters('constant_contact_event_widget_ouput', $output, $instance); echo $output; return; }
function widget($args, $instance) { extract($args); $title = array_key_exists('title', $instance) ? apply_filters('widget_title', empty($instance['title']) ? __('Jaiminho') : $instance['title']) : ''; $jaiminho_text = array_key_exists('jaiminho_text', $instance) ? apply_filters('widget_text', $instance['jaiminho_text'], $instance) : ''; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } if (array_key_exists('jaiminho_id', $instance) && ($jaiminho_id = (int) $instance['jaiminho_id'])) { ?> <div class="jaiminho"> <div class="jaiminho-excerpt"><?php echo wpautop($jaiminho_text); ?> </div> <?php jaiminho($jaiminho_id); ?> </div><!-- .jaiminho --> <?php } else { if (current_user_can('manage_options')) { echo '<em>' . __('Não foi informado o ID da lista do Jaiminho. Preencha corretamente o campo do ID dentro do widget. Você pode encontrar o ID dentro do campo <code>value</code>, na primeira linha do formulário.', 'jaiminho') . '</em>'; } } echo $after_widget; }
function icl_get_job_original_field_content() { global $iclTranslationManagement; if (!wpml_is_action_authenticated('icl_get_job_original_field_content')) { die('Wrong Nonce'); } $job_id = filter_input(INPUT_POST, 'tm_editor_job_id', FILTER_SANITIZE_NUMBER_INT); $field = filter_input(INPUT_POST, 'tm_editor_job_field'); $data = array(); $job = $job_id !== null && $field !== null ? $job = $iclTranslationManagement->get_translation_job($job_id) : null; $elements = $job && isset($job->elements) ? $job->elements : array(); foreach ($elements as $element) { $sanitized_type = sanitize_title($element->field_type); if ($field === 'icl_all_fields' || $sanitized_type === $field) { // if we find a field by that name we need to decode its contents according to its format $field_contents = TranslationManagement::decode_field_data($element->field_data, $element->field_format); if (is_scalar($field_contents)) { $field_contents = strpos($field_contents, "\n") !== false ? wpautop($field_contents) : $field_contents; $data[] = array('field_type' => $sanitized_type, 'field_data' => $field_contents); } } } if ((bool) $data !== false) { wp_send_json_success($data); } else { wp_send_json_error(0); } }
function add_builder_content_wrapper($content) { if (!et_pb_is_pagebuilder_used(get_the_ID()) && !is_et_pb_preview()) { return $content; } // Divi builder layout should only be used in singular template if (!is_singular()) { // get_the_excerpt() for excerpt retrieval causes infinite loop; thus we're using excerpt from global $post variable global $post; $read_more = sprintf(' <a href="%1$s" title="%2$s" class="more-link">%3$s</a>', esc_url(get_permalink()), sprintf(esc_attr__('Read more on %1%s', 'et_builder'), esc_html(get_the_title())), esc_html__('read more', 'et_builder')); // Use post excerpt if there's any. If there is no excerpt defined, // Generate from post content by stripping all shortcode first if (!empty($post->post_excerpt)) { return wpautop($post->post_excerpt . $read_more); } else { $shortcodeless_content = preg_replace('/\\[[^\\]]+\\]/', '', $content); return wpautop(et_wp_trim_words($shortcodeless_content, 270, $read_more)); } } $outer_class = apply_filters('et_builder_outer_content_class', array('et_builder_outer_content')); $outer_classes = implode(' ', $outer_class); $outer_id = apply_filters("et_builder_outer_content_id", "et_builder_outer_content"); $inner_class = apply_filters('et_builder_inner_content_class', array('et_builder_inner_content')); $inner_classes = implode(' ', $inner_class); $content = sprintf('<div class="%2$s" id="%4$s"> <div class="%3$s"> %1$s </div> </div>', $content, esc_attr($outer_classes), esc_attr($inner_classes), esc_attr($outer_id)); return $content; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $text = apply_filters('weaverii_text', $instance['text'], $instance); $text2 = apply_filters('weaverii_text', $instance['text2'], $instance); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } ?> <div class="textwidget"><div style="float: left; width: 48%; padding-right: 2%;"> <?php if ($instance['filter']) { echo wpautop($text); echo '</div><div style="float: left; width: 48%; padding-left: 2%;">'; echo wpautop($text2); echo '</div><div style="clear: both;"></div>'; } else { echo $text; echo '</div><div style="float: left; width: 48%; padding-left: 2%;">'; echo $text2; echo '</div><div style="clear: both;"></div>'; } ?> </div> <?php echo $after_widget; }
function update_nag() { $theme = wp_get_theme($this->theme_slug); $api_response = get_transient($this->response_key); if (false === $api_response) { return; } $update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($this->theme_slug), 'upgrade-theme_' . $this->theme_slug); // CT Mod: change message, add textdomain //$update_onclick = ' onclick="if ( confirm(\'' . esc_js( __( "Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update." ) ) . '\') ) {return true;}return false;"'; $update_onclick = ' onclick="if ( confirm(\'' . esc_js(sprintf(__("Any customizations you have made directly to %s's theme files will be lost. Please consider using a child theme for modifications.", "church-theme-framework"), $theme->get('Name'))) . '\') ) {return true;}return false;"'; if (version_compare($this->version, $api_response->new_version, '<')) { echo '<div id="update-nag">'; // CT Mod: Change message, localize -- now link directly to changelog /* printf( '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.', $theme->get( 'Name' ), $api_response->new_version, '#TB_inline?width=640&inlineId=' . $this->theme_slug . '_changelog', $theme->get( 'Name' ), $update_url, $update_onclick ); */ printf(__('<strong>%1$s %2$s</strong> is available. <a href="%3$s"%4$s>Update Now</a> or read the <a href="%5$s" target="_blank">Changelog</a>.', 'church-theme-framework'), $theme->get('Name'), $api_response->new_version, $update_url, $update_onclick, 'http://churchthemes.com/go/changelog/' . CTFW_THEME_SLUG . '/'); echo '</div>'; echo '<div id="' . $this->theme_slug . '_' . 'changelog" style="display:none;">'; echo wpautop($api_response->sections['changelog']); echo '</div>'; } }
public function cleanValueForGetting($value) { if ($this->settings['wpautop']) { return wpautop(stripslashes($value)); } return stripslashes($value); }
private function compose($send = true) { $template = $this->template; $use_html = (bool) $template['use_html']; $subject = $this->replace_tags($template['subject']); $sender = $this->replace_tags($template['sender']); $recipient = $this->replace_tags($template['recipient']); $additional_headers = $this->replace_tags($template['additional_headers']); if ($use_html) { $body = $this->replace_tags($template['body'], true); $body = wpautop($body); } else { $body = $this->replace_tags($template['body']); } $attachments = $this->attachments($template['attachments']); $components = compact('subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments'); $components = apply_filters('wpcf7_mail_components', $components, wpcf7_get_current_contact_form()); extract($components); $subject = wpcf7_strip_newline($subject); $sender = wpcf7_strip_newline($sender); $recipient = wpcf7_strip_newline($recipient); $headers = "From: {$sender}\n"; if ($use_html) { $headers .= "Content-Type: text/html\n"; } $additional_headers = trim($additional_headers); if ($additional_headers) { $headers .= $additional_headers . "\n"; } if ($send) { return @wp_mail($recipient, $subject, $body, $headers, $attachments); } $components = compact('subject', 'sender', 'body', 'recipient', 'headers', 'attachments'); return $components; }
/** * Display meta in a formatted list * * @access public * @param bool $flat (default: false) * @param bool $return (default: false) * @param string $hideprefix (default: _) * @return string */ public function display($flat = false, $return = false, $hideprefix = '_') { $output = ''; $formatted_meta = $this->get_formatted($hideprefix); if (!empty($formatted_meta)) { $meta_list = array(); foreach ($formatted_meta as $meta_key => $meta) { if ($flat) { $meta_list[] = wp_kses_post($meta['label'] . ': ' . $meta['value']); } else { $meta_list[] = ' <dt class="variation-' . sanitize_html_class(sanitize_text_field($meta_key)) . '">' . wp_kses_post($meta['label']) . ':</dt> <dd class="variation-' . sanitize_html_class(sanitize_text_field($meta_key)) . '">' . wp_kses_post(wpautop($meta['value'])) . '</dd> '; } } if (!empty($meta_list)) { if ($flat) { $output .= implode(", \n", $meta_list); } else { $output .= '<dl class="variation">' . implode('', $meta_list) . '</dl>'; } } } if ($return) { return $output; } else { echo $output; } }
function event_espresso_custom_questions_output($atts) { global $wpdb; extract($atts); //Get the questions for the attendee $sql = "SELECT ea.answer, eq.question FROM " . EVENTS_ANSWER_TABLE . " ea "; $sql .= " LEFT JOIN " . EVENTS_QUESTION_TABLE . " eq ON eq.id = ea.question_id "; $sql .= " WHERE ea.attendee_id = '" . $attendee_id . "' "; $all_questions == TRUE ? '' : ($sql .= " AND system_name IS NULL "); !empty($show_admin) && $show_admin == TRUE ? '' : ($sql .= " AND eq.admin_only = 'N' "); $sql .= " ORDER BY eq.sequence asc "; $questions = $wpdb->get_results($sql); //echo $wpdb->last_query . '<br />'; $email_questions = ''; $q_counter = 0; $q_num_rows = $wpdb->num_rows; if ($q_num_rows > 0) { foreach ($questions as $question) { $email_questions .= $question->answer != '' ? wpautop('<strong>' . $question->question . ':</strong><br /> ' . str_replace(',', '<br />', $question->answer)) : ''; $q_counter++; if ($q_counter == $q_num_rows) { return $email_questions; } } } return $email_questions; }
/** * Outputs the content for the current Text widget instance. * * @since 2.8.0 * @access public * * @param array $args Display arguments including 'before_title', 'after_title', * 'before_widget', and 'after_widget'. * @param array $instance Settings for the current Text widget instance. */ public function widget($args, $instance) { /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $widget_text = !empty($instance['text']) ? $instance['text'] : ''; /** * Filter the content of the Text widget. * * @since 2.3.0 * @since 4.4.0 Added the `$this` parameter. * * @param string $widget_text The widget content. * @param array $instance Array of settings for the current widget. * @param WP_Widget_Text $this Current Text widget instance. */ $text = apply_filters('widget_text', $widget_text, $instance, $this); echo $args['before_widget']; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } ?> <div class="textwidget"><?php echo !empty($instance['filter']) ? wpautop($text) : $text; ?> </div> <?php echo $args['after_widget']; }
public static function get_media_item($item_data, $align = 'horizontal') { if (!is_object($item_data)) { return ''; } $title = ''; $caption = ''; $link = ''; $title_template = '<h4>%s</h4>'; if (!empty($item_data->link)) { $link_url = $item_data->link; $link = '<a class="swiper-link" href="' . $link_url . '">' . __('Details', 'the7mk2') . '</a>'; $title_template = '<h4><a href="' . $link_url . '">%s</a></h4>'; } if (!empty($item_data->title)) { $title = sprintf($title_template, wp_kses($item_data->title, array())); } if (!empty($item_data->description)) { $caption = wpautop(wp_kses_post($item_data->description)); } $image = dt_get_thumb_img(array('echo' => false, 'img_meta' => array($item_data->full, $item_data->width, $item_data->height), 'img_id' => $item_data->ID, 'alt' => $item_data->alt, 'wrap' => '<img %IMG_CLASS% %SRC% %SIZE% %ALT% />', 'prop' => false)); $info = $title . $caption . $link; if ($info) { $info = sprintf('<span class="link show-content"></span> <div class="swiper-caption"> %s <span class="close-link"></span> </div>', $info); } $html = sprintf('<div class="swiper-slide"> %s %s </div>', $image, $info); return $html; }
function uw_blogroll_shortcode($atts = array()) { //allow pagebuilder widgets to run the shortcode, block all other posts to prevent infinite loops if (get_post_type() == 'post' && !is_home()) { return ''; } $params = array_merge(array('excerpt' => 'true', 'trim' => 'false', 'image' => 'hide', 'author' => 'show', 'titletag' => 'h2', 'number' => 5), $atts); if (!array_key_exists('numberposts', $params)) { $params['numberposts'] = $params['number']; } $posts = get_posts($params); foreach ($posts as $post) { if (!stripos($post->post_content, '[blogroll')) { //to prevent infinite loops in pagebuilder widgets $postID = $post->ID; $link = get_permalink($postID); if (in_array($params['excerpt'], array('show', 'true'))) { $excerpt = strlen($post->post_excerpt) > 0 ? $post->post_excerpt : apply_filters('widget_text', $post->post_content); if (in_array($params['trim'], array('show', 'true'))) { $excerpt = wp_trim_words($excerpt); } $excerpt = wpautop($excerpt); //using apply_filters('the_content', $excerpt) causes an infinite loop if (in_array($params['image'], array('show', 'true'))) { $image = get_the_post_thumbnail($postID, 'thumbnail', array('style' => 'float:left;padding-right:10px;')); $class = 'class="pull-left"'; } } $author = $params['author'] === 'show' ? '<p class="author-info">' . get_the_author_meta('display_name', $post->post_author) . '</p>' : ''; $postDate = get_the_time(get_option('date_format'), $postID); $html .= "<li {$class}>{$image}<span><p class=\"date\">{$postDate}</p><" . $params['titletag'] . "><a href=\"{$link}\">{$post->post_title}</a></" . $params['titletag'] . ">{$author}{$excerpt}</span></li>"; } } return "<ul class=\"shortcode-blogroll\">{$html}</ul>"; }
/** * Avoid re-adding `wpautop` for Ai1EC instances. * * @param string $content Processed content. * * @return string Paragraphs enclosed text. */ public function event_excerpt_noautop($content) { if (!$this->_registry->get('acl.aco')->is_our_post_type()) { return wpautop($content); } return $content; }
/** * Admin Options * * Setup the gateway settings screen. * Override this in your gateway. */ public function admin_options() { ?> <h3><?php echo isset($this->method_title) ? $this->method_title : __('Settings', 'woocommerce'); ?> </h3> <?php echo isset($this->method_description) ? wpautop($this->method_description) : ''; ?> <table class="form-table"> <?php $this->generate_settings_html(); ?> </table> <!-- Section --> <div><input type="hidden" name="section" value="<?php echo $this->id; ?> " /></div> <?php }
/** * Process our Success Message notification * * @access public * @since 2.8 * @return void */ public function process($id) { global $ninja_forms_processing; $success_msg = Ninja_Forms()->notification($id)->get_setting('success_msg'); $success_msg = do_shortcode(wpautop($success_msg)); $ninja_forms_processing->add_success_msg('success_msg', $success_msg); }
public function render_frontend($widget_args, $content = '', $context = '') { if (!$this->pre_render_frontend()) { return; } if (!empty($widget_args['title'])) { echo $widget_args['title']; } // Make sure the class is loaded in DataTables if (!class_exists('GFFormDisplay')) { include_once GFCommon::get_base_path() . '/form_display.php'; } $widget_args['content'] = trim(rtrim($widget_args['content'])); // No custom content if (empty($widget_args['content'])) { do_action('gravityview_log_debug', sprintf('%s[render_frontend]: No content.', get_class($this))); return; } // Add paragraphs? if (!empty($widget_args['wpautop'])) { $widget_args['content'] = wpautop($widget_args['content']); } // Enqueue scripts needed for Gravity Form display, if form shortcode exists. // Also runs `do_shortcode()` $content = GFCommon::gform_do_shortcode($widget_args['content']); // Add custom class $class = !empty($widget_args['custom_class']) ? $widget_args['custom_class'] : ''; $class = gravityview_sanitize_html_class($class); echo '<div class="gv-widget-custom-content ' . $class . '">' . $content . '</div>'; }
/** * Echo the widget content. * * @param array $args Display arguments including `before_title`, `after_title`, * `before_widget`, and `after_widget`. * @param array $instance The settings for the particular instance of the widget. */ function widget($args, $instance) { // Merge with defaults. $instance = wp_parse_args((array) $instance, $this->defaults); echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title']; } $text = ''; if (!empty($instance['alignment'])) { $text .= '<span class="align' . esc_attr($instance['alignment']) . '">'; } $text .= get_avatar($instance['user'], $instance['size']); if (!empty($instance['alignment'])) { $text .= '</span>'; } if ('text' === $instance['author_info']) { $text .= $instance['bio_text']; } else { $text .= get_the_author_meta('description', $instance['user']); } $text .= $instance['page'] ? sprintf(' <a class="pagelink" href="%s">%s</a>', get_page_link($instance['page']), $instance['page_link_text']) : ''; echo wpautop($text); // If posts link option checked, add posts link to output. $display_name = get_the_author_meta('display_name', $instance['user']); $user_name = !empty($display_name) && genesis_a11y('screen-reader-text') ? '<span class="screen-reader-text">' . $display_name . ': </span>' : ''; if ($instance['posts_link']) { printf('<div class="posts_link posts-link"><a href="%s">%s%s</a></div>', get_author_posts_url($instance['user']), $user_name, __('View My Blog Posts', 'genesis')); } echo $args['after_widget']; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $text = apply_filters('widget_text', empty($instance['text']) ? '' : $instance['text'], $instance); $icon = empty($instance['icon']) ? '' : '<i class="' . esc_attr($instance['button_color']) . ' fa ' . strip_tags($instance['icon']) . '"></i>'; $url = esc_url($instance['url']); $button_text = empty($instance['button_text']) ? '' : $instance['button_text']; $icon_string = $url ? '<a href="' . $url . '">' . $icon . '</a>' : $icon; $title_string = $url ? '<a href="' . $url . '">' . $title . '</a>' : $title; echo $before_widget; if ($icon) { echo $icon_string; } if ($title) { echo $before_title . $title_string . $after_title; } ?> <div class="textwidget"> <?php echo !empty($instance['filter']) ? wpautop($text) : $text; ?> </div> <?php if ($url && $button_text) { echo '<a href="' . $url . '" class="btn btn-' . esc_attr($instance['button_color']) . ' btn-lg">' . $button_text . '</a>'; } echo $after_widget; }