/** * Display 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); $instance = wp_parse_args((array) $instance, $this->defaults); $featured_page = new WP_Query(array('page_id' => $instance['page_id'])); echo $before_widget . '<div class="feature-page">'; if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; } if ($featured_page->have_posts()) { while ($featured_page->have_posts()) { $featured_page->the_post(); echo '<div class="' . implode(' ', get_post_class()) . '">'; if (!empty($instance['show_title'])) { printf('<h4 class="entry-title"><a href="%s" title="%s">%s</a></h4>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } //Show image if (!empty($instance['show_image'])) { printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), calibrefx_get_image(array('format' => 'html', 'size' => $instance['image_size']))); } if (!empty($instance['show_content'])) { if (empty($instance['content_limit'])) { the_content($instance['more_text']); } else { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } } echo '</div><!--end post_class()-->' . "\n\n"; } } echo '</div>' . $after_widget; wp_reset_query(); }
/** * Echo the widget content. * * @since 0.1.8 * * @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) { global $wp_query; extract($args); //* Merge with defaults $instance = wp_parse_args((array) $instance, $this->defaults); echo $before_widget; //* Set up the author bio if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; } $wp_query = new WP_Query(array('page_id' => $instance['page_id'])); if (have_posts()) { while (have_posts()) { the_post(); genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry')); $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-page-widget', 'attr' => genesis_parse_attr('entry-image-widget'))); if ($instance['show_image'] && $image) { printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $image); } if (!empty($instance['show_title'])) { if (genesis_html5()) { printf('<header class="entry-header"><h2 class="entry-title"><a href="%s" title="%s">%s</a></h2></header>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } else { printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } } if (!empty($instance['show_content'])) { echo genesis_html5() ? '<div class="entry-content">' : ''; if (empty($instance['content_limit'])) { global $more; $more = 0; the_content($instance['more_text']); } else { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } echo genesis_html5() ? '</div>' : ''; } if (!empty($instance['custom_text'])) { $text = wp_kses_post($instance['custom_text']); echo '<div class="custom-text">'; echo $instance['filter'] ? wpautop($text) : $text; if (!empty($instance['more_text'])) { echo '<span class="more-link"><a href="' . get_permalink($instance['page_id']) . '">' . $instance['more_text'] . '</a></span>'; } echo '</div>'; } genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>')); } } //* Restore original query wp_reset_query(); echo $after_widget; }
function crystal_portfolio_do_post_content() { if (genesis_get_option('crystal_portfolio_content') == 'excerpts') { the_excerpt(); } else { if (genesis_get_option('crystal_portfolio_content_archive_limit')) { the_content_limit((int) genesis_get_option('crystal_portfolio_content_archive_limit'), __('View Project', 'crystal')); } else { the_content(__('View Project', 'crystal')); } } }
function widget($args, $instance) { extract($args); $instance = wp_parse_args((array) $instance, array('title' => '', 'posts_cat' => '', 'posts_num' => '', 'posts_offset' => '', 'orderby' => '', 'order' => '', 'show_image' => 0, 'image_alignment' => '', 'image_size' => '', 'show_title' => 0, 'show_byline' => 0, 'show_content' => 0, 'content_limit' => '', 'more_text' => '')); echo $before_widget; $featured_posts = new WP_Query(array('cat' => $instance['posts_cat'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order'])); if ($featured_posts->have_posts()) { while ($featured_posts->have_posts()) { $featured_posts->the_post(); echo '<li '; post_class('feature-post'); echo '>'; if (!empty($instance['show_image'])) { echo '<a href="' . get_permalink() . '" title="' . get_the_title() . '" class="' . esc_attr($instance['image_alignment']) . ' feature-image">'; genesis_image(array('format' => 'html', 'size' => $instance['image_size'])); echo '</a>'; } if (!empty($instance['show_title'])) { echo '<h2 class="title"><a href="' . get_permalink() . '" title="' . esc_attr(get_the_title()) . '">' . get_the_title() . '</a></h2>'; } if (!empty($instance['show_byline'])) { echo '<p class="byline">'; the_time('F j, Y'); echo ' ' . __('by', 'genesis') . ' '; the_author_posts_link(); echo ' · '; comments_popup_link(__('Leave a Comment', 'genesis'), __('1 Comment', 'genesis'), __('% Comments', 'genesis')); echo ' '; edit_post_link(__('(Edit)', 'genesis'), '', ''); echo '</p>'; } if (!empty($instance['show_content'])) { if ($instance['show_content'] == 'excerpt') { the_excerpt(); } elseif ($instance['show_content'] == 'content-limit') { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } else { the_content(esc_html($instance['more_text'])); } } echo '</li><!--end post_class()-->' . "\n\n"; if (!empty($instance['show_slider_nav'])) { $slider_nav .= '<li><a href="#"></a></li>'; } } } echo $after_widget; echo '<div class="feature-nav ' . esc_attr($instance['image_alignment']) . '">'; echo '<ul>'; echo $slider_nav; echo '</ul></div>'; wp_reset_query(); }
/** * Echo the widget content. * * @since 0.2.0 * * @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) { global $wp_query; extract($args); //* Merge with defaults $instance = wp_parse_args((array) $instance, $this->defaults); echo $before_widget; //* Set up the widget title if (!empty($instance['title'])) { echo '<h2 class="widget-title widgettitle">' . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . '</h2>'; } $query_args = array('post_type' => 'awp-community', 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order']); $wp_query = new WP_Query($query_args); if (have_posts()) { while (have_posts()) { the_post(); genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry')); $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-community-widget', 'attr' => genesis_parse_attr('entry-image-widget'))); if ($instance['show_image'] && $image) { printf('<div class="awp-community-image"><a href="%s" title="%s" class="%s">%s</a></div>', get_permalink(), the_title_attribute('echo=0'), 'awp-community-link', $image); } if ($instance['show_title']) { echo '<header class="entry-header">'; printf('<h3 class="entry-title"><a href="%s" title="%s">%s</a></h3>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); echo '</header>'; } if (!empty($instance['show_content'])) { echo '<div class="entry-content">'; if ('excerpt' == $instance['show_content']) { $current_excerpt = get_the_excerpt(); echo $current_excerpt; //the_excerpt(); } elseif ('content-limit' == $instance['show_content']) { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } else { global $more; $orig_more = $more; $more = 0; the_content(esc_html($instance['more_text'])); $more = $orig_more; } echo '</div>'; } genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>')); } } //* Restore original query wp_reset_query(); echo $after_widget; }
function widget($args, $instance) { extract($args); $instance = wp_parse_args((array) $instance, array('title' => '', 'page_id' => '', 'show_image' => 0, 'image_alignment' => '', 'image_size' => '', 'show_title' => 0, 'show_byline' => 0, 'show_content' => 0, 'content_limit' => '', 'more_text' => '')); echo $before_widget; // Set up the author bio if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title; } $featured_page = new WP_Query(array('page_id' => $instance['page_id'])); if ($featured_page->have_posts()) { while ($featured_page->have_posts()) { $featured_page->the_post(); echo '<div '; post_class(); echo '>'; if (!empty($instance['show_image'])) { printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), genesis_get_image(array('format' => 'html', 'size' => $instance['image_size']))); } if (!empty($instance['show_title'])) { printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), the_title_attribute('echo=0')); } if (!empty($instance['show_byline'])) { echo '<p class="byline">'; the_time('F j, Y'); echo ' ' . __('by', 'genesis') . ' '; the_author_posts_link(); echo g_ent(' · '); comments_popup_link(__('Leave a Comment', 'genesis'), __('1 Comment', 'genesis'), __('% Comments', 'genesis')); echo ' '; edit_post_link(__('(Edit)', 'genesis'), '', ''); echo '</p>'; } if (!empty($instance['show_content'])) { if (empty($instance['content_limit'])) { the_content($instance['more_text']); } else { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } } echo '</div><!--end post_class()-->' . "\n\n"; } } echo $after_widget; wp_reset_query(); }
function widget($args, $instance) { extract($args); echo $before_widget; $slider_nav = ''; $featured_posts = new WP_Query(array('cat' => $instance['posts_cat'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order'])); if ($featured_posts->have_posts()) { while ($featured_posts->have_posts()) { $featured_posts->the_post(); echo '<li '; post_class('slider-post'); echo '>'; if (!empty($instance['show_image'])) { echo '<a href="' . get_permalink() . '" title="' . get_the_title() . '" class="' . esc_attr($instance['image_alignment']) . ' slider-show-image">'; genesis_image(array('format' => 'html', 'size' => $instance['image_size'])); echo '</a>'; } if (!empty($instance['show_title'])) { echo '<h2 class="slider-title"><a href="' . get_permalink() . '" title="' . esc_attr(get_the_title()) . '">' . get_the_title() . '</a></h2>'; } if (!empty($instance['show_content'])) { if ($instance['show_content'] == 'excerpt') { the_excerpt(); } elseif ($instance['show_content'] == 'content-limit') { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } else { the_content(esc_html($instance['more_text'])); } } echo '</li><!--end post_class()-->' . "\n\n"; if (!empty($instance['show_slider_nav'])) { $slider_nav .= '<li><a href="#" class="nav-thumb-wrapper">' . genesis_get_image(array('format' => 'html', 'size' => 'Slider Thumbnail', 'attr' => array('class' => 'nav-thumb-image'))) . '</a></li>'; } } } echo $after_widget; echo '<div id="slider-nav">'; echo '<a class="nav-prev" href="#">Previous</a>'; echo '<a class="nav-next" href="#">Next</a>'; echo '<ul class="nav-thumbs">'; echo $slider_nav; echo '</ul></div>'; wp_reset_query(); }
function widget($args, $instance) { extract($args); $instance = wp_parse_args((array) $instance, array('title' => '', 'page_id' => '', 'show_title' => 0, 'show_content' => 0, 'content_limit' => '', 'more_text' => '')); echo $before_widget; // Set up the author bio if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title; } $featured_page = new WP_Query(array('page_id' => $instance['page_id'])); if ($featured_page->have_posts()) { while ($featured_page->have_posts()) { $featured_page->the_post(); echo '<div '; post_class(); echo '>'; ?> <a href="<?php the_permalink(); ?> " rel="noindex"><?php the_post_thumbnail(); ?> </a> <?php if (!empty($instance['show_title'])) { printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), the_title_attribute('echo=0')); } if (!empty($instance['show_content'])) { if (empty($instance['content_limit'])) { the_content($instance['more_text']); } else { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } } echo '</div><!--end post_class()-->' . "\n\n"; } } echo $after_widget; wp_reset_query(); }
/** * Echo the widget content. * * @since 0.9.1 * * @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) { global $wp_query; extract($args); //* Merge with defaults $instance = wp_parse_args((array) $instance, $this->defaults); echo $before_widget; //* Set up the author bio if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; } $wp_query = new WP_Query(array('page_id' => $instance['page_id'])); if (have_posts()) { while (have_posts()) { the_post(); echo '<article class="' . implode(' ', get_post_class()) . ' entry" itemtype="http://schema.org/CreativeWork" itemscope="itemscope">'; $image = omega_get_image(array('format' => 'html', 'size' => $instance['image_size'])); if ($instance['show_image'] && $image) { printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $image); } if (!empty($instance['show_title'])) { printf('<header class="entry-header"><h2 class="entry-title"><a href="%s" title="%s">%s</a></h2></header>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } if (!empty($instance['show_content'])) { echo '<div class="entry-content">'; if (empty($instance['content_limit'])) { global $more; $more = 0; the_content($instance['more_text']); } else { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } echo '</div>'; } echo '</article>'; } } //* Restore original query wp_reset_query(); echo $after_widget; }
/** * Echo the widget content. * * @since 0.1.8 * * @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) { global $wp_query, $_genesis_displayed_ids; extract($args); //* Merge with defaults $instance = wp_parse_args((array) $instance, $this->defaults); echo $before_widget; //* Set up the author bio if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; } $query_args = array('post_type' => $instance['post_type'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order']); // Extract the custom tax term, if provided if ('any' !== $instance['tax_term']) { list($post_tax, $post_term) = explode('/', $instance['tax_term'], 2); $query_args['tax_query'] = array(array('taxonomy' => $post_tax, 'field' => 'slug', 'terms' => $post_term)); } //* Exclude displayed IDs from this loop? if ($instance['exclude_displayed']) { $query_args['post__not_in'] = (array) $_genesis_displayed_ids; } if ('full' !== $instance['columns']) { add_filter('post_class', array($this, 'add_post_class_' . $instance['columns'])); } $wp_query = new WP_Query($query_args); echo '<div class="featured-wrap">'; if (have_posts()) { while (have_posts()) { the_post(); $_genesis_displayed_ids[] = get_the_ID(); genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry')); // Enable the image to diplay under the title if ($instance['image_position']) { if ($instance['show_title']) { echo genesis_html5() ? '<header class="entry-header">' : ''; } if (!empty($instance['show_title'])) { if (genesis_html5()) { printf('<h2 class="entry-title"><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } else { printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } } if (!empty($instance['show_byline']) && !empty($instance['post_info'])) { printf(genesis_html5() ? '<p class="entry-meta">%s</p>' : '<p class="byline post-info">%s</p>', do_shortcode($instance['post_info'])); } if ($instance['show_title']) { echo genesis_html5() ? '</header>' : ''; } $size = $instance['image_size']; $image = apply_filters('featured_custom_post_type_image', genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-post-widget', 'attr' => genesis_parse_attr('entry-image-widget'))), $size); if ($instance['show_image'] && $image) { printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $image); } if (!empty($instance['show_gravatar'])) { echo '<span class="' . esc_attr($instance['gravatar_alignment']) . '">'; echo get_avatar(get_the_author_meta('ID'), $instance['gravatar_size']); echo '</span>'; } } else { $size = $instance['image_size']; $image = apply_filters('featured_custom_post_type_image', genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-post-widget', 'attr' => genesis_parse_attr('entry-image-widget'))), $size); if ($instance['show_image'] && $image) { printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $image); } if (!empty($instance['show_gravatar'])) { echo '<span class="' . esc_attr($instance['gravatar_alignment']) . '">'; echo get_avatar(get_the_author_meta('ID'), $instance['gravatar_size']); echo '</span>'; } if ($instance['show_title']) { echo genesis_html5() ? '<header class="entry-header">' : ''; } if (!empty($instance['show_title'])) { if (genesis_html5()) { printf('<h2 class="entry-title"><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } else { printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } } if (!empty($instance['show_byline']) && !empty($instance['post_info'])) { printf(genesis_html5() ? '<p class="entry-meta">%s</p>' : '<p class="byline post-info">%s</p>', do_shortcode($instance['post_info'])); } if ($instance['show_title']) { echo genesis_html5() ? '</header>' : ''; } } if (!empty($instance['show_content'])) { echo genesis_html5() ? '<div class="entry-content">' : ''; if ('excerpt' == $instance['show_content']) { the_excerpt(); } elseif ('content-limit' == $instance['show_content']) { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } else { global $more; $orig_more = $more; $more = 0; the_content(esc_html($instance['more_text'])); $more = $orig_more; } echo genesis_html5() ? '</div>' : ''; } genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>')); } } echo '</div>'; if ('full' !== $instance['columns']) { remove_filter('post_class', array($this, 'add_post_class_' . $instance['columns'])); } //* Restore original query wp_reset_query(); //* The EXTRA Posts (list) if (!empty($instance['extra_num'])) { if (!empty($instance['extra_title'])) { echo $before_title . esc_html($instance['extra_title']) . $after_title; } $offset = intval($instance['posts_num']) + intval($instance['posts_offset']); $query_args = array('post_type' => $instance['post_type'], 'showposts' => $instance['extra_num'], 'offset' => $offset); // Extract the custom tax term, if provided if ('any' != $instance['tax_term']) { list($post_tax, $post_term) = explode('/', $instance['tax_term'], 2); $query_args['tax_query'] = array(array('taxonomy' => $post_tax, 'field' => 'slug', 'terms' => $post_term)); } $wp_query = new WP_Query($query_args); $listitems = ''; if (have_posts()) { while (have_posts()) { the_post(); $_genesis_displayed_ids[] = get_the_ID(); $extra_title = sprintf('<a href="%s">%s</a>', get_permalink(), get_the_title()); $listitems .= '<li>'; $listitems .= apply_filters('featured_custom_post_type_extra_title', $extra_title); $listitems .= '</li>'; } if (mb_strlen($listitems) > 0) { printf('<ul>%s</ul>', $listitems); } } //* Restore original query wp_reset_query(); } if (!empty($instance['more_from_category']) && !empty($instance['more_from_category_text']) && 'any' !== $instance['tax_term']) { list($post_tax, $post_term) = explode('/', $instance['tax_term'], 2); printf('<p class="more-from-category"><a href="%1$s">%2$s</a></p>', esc_url(get_term_link($post_term, $post_tax)), esc_html($instance['more_from_category_text'])); } if (!empty($instance['archive_link']) && !empty($instance['archive_text'])) { $archive_url = get_post_type_archive_link($instance['post_type']); if ('post' === $instance['post_type']) { $postspage = get_option('page_for_posts'); $archive_url = get_permalink(get_post($postspage)->ID); $frontpage = get_option('show_on_front'); if ('posts' === $frontpage) { $archive_url = get_home_url(); } } printf('<p class="more-from-category"><a href="%1$s">%2$s</a></p>', esc_url($archive_url), esc_html($instance['archive_text'])); } echo $after_widget; }
/** * Echo the widget content. * * @since 1.0.0 * * @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 * * @global mixed $wp_query */ function widget($args, $instance) { /** Extract arguments */ extract($args); /** Merge with defaults */ $instance = wp_parse_args((array) $instance, $this->defaults); /** Check SPECIFIC display option for this widget and optionally disable it from displaying */ if ($instance['not_in_public'] && !is_user_logged_in()) { return; } /** Check GENERAL display option for this widget and optionally disable it from displaying */ if ('single_posts' === $instance['widget_display'] && !is_singular('post') || 'single_pages' === $instance['widget_display'] && !is_singular('page') || 'single_posts_pages' === $instance['widget_display'] && !is_singular(array('post', 'page'))) { return; } // end-if widget display checks /** Get global $wp_query object */ global $wp_query; /** Widget title URL helpers */ $title_url_custom = !empty($instance['title_url']) && !$instance['title_url_page'] ? $instance['title_url'] : ''; $title_url = $instance['title_url_page'] ? get_permalink($instance['page_id']) : $title_url_custom; /** Optional title URL target */ $title_url_target = $instance['title_url_target'] ? ' target="_blank"' : ''; /** Typical WordPress Widget title filter */ $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); /** GFPE Widget title filter */ $title = apply_filters('gfpe_filter_widget_title', $instance['title'], $instance, $this->id_base); /** Prepare the title display string */ $title_display = sprintf('%1$s%2$s%3$s', $instance['title_url_page'] || !empty($instance['title_url']) ? '<a href="' . esc_url($title_url) . '"' . $title_url_target . '>' : '', esc_attr($instance['title']), $instance['title_url_page'] || !empty($instance['title_url']) ? '</a>' : ''); /** Output the widget wrapper and title */ echo $before_widget; /** Set up the complete title display */ if (empty($instance['title_hide']) && !empty($instance['title'])) { echo $before_title . $title_display . $after_title; } // end if /** Action hook 'gfpe_before_search_widget' */ do_action('gfpe_before_page_widget', $instance, $this->id_base); /** Display widget intro text if it exists */ if (!empty($instance['intro_text'])) { printf('<div class="textwidget"><p class="%s-intro-text gfpe-intro-text">%s</p></div>', $this->id, $instance['intro_text']); } // end-if optional intro /** Set new WP_Query instance */ $wp_query = new WP_Query(array('page_id' => $instance['page_id'])); /** Loop through pages */ if (have_posts()) { while (have_posts()) { the_post(); /** Genesis markup: open */ genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry')); /** * Image center alignment helper - needs to go before actual * image if/else statement! */ if ('aligncenter' === $instance['image_alignment']) { $img_centered = ' centered'; add_filter('genesis_attr_entry-image-widget', 'ddw_gfpe_entry_image_widget_class'); } else { $img_centered = ''; } // end if /** a) Featured image support */ if (!empty($instance['image_show']) && empty($instance['image_url'])) { /** Retrieve featured image */ $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-page-widget', 'attr' => genesis_parse_attr('entry-image-widget'))); /** Output featured image */ if ($image) { printf('<%1$s %2$s title="%3$s" class="%4$s%5$s">%6$s</%1$s>', $instance['image_link'] ? 'a' : 'span', $instance['image_link'] ? 'href="' . get_permalink() . '"' : '', the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $img_centered, $image); } // end if } elseif (!empty($instance['image_url'])) { $img_sizes = genesis_get_image_sizes(); // all image sizes available $size_wh = $instance['image_size']; // needed size (set in widget) $custom_image = '<img width="' . absint($img_sizes[$size_wh]['width']) . '" height="' . absint($img_sizes[$size_wh]['height']) . '" src="' . esc_url($instance['image_url']) . '" class="attachment-' . $size_wh . $img_centered . '" alt="' . the_title_attribute('echo=0') . '" />'; printf('<%1$s %2$s title="%3$s" class="%4$s%5$s">%6$s</%1$s>', $instance['image_link'] ? 'a' : 'span', $instance['image_link'] ? 'href="' . esc_url(get_permalink()) . '"' : '', the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $img_centered, $custom_image); } // end if /** Page title support */ if (!empty($instance['page_title_show'])) { if (!empty($instance['page_title_limit'])) { $page_title = genesis_truncate_phrase(the_title_attribute('echo=0'), $instance['page_title_limit']) . $instance['page_title_cutoff']; } else { $page_title = get_the_title(); } // end if $page_link = sprintf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $page_title); /** Genesis 2.0+ / HTML5 way: */ if (genesis_html5()) { printf('<header class="entry-header"><h2 class="entry-title">%s</h2></header>', !$instance['page_title_link'] ? $page_title : $page_link); } else { printf('<h2>%s</h2>', !$instance['page_title_link'] ? $page_title : $page_link); } // end if } // end if /** Page Byline support */ if (!empty($instance['byline_show']) && !empty($instance['page_post_info'])) { printf(genesis_html5() ? '<p class="entry-meta">%s</p>' : '<p class="byline post-info">%s</p>', do_shortcode($instance['page_post_info'])); } // end if /** Set optional "autark" custom 'More Link' */ $more_link_target = 'none' != $instance['more_link_target'] ? ' target="' . esc_html($instance['more_link_target']) . '"' : ''; $autark_more_link = sprintf('<div class="gfpe-more-link"><a class="more-link%s" href="%s"%s title="%s">%s</a></div>', !empty($instance['more_link_class']) ? ' ' . esc_attr($instance['more_link_class']) : '', empty($instance['more_link_url']) ? get_permalink($instance['page_id']) : esc_url($instance['more_link_url']), $more_link_target, esc_html($instance['more_link_text']), $instance['more_link_text']); /** * 1) Content Type: Original Page Content (optional with wpautop!) */ if ('page_content' === $instance['content_type']) { echo genesis_html5() ? '<div class="entry-content">' : ''; /** a) No content limit is set: */ if (empty($instance['content_limit'])) { global $more; $more = 0; printf('%s', $instance['page_keep_wpautop'] ? wpautop(the_content()) . $autark_more_link : get_the_content() . $autark_more_link); } else { printf('%s', empty($instance['more_link_url']) ? the_content_limit((int) $instance['content_limit'], esc_html($instance['more_link_text'])) : the_content_limit((int) $instance['content_limit'], '') . $autark_more_link); } // end if echo genesis_html5() ? '</div>' : ''; } // end if /** * 2) Content Type: Original Page Excerpt */ if ('page_excerpt' === $instance['content_type']) { echo genesis_html5() ? '<div class="entry-content">' : ''; printf(the_excerpt() . '%s', empty($instance['more_link_show']) ? '' : $autark_more_link); echo genesis_html5() ? '</div>' : ''; } // end if /** * 3) Content Type: Custom Text by user */ if ('custom_user_content' === $instance['content_type']) { echo '<div class="entry-content custom-content">'; $content = apply_filters('widget_text', empty($instance['custom_content']) ? '' : $instance['custom_content'], $instance); echo $instance['custom_wpautop'] ? wpautop($content) : $content; echo '</div>'; if (!empty($instance['more_link_text'])) { echo $autark_more_link; } // end if } // end if /** * 4) Content Type: no content at all */ if ('no_content' === $instance['content_type']) { if ($instance['more_link_text']) { echo $autark_more_link; } // end if } // end if /** Genesis markup: close */ genesis_markup(array('html5' => '</article>', 'xhtml' => '</div><!--end post_class()-->' . "\n\n")); } // end while (when pages exist) } // end if loop check /** Display widget outro text if it exists */ if (!empty($instance['outro_text'])) { printf('<div class="textwidget"><p class="%s-outro_text gfpe-outro-text">%s</p></div>', $this->id, $instance['outro_text']); } // end-if optional outro /** Action hook 'gfpe_after_search_widget' */ do_action('gfpe_after_search_widget', $instance, $this->id_base); /** Output the closing widget wrapper */ echo $after_widget; /** Reset our custom $wp_query object */ wp_reset_query(); }
/** * Display the default entry metadata. */ function omega_entry() { if (is_home() || is_archive() || is_search()) { ?> <div <?php omega_attr('entry-summary'); ?> > <?php if (get_theme_mod('post_thumbnail', 1) && has_post_thumbnail()) { if (!class_exists('Get_The_Image')) { apply_filters('omega_featured_image', printf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), get_the_post_thumbnail(get_the_ID(), get_theme_mod('image_size'), array('class' => get_theme_mod('image_size'))))); } else { get_the_image(array('size' => get_theme_mod('image_size'))); } } if ('excerpts' === get_theme_mod('post_excerpt', 'excerpts')) { if (get_theme_mod('excerpt_chars_limit', 0)) { the_content_limit((int) get_theme_mod('excerpt_chars_limit'), get_theme_mod('more_text', '[Read more...]')); } else { the_excerpt(); } } else { the_content(get_theme_mod('more_text')); } ?> </div> <?php } else { ?> <div <?php omega_attr('entry-content'); ?> > <?php the_content(); wp_link_pages(array('before' => '<p class="page-links">' . '<span class="before">' . __('Pages:', 'omega') . '</span>', 'after' => '</p>')); ?> </div> <?php } }
/** * Echo the widget content. * * @since 0.1.8 * * @global WP_Query $wp_query Query object. * @global integer $more * * @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) { global $wp_query; //* Merge with defaults $instance = wp_parse_args((array) $instance, $this->defaults); echo $args['before_widget']; //* Set up the author bio if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title']; } $wp_query = new WP_Query(array('page_id' => $instance['page_id'])); if (have_posts()) { while (have_posts()) { the_post(); genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry')); $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-page-widget', 'attr' => genesis_parse_attr('entry-image-widget', array('alt' => get_the_title())))); if ($instance['show_image'] && $image) { $role = empty($instance['show_title']) ? '' : 'aria-hidden="true"'; printf('<a href="%s" class="%s" %s>%s</a>', get_permalink(), esc_attr($instance['image_alignment']), $role, $image); } if (!empty($instance['show_title'])) { $title = get_the_title() ? get_the_title() : __('(no title)', 'genesis'); /** * Filter the featured page widget title. * * @since 2.2.0 * * @param string $title Featured page title. * @param array $instance { * Widget settings for this instance. * * @type string $title Widget title. * @type int $page_id ID of the featured page. * @type bool $show_image True if featured image should be shown, false * otherwise. * @type string $image_alignment Image alignment: alignnone, alignleft, * aligncenter or alignright. * @type string $image_size Name of the image size. * @type bool $show_title True if featured page title should be shown, * false otherwise. * @type bool $show_content True if featured page content should be shown, * false otherwise. * @type int $content_limit Amount of content to show, in characters. * @type int $more_text Text to use for More link. * } * @param array $args { * Widget display arguments. * * @type string $before_widget Markup or content to display before the widget. * @type string $before_title Markup or content to display before the widget title. * @type string $after_title Markup or content to display after the widget title. * @type string $after_widget Markup or content to display after the widget. * } */ $title = apply_filters('genesis_featured_page_title', $title, $instance, $args); $heading = genesis_a11y('headings') ? 'h4' : 'h2'; if (genesis_html5()) { printf('<header class="entry-header"><%s class="entry-title"><a href="%s">%s</a></%s></header>', $heading, get_permalink(), $title, $heading); } else { printf('<%s><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading); } } if (!empty($instance['show_content'])) { echo genesis_html5() ? '<div class="entry-content">' : ''; if (empty($instance['content_limit'])) { global $more; $orig_more = $more; $more = 0; the_content(genesis_a11y_more_link($instance['more_text'])); $more = $orig_more; } else { the_content_limit((int) $instance['content_limit'], genesis_a11y_more_link(esc_html($instance['more_text']))); } echo genesis_html5() ? '</div>' : ''; } genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>')); } } //* Restore original query wp_reset_query(); echo $args['after_widget']; }
/** Widget Output */ function widget($args, $instance) { extract($args); // defaults $instance = wp_parse_args((array) $instance, array('title' => '', 'posts_cat_1' => '', 'posts_cat_2' => '', 'posts_cat_3' => '', 'posts_cat_4' => '', 'posts_cat_5' => '', 'posts_cat_6' => '', 'posts_cat_7' => '', 'posts_cat_8' => '', 'posts_cat_9' => '', 'posts_cat_10' => '', 'show_image' => 0, 'image_alignment' => '', 'image_size' => '', 'show_title' => 0, 'show_byline' => 0, 'post_info' => '[post_date] ' . __('By', 'genesis') . ' [post_author_posts_link] [post_comments]', 'show_content' => 'excerpt', 'content_limit' => '', 'more_text' => __('[Read More...]', 'genesis'))); echo $before_widget; // Pull the chosen categories into an array $cats = array($instance['posts_cat_1'], $instance['posts_cat_2'], $instance['posts_cat_3'], $instance['posts_cat_4'], $instance['posts_cat_5'], $instance['posts_cat_6'], $instance['posts_cat_7'], $instance['posts_cat_8']); // Display the tab links echo '<ul class="ui-tabs-nav">'; foreach ((array) $cats as $cat) { if ($cat) { echo '<li><a href="#cat-' . $cat . '">' . get_cat_name($cat) . '</a></li>'; } } echo '</ul>'; // Loop through all chosen categories foreach ((array) $cats as $cat) { if (!$cat) { continue; } // skip iteration if $cat is empty // Custom loop $tabbed_posts = new WP_Query(array('cat' => $cat, 'showposts' => 1, 'orderby' => 'date', 'order' => 'DESC')); if ($tabbed_posts->have_posts()) { while ($tabbed_posts->have_posts()) { $tabbed_posts->the_post(); echo '<div id="cat-' . $cat . '" '; post_class('ui-tabs-hide'); echo '>'; if (!empty($instance['show_image'])) { printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), genesis_get_image(array('format' => 'html', 'size' => $instance['image_size']))); } if (!empty($instance['show_title'])) { printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } if (!empty($instance['show_byline']) && !empty($instance['post_info'])) { printf('<p class="byline post-info">%s</p>', do_shortcode(esc_html($instance['post_info']))); } if (!empty($instance['show_content'])) { if ('excerpt' == $instance['show_content']) { the_excerpt(); } elseif ('content-limit' == $instance['show_content']) { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } else { the_content(esc_html($instance['more_text'])); } } echo '</div><!--end post_class()-->' . "\n\n"; } } } echo $after_widget; wp_reset_query(); }
/** * Echo the widget content. * * @since 0.1.8 * * @global WP_Query $wp_query Query object. * @global array $_genesis_displayed_ids Array of displayed post IDs. * @global $integer $more * * @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) { global $wp_query, $_genesis_displayed_ids; //* Merge with defaults $instance = wp_parse_args((array) $instance, $this->defaults); echo $args['before_widget']; //* Set up the author bio if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title']; } $query_args = array('post_type' => 'post', 'cat' => $instance['posts_cat'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'ignore_sticky_posts' => $instance['exclude_sticky']); //* Exclude displayed IDs from this loop? if ($instance['exclude_displayed']) { $query_args['post__not_in'] = (array) $_genesis_displayed_ids; } $wp_query = new WP_Query($query_args); if (have_posts()) { while (have_posts()) { the_post(); $_genesis_displayed_ids[] = get_the_ID(); genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry')); $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-post-widget', 'attr' => genesis_parse_attr('entry-image-widget', array('alt' => get_the_title())))); if ($instance['show_image'] && $image) { $role = empty($instance['show_title']) ? '' : 'aria-hidden="true"'; printf('<a href="%s" class="%s" %s>%s</a>', get_permalink(), esc_attr($instance['image_alignment']), $role, $image); } if (!empty($instance['show_gravatar'])) { echo '<span class="' . esc_attr($instance['gravatar_alignment']) . '">'; echo get_avatar(get_the_author_meta('ID'), $instance['gravatar_size']); echo '</span>'; } if ($instance['show_title']) { echo genesis_html5() ? '<header class="entry-header">' : ''; } if (!empty($instance['show_title'])) { $title = get_the_title() ? get_the_title() : __('(no title)', 'genesis'); /** * Filter the featured post widget title. * * @since 2.2.0 * * @param string $title Featured post title. * @param array $instance { * Widget settings for this instance. * * @type string $title Widget title. * @type int $posts_cat ID of the post category. * @type int $posts_num Number of posts to show. * @type int $posts_offset Number of posts to skip when * retrieving. * @type string $orderby Field to order posts by. * @type string $order ASC fr ascending order, DESC for * descending order of posts. * @type bool $exclude_displayed True if posts shown in main output * should be excluded from this widget * output. * @type bool $show_image True if featured image should be * shown, false otherwise. * @type string $image_alignment Image alignment: alignnone, * alignleft, aligncenter or alignright. * @type string $image_size Name of the image size. * @type bool $show_gravatar True if author avatar should be * shown, false otherwise. * @type string $gravatar_alignment Author avatar alignment: alignnone, * alignleft or aligncenter. * @type int $gravatar_size Dimension of the author avatar. * @type bool $show_title True if featured page title should * be shown, false otherwise. * @type bool $show_byline True if post info should be shown, * false otherwise. * @type string $post_info Post info contents to show. * @type bool $show_content True if featured page content * should be shown, false otherwise. * @type int $content_limit Amount of content to show, in * characters. * @type int $more_text Text to use for More link. * @type int $extra_num Number of extra post titles to show. * @type string $extra_title Heading for extra posts. * @type bool $more_from_category True if showing category archive * link, false otherwise. * @type string $more_from_category_text Category archive link text. * } * @param array $args { * Widget display arguments. * * @type string $before_widget Markup or content to display before the widget. * @type string $before_title Markup or content to display before the widget title. * @type string $after_title Markup or content to display after the widget title. * @type string $after_widget Markup or content to display after the widget. * } */ $title = apply_filters('genesis_featured_post_title', $title, $instance, $args); $heading = genesis_a11y('headings') ? 'h4' : 'h2'; if (genesis_html5()) { printf('<%s class="entry-title"><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading); } else { printf('<%s><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading); } } if (!empty($instance['show_byline']) && !empty($instance['post_info'])) { printf(genesis_html5() ? '<p class="entry-meta">%s</p>' : '<p class="byline post-info">%s</p>', do_shortcode($instance['post_info'])); } if ($instance['show_title']) { echo genesis_html5() ? '</header>' : ''; } if (!empty($instance['show_content'])) { echo genesis_html5() ? '<div class="entry-content">' : ''; if ('excerpt' == $instance['show_content']) { the_excerpt(); } elseif ('content-limit' == $instance['show_content']) { the_content_limit((int) $instance['content_limit'], genesis_a11y_more_link(esc_html($instance['more_text']))); } else { global $more; $orig_more = $more; $more = 0; the_content(genesis_a11y_more_link(esc_html($instance['more_text']))); $more = $orig_more; } echo genesis_html5() ? '</div>' : ''; } genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>')); } } //* Restore original query wp_reset_query(); //* The EXTRA Posts (list) if (!empty($instance['extra_num'])) { if (!empty($instance['extra_title'])) { echo $args['before_title'] . esc_html($instance['extra_title']) . $args['after_title']; } $offset = intval($instance['posts_num']) + intval($instance['posts_offset']); $query_args = array('cat' => $instance['posts_cat'], 'showposts' => $instance['extra_num'], 'offset' => $offset); $wp_query = new WP_Query($query_args); $listitems = ''; if (have_posts()) { while (have_posts()) { the_post(); $_genesis_displayed_ids[] = get_the_ID(); $listitems .= sprintf('<li><a href="%s">%s</a></li>', get_permalink(), get_the_title()); } if (mb_strlen($listitems) > 0) { printf('<ul>%s</ul>', $listitems); } } //* Restore original query wp_reset_query(); } if (!empty($instance['more_from_category']) && !empty($instance['posts_cat'])) { printf('<p class="more-from-category"><a href="%1$s" title="%2$s">%3$s</a></p>', esc_url(get_category_link($instance['posts_cat'])), esc_attr(get_cat_name($instance['posts_cat'])), esc_html($instance['more_from_category_text'])); } echo $args['after_widget']; }
#commentspost" rel="nofollow" title="Jump to the comments"><?php comments_number('0', '1', '%'); ?> </a></div> <h2><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php the_title(); ?> </a></h2> <p><?php the_content_limit(140, ''); ?> </p> <p class="more"><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php _e('Read Full Story', 'wpzoom'); ?> »</a></p> </div><!-- end .post -->
/** * Outputs the selected content option if any * * @author Nick Croft * @since 0.1 * @version 0.2 * @param array $instance Values set in widget isntance */ function gfwa_do_post_content($instance) { if (!empty($instance['show_content'])) { if ($instance['show_content'] == 'excerpt') { the_excerpt(); } elseif ($instance['show_content'] == 'content-limit') { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } else { the_content(esc_html($instance['more_text'])); } } }
/** * Echo the widget content. * * @since 0.1.8 * * @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; /** Set up the author bio */ if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; } $query_args = array('post_type' => 'post', 'cat' => $instance['posts_cat'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order']); $featured_posts = new WP_Query($query_args); if ($featured_posts->have_posts()) { while ($featured_posts->have_posts()) { $featured_posts->the_post(); echo '<div class="' . implode(' ', get_post_class()) . '">'; if (!empty($instance['show_image'])) { printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), genesis_get_image(array('format' => 'html', 'size' => $instance['image_size']))); } if (!empty($instance['show_gravatar'])) { echo '<span class="' . esc_attr($instance['gravatar_alignment']) . '">'; echo get_avatar(get_the_author_meta('ID'), $instance['gravatar_size']); echo '</span>'; } if (!empty($instance['show_title'])) { printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } if (!empty($instance['show_byline']) && !empty($instance['post_info'])) { printf('<p class="byline post-info">%s</p>', do_shortcode($instance['post_info'])); } if (!empty($instance['show_content'])) { if ('excerpt' == $instance['show_content']) { the_excerpt(); } elseif ('content-limit' == $instance['show_content']) { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } else { the_content(esc_html($instance['more_text'])); } } echo '</div><!--end post_class()-->' . "\n\n"; } } /** The EXTRA Posts (list) */ if (!empty($instance['extra_num'])) { if (!empty($instance['extra_title'])) { echo $before_title . esc_html($instance['extra_title']) . $after_title; } $offset = intval($instance['posts_num']) + intval($instance['posts_offset']); $query_args = array('cat' => $instance['posts_cat'], 'showposts' => $instance['extra_num'], 'offset' => $offset); $extra_posts = new WP_Query($query_args); $listitems = ''; if ($extra_posts->have_posts()) { while ($extra_posts->have_posts()) { $extra_posts->the_post(); $listitems .= sprintf('<li><a href="%s" title="%s">%s</a></li>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } if (strlen($listitems) > 0) { printf('<ul>%s</ul>', $listitems); } } } if (!empty($instance['more_from_category']) && !empty($instance['posts_cat'])) { printf('<p class="more-from-category"><a href="%1$s" title="%2$s">%3$s</a></p>', esc_url(get_category_link($instance['posts_cat'])), esc_attr(get_cat_name($instance['posts_cat'])), esc_html($instance['more_from_category_text'])); } echo $after_widget; wp_reset_query(); }
function widget($args, $instance) { extract($args); /* Our variables from the widget settings. */ $title1 = apply_filters('widget_title', $instance['title1']); $color1 = $instance['color1']; $posts1 = $instance['posts1']; $category1 = get_category($instance['category1']); if ($category1) { $categoryLink1 = get_category_link($category1); } $exclude_featured = $instance['exclude_featured']; /* Exclude featured posts from Widget Posts */ $postnotin = ''; if ($exclude_featured == 'on') { $featured_posts = new WP_Query(array('post__not_in' => get_option('sticky_posts'), 'posts_per_page' => option::get('featured_number'), 'meta_key' => 'wpzoom_is_featured', 'meta_value' => 1)); while ($featured_posts->have_posts()) { $featured_posts->the_post(); global $post; $postIDs[] = $post->ID; } $postnotin = $postIDs; } /* Before widget (defined by themes). */ //echo $before_widget; $z = 0; while ($z < 1) { $z++; $color = "color{$z}"; $categoryLink = "categoryLink{$z}"; $title = "title{$z}"; $posts = "posts{$z}"; $category = $instance["category{$z}"]; ?> <div class="block"> <?php if (${$title}) { echo '<h3 class="' . ${$color} . '"><a href="' . ${$categoryLink} . '">' . ${$title} . ' »</a></h3> '; } ?> <?php $second_query = new WP_Query(array('cat' => $category, 'showposts' => ${$posts}, 'orderby' => 'date', 'post__not_in' => $postnotin, 'order' => 'DESC')); $i = 0; if ($second_query->have_posts()) { while ($second_query->have_posts()) { $second_query->the_post(); unset($image, $cropLocation); $i++; global $post; if ($i == 1) { ?> <div class="firstn"> <?php get_the_image(array('size' => 'featured-cat', 'width' => 235, 'height' => 140)); ?> <h2><a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a></h2> <small><?php printf('%s at %s', get_the_date(), get_the_time()); ?> </small> <p><?php the_content_limit(170); ?> </p> </div> <!-- A list with another 3 articles from the same category--> <div class="rightn"> <ul> <?php } else { ?> <li> <?php get_the_image(array('size' => 'featured-cat-small', 'width' => 90, 'height' => 80)); ?> <div class="rightcont"> <div class="bubble"><?php comments_popup_link('0', '1', '%', ' ', ' '); ?> </div> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a> <p><?php the_content_limit(110, ''); ?> </p> <small><?php printf('%s at %s', get_the_date(), get_the_time()); ?> </small> </div> <div style="clear:both;"></div> </li> <?php } ?> <?php } ?> </ul> <?php } else { echo '<p>'; _e('There are no posts in this category.', 'wpzoom'); echo '</p>'; } ?> </div> <div class="clear"></div> </div><!-- end .category --> <?php } // while echo ' <!-- end .featCategory -->'; /* After widget (defined by themes). */ //echo $after_widget; wp_reset_query(); }
the_permalink(); ?> " title="<?php the_title(); ?> "><?php if (strlen($post->post_title) > 35) { echo substr(the_title($before = '', $after = '', FALSE), 0, 35) . '...'; } else { the_title(); } ?> </a></h3> <?php the_content_limit(45); ?> </div> </div> <?php } ?> <?php } ?> </div> <?php
?> " alt="<?php the_title(); ?> " /></a> <?php } else { ?> <?php } ?> <?php the_content_limit(400, "[Read more]"); ?> <div style="clear:both;"></div> <div style="border-bottom:1px dotted #BBBBBB; margin-bottom:10px; padding:0px 0px 0px 0px; clear:both;"></div> <?php } ?> <?php } ?> <p><?php posts_nav_link(' — ', __('« Previous Page'), __('Next Page »')); ?>
/** * Display the default entry metadata. */ function omega_entry() { if (is_home() || is_archive() || is_search()) { if (omega_get_setting('content_archive_thumbnail')) { get_the_image(array('meta_key' => 'Thumbnail', 'default_size' => omega_get_setting('image_size'))); } if ('excerpts' === omega_get_setting('content_archive')) { if (omega_get_setting('content_archive_limit')) { the_content_limit((int) omega_get_setting('content_archive_limit'), omega_get_setting('content_archive_more')); } else { the_excerpt(); } } else { the_content(omega_get_setting('content_archive_more')); } } }
/** * Outputs the selected content option, if any. * * @param array $instance The settings for the particular instance of the widget. */ public static function do_post_content($instance) { //* Bail if empty show param if (empty($instance['show_content'])) { return; } if ('' !== $instance['show_content'] && ($pre = apply_filters('gsfc_post_content_add_entry_content', false))) { echo '<div class="entry-content">'; } switch ($instance['show_content']) { case 'excerpt': add_filter('excerpt_more', array('GS_Featured_Content', 'excerpt_more')); the_excerpt(); remove_filter('excerpt_more', array('GS_Featured_Content', 'excerpt_more')); break; case 'content-limit': the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); break; case 'content': the_content(esc_html($instance['more_text'])); break; default: do_action('gsfc_show_content'); break; } if ('' !== $instance['show_content'] && ($pre = apply_filters('gsfc_post_content_add_entry_content', false))) { echo '</div>'; } }
/** * Custom loop for listing archive page */ function pods_do_loop() { // Title and description echo '<div class="entry-category">'; echo '<h1>' . get_queried_object()->name . '</h1>'; echo term_description(get_queried_object()->term_id, 'services'); echo '</div>'; // Loop $paged = get_query_var('page') ? get_query_var('page') : 1; $args = array('post_type' => 'service', 'posts_per_page' => 10, 'paged' => $paged); if (get_queried_object()->slug != null || get_queried_object()->slug != '') { $args['tax_query'] = array(array('taxonomy' => 'services', 'field' => 'slug', 'terms' => get_queried_object()->slug)); } $services = new WP_Query($args); $count = 0; while ($services->have_posts()) { $services->the_post(); global $post; $count++; $image = genesis_get_image(array('format' => 'html', 'size' => 'img-thumb-list-archive')); if ($image == null) { $image = '<img src="' . $image . '" title = "' . get_the_title() . '" alt = "' . get_the_title() . '" class="entry-image img-thumb-list-archive alignleft" />'; } echo '<article class="content-archive-entry">'; printf('<a href="%s" title="%s" class="alignleft">%s</a>', get_permalink(), the_title_attribute('echo=0'), $image); printf('<h2 class="entry-title"><a href = "%s" title = "%s">%s</a></h2>', get_permalink(), get_the_title(), get_the_title()); if (empty($post->post_excerpt)) { the_content_limit(250, ''); } else { the_excerpt(); } echo '</article>'; } if ($services->max_num_pages > 1) { if ($paged > 1) { ?> <a href="<?php echo '?page=' . ($paged - 1); //prev link ?> "><</a> <?php } for ($i = 1; $i <= $services->max_num_pages; $i++) { ?> <a href="<?php echo '?page=' . $i; ?> " <?php echo $paged == $i ? 'class="selected"' : ''; ?> ><?php echo $i; ?> </a> <?php } if ($paged < $services->max_num_pages) { ?> <a href="<?php echo '?page=' . ($paged + 1); //next link ?> ">></a> <?php } } wp_reset_postdata(); }
/** * Echo the post content. * * On single posts or pages it echoes the full content, and optionally the trackback string if enabled. On single pages, * also adds the edit link after the content. * * Elsewhere it displays either the excerpt, limited content, or full content. * * Applies the `genesis_edit_post_link` filter. * * @since 1.1.0 * * @uses genesis_get_option() Get theme setting value. * @uses the_content_limit() Limited content. * */ function genesis_do_post_content() { if (is_singular()) { the_content(); if (is_single() && 'open' === get_option('default_ping_status') && post_type_supports(get_post_type(), 'trackbacks')) { echo '<!--'; trackback_rdf(); echo '-->' . "\n"; } if (is_page() && apply_filters('genesis_edit_post_link', true)) { edit_post_link(__('(Edit)', 'genesis'), '', ''); } } elseif ('excerpts' === genesis_get_option('content_archive')) { the_excerpt(); } else { if (genesis_get_option('content_archive_limit')) { the_content_limit((int) genesis_get_option('content_archive_limit'), genesis_a11y_more_link(__('[Read more...]', 'genesis'))); } else { the_content(genesis_a11y_more_link(__('[Read more...]', 'genesis'))); } } }
function epik_portfolio_do_post_content() { if (genesis_get_option('epik_portfolio_content') == 'excerpts') { the_excerpt(); } else { if (genesis_get_option('epik_portfolio_content_archive_limit')) { the_content_limit((int) genesis_get_option('epik_portfolio_content_archive_limit'), __('Read More', 'epik')); } else { the_content(__('Read More', 'epik')); } } }
/** * Echo the widget content. * * @since 0.9.1 * * @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) { global $wp_query, $_omega_displayed_ids; //$_omega_displayed_ids[] = get_the_ID(); extract($args); //* Merge with defaults $instance = wp_parse_args((array) $instance, $this->defaults); echo $before_widget; //* Set up the author bio if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; } $query_args = array('post_type' => 'post', 'cat' => $instance['posts_cat'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order']); //* Exclude displayed IDs from this loop? if ($instance['exclude_displayed']) { $query_args['post__not_in'] = (array) $_omega_displayed_ids; } $wp_query = new WP_Query($query_args); if (have_posts()) { while (have_posts()) { the_post(); $_omega_displayed_ids[] = get_the_ID(); echo '<article class="' . implode(' ', get_post_class()) . ' entry" itemtype="http://schema.org/BlogPosting" itemscope="itemscope">'; $image = omega_get_image(array('format' => 'html', 'size' => $instance['image_size'])); if ($instance['show_image'] && $image) { printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $image); } if (!empty($instance['show_gravatar'])) { echo '<span class="' . esc_attr($instance['gravatar_alignment']) . '">'; echo get_avatar(get_the_author_meta('ID'), $instance['gravatar_size']); echo '</span>'; } if ($instance['show_title']) { echo '<header class="entry-header">'; } if (!empty($instance['show_title'])) { printf('<h2 class="entry-title"><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } if (!empty($instance['show_byline']) && !empty($instance['post_info'])) { printf('<p class="entry-meta">%s</p>', do_shortcode($instance['post_info'])); } if ($instance['show_title']) { echo '</header>'; } if (!empty($instance['show_content'])) { echo '<div class="entry-content">'; if ('excerpt' == $instance['show_content']) { the_excerpt(); } elseif ('content-limit' == $instance['show_content']) { the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text'])); } else { global $more; $orig_more = $more; $more = 0; the_content(esc_html($instance['more_text'])); $more = $orig_more; } echo '</div>'; } echo '</article>'; } } //* Restore original query wp_reset_query(); //* The EXTRA Posts (list) if (!empty($instance['extra_num'])) { if (!empty($instance['extra_title'])) { echo $before_title . esc_html($instance['extra_title']) . $after_title; } $offset = intval($instance['posts_num']) + intval($instance['posts_offset']); $query_args = array('cat' => $instance['posts_cat'], 'showposts' => $instance['extra_num'], 'offset' => $offset); $wp_query = new WP_Query($query_args); $listitems = ''; if (have_posts()) { while (have_posts()) { the_post(); $_omega_displayed_ids[] = get_the_ID(); $listitems .= sprintf('<li><a href="%s" title="%s">%s</a></li>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } if (mb_strlen($listitems) > 0) { printf('<ul>%s</ul>', $listitems); } } //* Restore original query wp_reset_query(); } if (!empty($instance['more_from_category']) && !empty($instance['posts_cat'])) { printf('<p class="more-from-category"><a href="%1$s" title="%2$s">%3$s</a></p>', esc_url(get_category_link($instance['posts_cat'])), esc_attr(get_cat_name($instance['posts_cat'])), esc_html($instance['more_from_category_text'])); } echo $after_widget; }
function femme_grid_loop_content() { global $_genesis_loop_args; if (in_array('genesis-feature', get_post_class())) { // if the post is a feature if ($_genesis_loop_args['feature_image_size']) { $image = genesis_get_image(array('size' => $_genesis_loop_args['feature_image_size'], 'context' => 'grid-loop-featured', 'attr' => genesis_parse_attr('entry-image-grid-loop', array('class' => $_genesis_loop_args['feature_image_class'])))); printf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $image); } if ($_genesis_loop_args['feature_content_limit']) { the_content_limit((int) $_genesis_loop_args['feature_content_limit'], esc_html($_genesis_loop_args['more'])); } else { the_content(esc_html($_genesis_loop_args['more'])); } } else { // The post is a teaser $default_img = '<img class="post-image" itemprop="image" src="' . CUTTZ_CORE_SKINS_URL . '/femme-flora/images/femme-default-img.png" alt="Femme-Flora" />'; if ($_genesis_loop_args['grid_image_size']) { $image = genesis_get_image(array('size' => $_genesis_loop_args['grid_image_size'], 'context' => 'grid-loop', 'attr' => genesis_parse_attr('entry-image-grid-loop', array('class' => $_genesis_loop_args['grid_image_class'])))); printf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), empty($image) ? $default_img : $image); } if ($_genesis_loop_args['grid_content_limit'] == 'no_content') { printf(__('%sClick to read more…%s', 'cuttz-framework'), '<a href="' . get_permalink() . '" class="more-link"><span class="more-link-content">', '</span></a>'); } elseif ($_genesis_loop_args['grid_content_limit']) { the_content_limit((int) $_genesis_loop_args['grid_content_limit'], esc_html($_genesis_loop_args['more'])); } else { //the_excerpt(); printf('<a href="%s" class="more-link">%s</a>', get_permalink(), esc_html($_genesis_loop_args['more'])); } } }
<?php if (is_archive() || is_search()) { // Only display Excerpts for archives & search ?> <div class="entry-summary"> <?php the_content_limit('40'); /*the_excerpt_rss();*/ ?> </div><!-- .entry-summary --> <?php } else { ?> <div class="entry-content"> <?php the_content_limit('55'); /*the_excerpt_rss();*/ ?> <?php wp_link_pages(array('before' => '<div class="page-link">' . __('Pages:', 'themename'), 'after' => '</div>')); ?> </div><!-- .entry-content --> <?php } ?> </div> </div> </div> </div> <?php
?> " rel="bookmark"><img style="float:left;margin:0px 10px 0px 0px;"src="<?php bloginfo('template_url'); ?> /images/thumbnail.png" alt="<?php the_title(); ?> " /></a> <?php } ?> <?php the_content_limit(400, "[Read more about this property]"); ?> <div style="clear:both;"></div> <div style="border-bottom:1px dotted #BBBBBB; margin-bottom:10px; padding:0px 0px 0px 0px; clear:both;"></div> <?php } ?> <p><?php posts_nav_link(); ?> </p> </div>