function genesis_do_post_image()
{
    if (!is_singular() && genesis_get_option('content_archive_thumbnail')) {
        $img = genesis_get_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'attr' => array('class' => 'alignleft post-image')));
        printf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $img);
    }
}
function sk_image()
{
    $image_args = array('size' => 'masonry-thumb');
    // Get the featured image HTML
    $image = genesis_get_image($image_args);
    echo '<a rel="bookmark" href="' . get_permalink() . '">' . $image . '</a>';
}
Example #3
0
function post_format_image_featured()
{
    if (has_post_format('image') && has_post_thumbnail() && is_singular('post')) {
        $img = genesis_get_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'attr' => array('class' => 'post-image')));
        printf('<a href="%s" id="featured-post-image" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $img);
    }
}
/**
 * Output the image
 * We're only going to link the image if there's something to link to
 */
function rmb_add_image()
{
    $imageclass = 'alignright member-single-image';
    if ($image = genesis_get_image('format=url&size=member-image')) {
        printf('<div class="portfolio-image"><img class="%s" src="%s" alt="%s" /></div>', $imageclass, $image, the_title_attribute('echo=0'));
    }
}
 /**
  * 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;
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     $query_args = array('post_type' => 'listing', 'taxonomy' => $instance['taxonomy'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order']);
     // Exclude displayed IDs from this loop?
     global $post;
     $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><div class="listing-wrap">', 'xhtml' => sprintf('<div class="%s"><div class="listing-wrap">', 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')));
             if ($instance['show_image']) {
                 if ($image) {
                     printf('<a href="%s" alt="%s">%s</a>', esc_url(get_permalink()), esc_attr(the_title_attribute('echo=0')), wp_kses_post($image));
                 } else {
                     $fallback = plugins_url('includes/sample-images/simple-listings.png', dirname(__FILE__));
                     printf('<a href="%s"><img src="%s" alt="%s" />', esc_url(get_permalink()), esc_url($fallback), esc_attr(the_title_attribute('echo=0')));
                 }
             }
             if ($instance['show_title']) {
                 echo genesis_html5() ? '<header class="entry-header">' : '';
             }
             if (!empty($instance['show_title'])) {
                 printf('<h2 class="entry-title">%s</h2>', the_title_attribute('echo=0'), get_the_title());
             }
             if (!empty($instance['show_status'])) {
                 echo '<span class="listing-status">' . strip_tags(get_the_term_list($post->ID, 'status', '', ', ', '')) . '</span>';
             }
             if ($instance['show_title']) {
                 echo genesis_html5() ? '</header>' : '';
             }
             if (!empty($instance['show_content'])) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 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' => '</div></article>', 'xhtml' => '</div></div>'));
         }
     }
     if (!empty($instance['archive_link']) && !empty($instance['archive_text'])) {
         printf('<p class="more-from-category"><a href="%1$s">%2$s</a></p>', esc_url(get_post_type_archive_link($instance['post_type'])), esc_html($instance['archive_text']));
     }
     // Restore original query
     wp_reset_query();
     echo $after_widget;
 }
Example #6
0
function single_post_featured_image()
{
    if (!is_singular()) {
        return;
    }
    $img = genesis_get_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'attr' => array('class' => 'post-image')));
    printf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $img);
}
 function widget($args, $instance)
 {
     /** defaults */
     $instance = wp_parse_args($instance, array('title' => '', 'posts_per_page' => 10));
     extract($args);
     echo $before_widget;
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     $toggle = '';
     /** for left/right class */
     $query_args = array('post_type' => 'listing', 'posts_per_page' => $instance['posts_per_page'], 'paged' => get_query_var('paged') ? get_query_var('paged') : 1);
     query_posts($query_args);
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             //* initialze the $loop variable
             $loop = '';
             //* Pull all the listing information
             $custom_text = genesis_get_custom_field('_listing_text');
             $price = genesis_get_custom_field('_listing_price');
             $address = genesis_get_custom_field('_listing_address');
             $city = genesis_get_custom_field('_listing_city');
             $state = genesis_get_custom_field('_listing_state');
             $zip = genesis_get_custom_field('_listing_zip');
             $loop .= sprintf('<a href="%s">%s</a>', get_permalink(), genesis_get_image(array('size' => 'properties')));
             if ($price) {
                 $loop .= sprintf('<span class="listing-price">%s</span>', $price);
             }
             if (strlen($custom_text)) {
                 $loop .= sprintf('<span class="listing-text">%s</span>', esc_html($custom_text));
             }
             if ($address) {
                 $loop .= sprintf('<span class="listing-address">%s</span>', $address);
             }
             if ($city || $state || $zip) {
                 //* count number of completed fields
                 $pass = count(array_filter(array($city, $state, $zip)));
                 //* If only 1 field filled out, no comma
                 if (1 == $pass) {
                     $city_state_zip = $city . $state . $zip;
                 } elseif ($city) {
                     $city_state_zip = $city . ", " . $state . " " . $zip;
                 } else {
                     $city_state_zip = $city . " " . $state . ", " . $zip;
                 }
                 $loop .= sprintf('<span class="listing-city-state-zip">%s</span>', trim($city_state_zip));
             }
             $loop .= sprintf('<a href="%s" class="more-link">%s</a>', get_permalink(), __('View Listing', 'agentpress-listings'));
             $toggle = $toggle == 'left' ? 'right' : 'left';
             /** wrap in post class div, and output **/
             printf('<div class="%s"><div class="widget-wrap"><div class="listing-wrap">%s</div></div></div>', join(' ', get_post_class($toggle)), apply_filters('agentpress_featured_listings_widget_loop', $loop));
         }
     }
     wp_reset_query();
     echo $after_widget;
 }
Example #8
0
function streamline_post_image()
{
    if (is_page()) {
        return;
    }
    if ($image = genesis_get_image('format=url&size=post-image')) {
        printf('<a href="%s" rel="bookmark"><img class="post-photo" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute('echo=0'));
    }
}
Example #9
0
/**
 * Display the image
 * 
 * We know it's an image since the file is image.php
 */
function genesis_image_do_entry_content()
{
    $img = genesis_get_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'context' => 'archive', 'attr' => genesis_parse_attr('entry-image')));
    if (!empty($img)) {
        echo $img;
    } else {
        //echo "Not got it yet";
    }
}
Example #10
0
function generate_post_image()
{
    if (is_page() || !genesis_get_option('content_archive_thumbnail')) {
        return;
    }
    if ($image = genesis_get_image(array('format' => 'url', 'size' => genesis_get_option('image_size')))) {
        printf('<a href="%s" rel="bookmark"><img class="post-image" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute('echo=0'));
    }
}
/**
 * Pulls an image from media gallery
 * and echos it
 *
 * @since 0.1
 */
function genesis_image($args = array())
{
    $image = genesis_get_image($args);
    if ($image) {
        echo $image;
    } else {
        return FALSE;
    }
}
Example #12
0
function wpbilbao_featured_photo()
{
    if (is_page() || !genesis_get_option('content_archive_thumbnail')) {
        return;
    }
    if ($image = genesis_get_image(array('format' => 'url', 'size' => genesis_get_option('image_size')))) {
        printf('<div class="featured-image"><img src="%s" alt="%s" class="entry-image"/></div>', $image, the_title_attribute('echo=0'));
    }
}
function genawpcomm_awp_community_grid()
{
    if ($image = genesis_get_image('format=url&size=awp-feature-community')) {
        printf('<div class="awp-community-image"><div class="community-featured-image"><a href="%s" rel="bookmark"><img src="%s" alt="%s" /></a></div>', get_permalink(), $image, the_title_attribute('echo=0'));
    }
    echo '<header class="entry-header">';
    printf('<h2 class="entry-title"><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
    echo '</header>';
}
Example #14
0
function decor_post_image()
{
    if (is_page()) {
        return;
    }
    if ($image = genesis_get_image('format=url&size=post-image')) {
        printf('<a href="%s" rel="bookmark" class="post-photo"><div class="post-date">%s</div><img src="%s" alt="%s" /></a>', get_permalink(), do_shortcode('<em>[post_date format="j"]</em>[post_date format="F Y"]'), $image, the_title_attribute('echo=0'));
    }
}
function one_pager_display_posts_shortcode_output($output, $atts, $image, $title, $date, $excerpt, $inner_wrapper, $content, $class)
{
    $title = '<h3 itemprop="headline" class="entry-title">' . apply_filters('the_title', get_the_title()) . '</h3>';
    if ($atts['image_size']) {
        $image = '<div class="portfolio-image"><a rel="prettyPhoto[pp_gal]" href="' . genesis_get_image(array('format' => 'url')) . '">' . genesis_get_image(array('format' => 'html', 'size' => 'portfolio')) . '</a></div> ';
    } else {
        $image = '';
    }
    $output = '<' . $inner_wrapper . ' class="' . implode(' ', $class) . '">' . $title . $image . $date . $excerpt . $content . '</' . $inner_wrapper . '>';
    return $output;
}
 /**
  * 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;
 }
/**
 * FAQ loop.
 * We're replacing the Genesis loop with our own.
 */
function rbfaq_archive_loop()
{
    $count = 0;
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            //* Set up the count
            $count++;
            //* Figure out what class to apply to the image
            //* If the image
            if ($count % 2 == 0) {
                $imageclass = 'member-image member-image-left';
            } else {
                $imageclass = 'member-image member-image-right';
            }
            printf('<div class="%s">', implode(' ', get_post_class('member-section')));
            /**
             * Output the image
             * We're only going to link the image if there's something to link to
             */
            if (get_the_content() && ($image = genesis_get_image('format=url&size=member-image'))) {
                printf('<div class="portfolio-image"><a href="%s" rel="bookmark"><img class="%s" src="%s" alt="%s" /></a></div>', get_permalink(), $imageclass, $image, the_title_attribute('echo=0'));
            } elseif ($image = genesis_get_image('format=url&size=member-image')) {
                printf('<div class="portfolio-image"><img class="%s" src="%s" alt="%s" /></div>', $imageclass, $image, the_title_attribute('echo=0'));
            }
            echo '<div class="member-content">';
            edit_post_link('Edit this member', '<small>', '</small>', '');
            //* Only link the title if there's some content to link to
            if (get_the_content()) {
                printf('<h2 class="entry-title"><a href="%s">%s</a></h2>', get_the_permalink(), get_the_title());
            } else {
                printf('<h2 class="entry-title">%s</h2>', get_the_title());
            }
            //* Add the member's title
            global $post;
            $title = get_post_meta(get_the_ID(), '_rbm_members_title', true);
            if ($title) {
                printf('<h4 class="member-subtitle">%s</h4>', $title);
            }
            echo '<p>';
            the_excerpt_max_charlength(250);
            echo '</p>';
            if (get_the_content()) {
                printf('<a class="button" href="%s">Read more</a>', get_the_permalink());
            }
            echo '</div>';
            // .member-content
            echo '</div>';
            // the post_class() div
        }
        // end while
    }
    // end if
}
 /**
  * Outputs the content of the widget
  *
  * @param array $args
  * @param array $instance
  */
 public function widget($args, $instance)
 {
     switch ($instance['style']) {
         case "style1":
             wp_enqueue_style('badabing_team', BADABING_ESSENTIALS_URL . 'widgets/badabing.team.css', false, '1.0.0', 'screen');
             wp_enqueue_script('badabing_teamjs', BADABING_ESSENTIALS_URL . 'widgets/badabing.team.js', array('jquery'), '1.0.0');
             break;
         case "style2":
             break;
     }
     global $wp_query;
     // outputs the content of the widget
     echo $args['before_widget'];
     $args = array('post_type' => 'post', 'cat' => $instance['posts_cat'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order']);
     $wp_query = new WP_query($args);
     if (have_posts()) {
         $picnum = 1;
         while (have_posts()) {
             the_post();
             $image = genesis_get_image(array('format' => 'url', 'size' => $instance['image_size'], 'fallback' => array('url' => $instance['fallbackurl'])));
             $the_pictures .= sprintf('          <li class="quote%s"><a href="%s"><img src="%s" alt="%s"></a></li>', $picnum, 'javascript:void();', $image, get_the_title());
             if ($instance['show_quotes']) {
                 $the_quotes .= sprintf('          <li class="quote%s"><p>%s</p></li>', $picnum, get_the_content());
             }
             $picnum++;
         }
         echo '<div class="testimonials">';
         printf('    <h3>%s</h3>', $instance['title']);
         echo '    <div class="container">';
         echo '      <div class="photos">';
         echo '        <ul class="clearfix">';
         echo $the_pictures;
         echo '        </ul>';
         echo '        <div class="author"></div>';
         // leave empty, this will be filled using jquery
         echo '      </div>';
         if ($instance['show_quotes']) {
             echo '      <div class="quotes">';
             echo '        <ul>';
             echo $the_quotes;
             echo '        </ul>';
             echo '      </div>';
         }
         echo ' <div style="clear:both;"></div>';
         echo '    </div>';
         echo '</div>';
     } else {
         printf('<!-- %s -->', __('Nothing to see here', 'bbessentials'));
     }
     wp_reset_query();
     echo $args['after_widget'];
 }
 /**
  * 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;
 }
Example #20
0
/**
 * Filter the loop output of the AgentPress Featured Listings Widget.
 *
 */
function agentpress_featured_listings_widget_loop_filter($loop)
{
    $loop = '';
    /** initialze the $loop variable */
    $loop .= sprintf('<a href="%s">%s</a>', get_permalink(), genesis_get_image(array('size' => 'properties')));
    $loop .= sprintf('<span class="listing-price">%s</span>', genesis_get_custom_field('_listing_price'));
    $custom_text = genesis_get_custom_field('_listing_text');
    if (strlen($custom_text)) {
        $loop .= sprintf('<span class="listing-text">%s</span>', esc_html($custom_text));
    }
    $loop .= sprintf('<span class="listing-address">%s</span>', genesis_get_custom_field('_listing_address'));
    $loop .= sprintf('<span class="listing-city-state-zip">%s %s, %s</span>', genesis_get_custom_field('_listing_city'), genesis_get_custom_field('_listing_state'), genesis_get_custom_field('_listing_zip'));
    $loop .= sprintf('<a href="%s" class="more-link">%s</a>', get_permalink(), __('View Listing', 'apl'));
    return $loop;
}
Example #21
0
function msd_post_image()
{
    global $post;
    //setup thumbnail image args to be used with genesis_get_image();
    if (get_post_type() == 'page') {
        $size = 'sidebar-image';
        // Change this to whatever add_image_size you want
    } else {
        $size = 'post-thumb';
        // Change this to whatever add_image_size you want
    }
    $default_attr = array('class' => "aligncenter attachment-{$size} {$size}", 'alt' => $post->post_title, 'title' => $post->post_title);
    // This is the most important part!  Checks to see if the post has a Post Thumbnail assigned to it. You can delete the if conditional if you want and assume that there will always be a thumbnail
    if (has_post_thumbnail()) {
        printf('%s', genesis_get_image(array('size' => $size, 'attr' => $default_attr)));
    }
}
 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(' &middot; ');
                 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 sbg_staff_grid()
{
    if ($image = genesis_get_image('format=url&size=staff-member')) {
        printf('<div class="staff-featured-image"><a class="thickbox"' . 'title="' . get_the_title() . '"' . ' href="#TB_inline?height=300&width=600&inlineId=%s"><img src="%s" alt="%s" /></a></div>', sbg_thethickboxcontent(), $image, the_title_attribute('echo=0'));
        echo '<div class="title-meta">';
        genesis_do_post_title();
        genesis_post_meta();
        echo '</div>';
    } else {
        echo '<div class="staff-featured-image">';
        echo '<img src="' . plugins_url('/img/sampleimg.jpg', dirname(dirname(__FILE__))) . '"/>';
        echo '<div class="title-meta">';
        genesis_do_post_title();
        genesis_post_meta();
        echo '</div>';
        echo '</div>';
    }
}
 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();
 }
Example #25
0
/**
 * Manipulate the featured image
 */
function msd_post_image()
{
    global $post;
    //setup thumbnail image args to be used with genesis_get_image();
    $size = 'post-image';
    // Change this to whatever add_image_size you want
    $default_attr = array('class' => "attachment-{$size} {$size}", 'alt' => $post->post_title, 'title' => $post->post_title);
    // This is the most important part!  Checks to see if the post has a Post Thumbnail assigned to it. You can delete the if conditional if you want and assume that there will always be a thumbnail
    if (has_post_thumbnail() && is_page()) {
        msdlab_page_banner();
    } elseif (has_post_thumbnail() && is_cpt('project')) {
        if (is_single()) {
            msdlab_page_banner();
        }
    } elseif (has_post_thumbnail()) {
        print '<section class="header-image">';
        printf('<a title="%s" href="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), genesis_get_image(array('size' => $size, 'attr' => $default_attr)));
        print '</section>';
    }
}
Example #26
0
/**
 * Custom loop for listing archive page
 */
function discovery_listing_archive_loop()
{
    $toggle = '';
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            $loop = '';
            // init
            $loop .= sprintf('<a href="%s">%s</a>', get_permalink(), genesis_get_image(array('size' => 'properties')));
            $loop .= sprintf('<span class="listing-price">%s</span>', genesis_get_custom_field('_listing_price'));
            $loop .= sprintf('<span class="listing-text">%s</span>', genesis_get_custom_field('_listing_text'));
            $loop .= sprintf('<span class="listing-address">%s</span>', genesis_get_custom_field('_listing_address'));
            $loop .= sprintf('<span class="listing-city-state-zip">%s, %s %s</span>', genesis_get_custom_field('_listing_city'), genesis_get_custom_field('_listing_state'), genesis_get_custom_field('_listing_zip'));
            $loop .= sprintf('<a href="%s" class="more-link">%s</a>', get_permalink(), __('View Listing', 'discovery'));
            $toggle = $toggle == 'left' ? 'right' : 'left';
            /** wrap in post class div, and output **/
            printf('<div class="%s"><div class="widget-wrap"><div class="listing-wrap">%s</div></div></div>', join(' ', get_post_class($toggle)), $loop);
        }
    }
}
function simpleportfoliogenesis_archive_images()
{
    $image = genesis_get_image('format=url&size=simpleportfolio');
    if (!$image) {
        $image = plugins_url('views/simple-portfolio.png', dirname(__FILE__));
    }
    $project_link = get_post_meta(get_the_ID(), '_simpleportfoliogenesis_link', true);
    $permalink = get_permalink();
    $content = get_the_content();
    $link = empty($content) && $project_link ? $project_link : null;
    $output = '';
    if ($link) {
        $output = sprintf('<a href="%s" target="_blank">', $link);
    } elseif ($content) {
        $output = sprintf('<a href="%s">', $permalink);
    }
    if ($image) {
        $output .= sprintf('<img src="%s" alt="%s" class="aligncenter" />', $image, the_title_attribute('echo=0'));
    }
    if ($content || $link) {
        $output .= '</a>';
    }
    echo wp_kses_post($output);
}
 /**
  * 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'];
 }
function expose_homepage_teaser_image()
{
    global $loop_counter;
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    printf('<p><a href="%s">%s</a></p>', get_permalink(), genesis_get_image(array('format' => 'html', 'size' => 'Featured')));
}
function single_post_featured_image()
{
    $img = genesis_get_image(array('format' => 'html', 'size' => 'full', 'attr' => array('class' => 'post-image')));
    //printf( '<div class="banner-image"><a href="%s" title="%s">%s</a></div>', get_permalink(), the_title_attribute( 'echo=0' ), $img );
    printf('<div class="banner-image">%s<h1 class="entry-title">%s</h1></div>', $img, get_the_title());
}