/**
  * Add Menu Cart to menu
  * 
  * @return menu items including cart
  */
 public function submenu_items()
 {
     $get_cart = jigoshop_cart::get_cart();
     $submenu_items = '';
     //see jigoshop/widgets/cart.php
     if (count($get_cart) > 0) {
         foreach ($get_cart as $cart_item_key => $values) {
             $_product = $values['data'];
             if ($_product->exists() && $values['quantity'] > 0) {
                 $item_thumbnail = has_post_thumbnail($_product->id) ? get_the_post_thumbnail($_product->id, 'shop_tiny') : jigoshop_get_image_placeholder('shop_tiny');
                 $item_name = $_product->get_title();
                 // Not used: Displays variations and cart item meta
                 $item_meta = jigoshop_cart::get_item_data($values);
                 $item_quantity = esc_attr($values['quantity']);
                 $item_price = $_product->get_price_html();
                 // Item permalink
                 $item_permalink = esc_attr(get_permalink($_product->id));
                 $submenu_items[] = array('item_thumbnail' => $item_thumbnail, 'item_name' => $item_name, 'item_quantity' => $item_quantity, 'item_price' => $item_price, 'item_permalink' => $item_permalink);
             }
         }
     } else {
         $submenu_items = '';
     }
     return $submenu_items;
 }
Exemplo n.º 2
0
    function airballoon_display_custom_header()
    {
        // Get Theme Options from Database
        $options = get_option('zeenoble_options');
        // Don't display header image on template-frontpage.php
        if (is_page_template('template-frontpage.php')) {
            return;
        }
        // Don't display header image when "display frontpage template automatically on home page" option is activated
        if (is_front_page() and isset($options['themeZee_frontpage_activate']) and $options['themeZee_frontpage_activate'] == 'true') {
            return;
        }
        // Check if page is displayed and featured header image is used
        if (is_page() && has_post_thumbnail()) {
            ?>
			<div id="custom-header">
				<?php 
            the_post_thumbnail('frontpage_slider_image');
            ?>
			</div>
<?php 
            // Check if there is a custom header image
        } elseif (get_header_image()) {
            ?>
			<div id="custom-header">
				<img src="<?php 
            echo get_header_image();
            ?>
" />
			</div>
<?php 
        }
    }
Exemplo n.º 3
0
 function end_el(&$output, $item, $depth = 0, $args = array())
 {
     if ($depth == 0 && $item->object == 'category') {
         $output .= "<div class='subcat'>";
         for ($i = 0; $i < count($item->children); $i++) {
             $child = $item->children[$i];
             $output .= "<div class='" . ($i === 0 ? 'active' : '') . "' id='mn-latest-" . $child->ID . "'>";
             //$output .="<h5>".$child->title."</h5>";
             $output .= "<ul id='mn-latest-" . $child->ID . "'>";
             if ($child->object == 'category') {
                 $r = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => 5, 'no_found_rows' => true, 'post_status' => 'publish', 'cat' => $child->object_id)));
                 if ($r->have_posts()) {
                     while ($r->have_posts()) {
                         $r->the_post();
                         $output .= "<li ";
                         if (has_post_thumbnail()) {
                             $output .= "class='has-thumbnail' ";
                         }
                         $output .= "><div class='subcat-thumbnail'><a href='" . get_permalink() . "' title='" . get_the_title() . "'>" . get_the_post_thumbnail(get_the_ID(), array(40, 40)) . "</a></div><div class='subcat-title'><a href='" . get_permalink() . "' title='" . get_the_title() . "'> " . get_the_title() . "</a><span> - " . dw_human_time_diff(get_the_time('U'), current_time('timestamp')) . "</span></div></li>";
                     }
                     // Reset the global $the_post as this query will have stomped on it
                     wp_reset_postdata();
                 }
             }
             $output .= "</ul>";
             $output .= "<a href='" . $child->url . "' title='" . $child->attr_title . "'>View all</a>";
             $output .= "</div>";
         }
         $output .= "</div> \n</div>\n";
     } else {
     }
     $output .= "</li>\n";
 }
Exemplo n.º 4
0
function lifestyle_banner()
{
    ?>
	<div class="banner">
		<div class="wrap">
			<?php 
    if (is_front_page()) {
        lifestyle_get_home_banner();
    } elseif (!is_front_page() && get_theme_mod('lifestyle_header_home')) {
        echo '';
    } else {
        // get title
        $id = get_option('page_for_posts');
        if (is_home() || is_singular('post')) {
            if (has_post_thumbnail($id)) {
                echo get_the_post_thumbnail($id, 'full');
            }
        } elseif (has_post_thumbnail() && is_singular('page')) {
            the_post_thumbnail();
        }
    }
    ?>
		</div><!-- .wrap -->
  	</div><!-- .banner -->
<?php 
}
function al_portfolio_meta_tags()
{
    $post_type = get_post_type();
    if ('portfolio' == $post_type) {
        $title = get_post_meta(get_the_ID(), "al_pf_og_title", TRUE);
        $title = !empty($title) ? $title : get_the_title();
        $meta = array('og:title' => $title, 'og:url' => get_permalink());
        $desc = get_post_meta(get_the_ID(), "al_pf_og_description", TRUE);
        $desc = !empty($desc) ? $desc : false;
        if ($desc) {
            $meta['og:description'] = $desc;
        }
        if (has_post_thumbnail()) {
            $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $meta['og:image'] = $thumbnail[0];
        }
        if (get_post_format() == 'gallery') {
            $images = rwmb_meta('al_pf_gallery_images', 'type=image&size=full');
            if (is_array($images)) {
                foreach ($images as $image) {
                    $meta['images'][] = $image['url'];
                }
            }
        }
        foreach ($meta as $key => $value) {
            if ($key == 'images') {
                foreach ($value as $image) {
                    echo '<meta property="og:image" content="' . $image . '" />';
                }
            } else {
                echo '<meta property="' . $key . '" content="' . $value . '" />';
            }
        }
    }
}
Exemplo n.º 6
0
function thinkup_input_stylelayout_class2()
{
    global $post;
    if (has_post_thumbnail($post->ID)) {
        echo ' four_fifth last';
    }
}
Exemplo n.º 7
0
 /**
  * Compile the schema.org event data into an array
  */
 public function get_data($post = null, $args = array())
 {
     if (!$post instanceof WP_Post) {
         $post = Tribe__Main::post_id_helper($post);
     }
     $post = get_post($post);
     if (!$post instanceof WP_Post) {
         return array();
     }
     $data = (object) array();
     // We may need to prevent the context to be triggered
     if (!isset($args['context']) || false !== $args['context']) {
         $data->{'@context'} = 'http://schema.org';
     }
     $data->{'@type'} = $this->type;
     $data->name = esc_js(get_the_title($post));
     $data->description = esc_js(tribe_events_get_the_excerpt($post));
     if (has_post_thumbnail($post)) {
         $data->image = wp_get_attachment_url(get_post_thumbnail_id($post));
     }
     $data->url = esc_url_raw(get_permalink($post));
     // Index by ID: this will allow filter code to identify the actual event being referred to
     // without injecting an additional property
     return array($post->ID => $data);
 }
 /**
  * Compile the schema.org event data into an array
  */
 private function build_data()
 {
     global $post;
     $id = $post->ID;
     $events_data = array();
     // Index by ID: this will allow filter code to identify the actual event being referred to
     // without injecting an additional property
     $events_data[$id] = new stdClass();
     $events_data[$id]->{'@context'} = 'http://schema.org';
     $events_data[$id]->{'@type'} = 'Event';
     $events_data[$id]->name = get_the_title();
     if (has_post_thumbnail()) {
         $events_data[$id]->image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
     }
     $events_data[$id]->url = get_the_permalink($post->ID);
     $events_data[$id]->startDate = get_gmt_from_date(tribe_get_start_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
     $events_data[$id]->endDate = get_gmt_from_date(tribe_get_end_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
     if (tribe_has_venue($id)) {
         $events_data[$id]->location = new stdClass();
         $events_data[$id]->location->{'@type'} = 'Place';
         $events_data[$id]->location->name = tribe_get_venue($post->ID);
         $events_data[$id]->location->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID)));
     }
     /**
      * Allows the event data to be modifed by themes and other plugins.
      *
      * @param array $events_data objects representing the Google Markup for each event.
      */
     $events_data = apply_filters('tribe_google_event_data', $events_data);
     // Strip the post ID indexing before returning
     $events_data = array_values($events_data);
     return $events_data;
 }
Exemplo n.º 9
0
 /**
  * Widget
  * Display the widget in the sidebar
  * Save output to the cache if empty
  *
  * @param  array  sidebar arguments
  * @param  array  instance
  */
 public function widget($args, $instance)
 {
     // Hide widget if page is the cart or checkout
     if (is_cart() || is_checkout()) {
         return false;
     }
     extract($args);
     // Set the widget title
     $title = apply_filters('widget_title', $instance['title'] ? $instance['title'] : __('Cart', 'fflcommerce'), $instance, $this->id_base);
     // Print the widget wrapper & title
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     // Get the contents of the cart
     $cart_contents = fflcommerce_cart::$cart_contents;
     // If there are items in the cart print out a list of products
     if (!empty($cart_contents)) {
         // Open the list
         echo '<ul class="cart_list">';
         foreach ($cart_contents as $key => $value) {
             // Get product instance
             $_product = $value['data'];
             if ($_product->exists() && $value['quantity'] > 0) {
                 echo '<li>';
                 // Print the product image & title with a link to the permalink
                 echo '<a href="' . esc_attr(get_permalink($_product->id)) . '" title="' . esc_attr($_product->get_title()) . '">';
                 // Print the product thumbnail image if exists else display placeholder
                 echo has_post_thumbnail($_product->id) ? get_the_post_thumbnail($_product->id, 'shop_tiny') : fflcommerce_get_image_placeholder('shop_tiny');
                 // Print the product title
                 echo '<span class="js_widget_product_title">' . $_product->get_title() . '</span>';
                 echo '</a>';
                 // Displays variations and cart item meta
                 echo fflcommerce_cart::get_item_data($value);
                 // Print the quantity & price per product
                 echo '<span class="js_widget_product_price">' . $value['quantity'] . ' &times; ' . $_product->get_price_html() . '</span>';
                 echo '</li>';
             }
         }
         echo '</ul>';
         // Close the list
         // Print the cart total
         echo '<p class="total"><strong>';
         echo __('Subtotal', 'fflcommerce');
         echo ':</strong> ' . fflcommerce_price($this->total_cart_items());
         echo '</p>';
         do_action('fflcommerce_widget_cart_before_buttons');
         // Print view cart & checkout buttons
         $view_cart_button_label = isset($instance['view_cart_button']) ? $instance['view_cart_button'] : __('View Cart &rarr;', 'fflcommerce');
         $checkout_button_label = isset($instance['checkout_button']) ? $instance['checkout_button'] : __('Checkout &rarr;', 'fflcommerce');
         echo '<p class="buttons">';
         echo '<a href="' . esc_attr(fflcommerce_cart::get_cart_url()) . '" class="button">' . __($view_cart_button_label, 'fflcommerce') . '</a>';
         echo '<a href="' . esc_attr(fflcommerce_cart::get_checkout_url()) . '" class="button checkout">' . __($checkout_button_label, 'fflcommerce') . '</a>';
         echo '</p>';
     } else {
         echo '<span class="empty">' . __('No products in the cart.', 'fflcommerce') . '</span>';
     }
     // Print closing widget wrapper
     echo $after_widget;
 }
Exemplo n.º 10
0
function getImageByPost($post)
{
    $cate = get_the_category();
    //echo $cate[0]->cat_ID;
    //$post->post_parent->term_id
    if (has_post_thumbnail($post->ID)) {
        $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium');
        $image = $image[0];
        return $image;
    } elseif (strlen($catImageUrl = getCategoryImage($cate[0]->cat_ID)) > 0) {
        return $catImageUrl;
    } elseif (strlen(getFirstImage($post->ID)) > 0) {
        $image = getFirstImage($post->ID);
        return $image;
    } else {
        $theme = get_option('themes');
        if ($theme == '10') {
            return get_stylesheet_directory_uri() . '/asset/img/themes/post-default10.jpg';
            // TODO 常量化
        } elseif ($theme == 11) {
            return get_stylesheet_directory_uri() . '/asset/img/themes/post-default11.jpg';
        } elseif ($theme == 12) {
            return get_stylesheet_directory_uri() . '/asset/img/themes/post-default12.jpg';
        } else {
            return get_stylesheet_directory_uri() . '/asset/img/themes/post-default10.jpg';
            // TODO
        }
    }
}
Exemplo n.º 11
0
function get_tour_info()
{
    $tourinfo = array();
    $tour_ID = get_the_ID();
    $tour_title = get_the_title();
    $tour_feat_image_url = get_no_img_url();
    if (has_post_thumbnail()) {
        $tour_feat_image_url = wp_get_attachment_url(get_post_thumbnail_id());
    }
    $tour_excerpt = get_the_excerpt();
    $tour_post_link = get_permalink($tour_ID);
    $tour_departure = get_location_ID(get_post_meta($tour_ID, 'tour_departure', true));
    $tour_arrival = get_location_ID(get_post_meta($tour_ID, 'tour_arrival', true));
    $tour_price = get_post_meta($tour_ID, 'tour_price', true);
    $tour_price_discount = get_post_meta($tour_ID, 'tour_price_discount', true);
    $tour_start = get_post_meta($tour_ID, 'tour_start', true);
    $tour_end = get_post_meta($tour_ID, 'tour_end', true);
    $tour_days = get_post_meta($tour_ID, 'tour_days', true);
    $tourinfo['tour_ID'] = $tour_ID;
    $tourinfo['tour_title'] = $tour_title;
    $tourinfo['tour_feat_image_url'] = $tour_feat_image_url;
    $tourinfo['tour_excerpt'] = $tour_excerpt;
    $tourinfo['tour_post_link'] = $tour_post_link;
    $tourinfo['tour_departure'] = $tour_departure;
    $tourinfo['tour_arrival'] = $tour_arrival;
    $tourinfo['tour_price'] = $tour_price;
    $tourinfo['tour_price_discount'] = $tour_price_discount;
    $tourinfo['tour_start'] = $tour_start;
    $tourinfo['tour_end'] = $tour_end;
    $tourinfo['tour_days'] = $tour_days;
    return $tourinfo;
}
/**
 * Change location list column content
 *
 * @since 0.9
 * @param string $column Column being worked on
 */
function ctc_location_columns_content($column)
{
    global $post;
    switch ($column) {
        // Thumbnail
        case 'ctc_location_thumbnail':
            if (has_post_thumbnail()) {
                echo '<a href="' . get_edit_post_link($post->ID) . '">' . get_the_post_thumbnail($post->ID, array(80, 80)) . '</a>';
            }
            break;
            // Address
        // Address
        case 'ctc_location_address':
            echo nl2br(strip_tags(get_post_meta($post->ID, '_ctc_location_address', true)));
            break;
            // Times
        // Times
        case 'ctc_location_times':
            echo nl2br(strip_tags(get_post_meta($post->ID, '_ctc_location_times', true)));
            break;
            // Order
        // Order
        case 'ctc_location_order':
            echo isset($post->menu_order) ? $post->menu_order : '';
            break;
    }
}
Exemplo n.º 13
0
/**
 * Function to get the image
 *
 * @since		0.1
 * @updated	0.1.3 - Added wp_cache_set()
 * @updated 	0.1.9 - fixed persistent cache per post_id
 * @ref			http://www.ethitter.com/slides/wcmia-caching-scaling-2012-02-18/#slide-11
 */
function _esc_get_the_image($post_id = false)
{
    $post_id = (int) $post_id;
    $cache_key = "featured_image_post_id-{$post_id}-_thumbnail";
    $cache = wp_cache_get($cache_key, null);
    if (!is_array($cache)) {
        $cache = array();
    }
    if (!array_key_exists($cache_key, $cache)) {
        if (empty($cache) || !is_string($cache)) {
            $output = '';
            if (has_post_thumbnail($post_id)) {
                $image_array = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), array(36, 32));
                if (is_array($image_array) && is_string($image_array[0])) {
                    $output = $image_array[0];
                }
            }
            if (empty($output)) {
                //$output = plugins_url( 'images/default.png', __FILE__ );
                $output = apply_filters('featured_image_column_default_image', $output);
            }
            $output = esc_url($output);
            $cache[$cache_key] = $output;
            wp_cache_set($cache_key, $cache, null, 60 * 60 * 24);
        }
    }
    // Make sure we're returning the cached image HT: https://wordpress.org/support/topic/do-not-display-image-from-cache?replies=1#post-6773703
    return isset($cache[$cache_key]) ? $cache[$cache_key] : $output;
}
Exemplo n.º 14
0
 function kobu_post_entry_classes($classes)
 {
     // Post Data
     global $post, $wpex_count;
     $post_id = $post->ID;
     $post_type = get_post_type($post_id);
     // Do nothing for slides
     if ($post_type == 'slides') {
         return $classes;
     }
     // Search results
     if (is_search()) {
         $classes[] = 'search-entry';
         if (!has_post_thumbnail()) {
             $classes[] = 'no-featured-image';
         }
         return $classes;
     }
     // Custom class for non standard post types
     if ($post_type !== 'post') {
         $classes[] = $post_type . '-entry';
     }
     // Counter
     if ($wpex_count) {
         $classes[] = 'count-' . $wpex_count;
     }
     // Return classes
     return $classes;
 }
/**
 * If a YouTube or Vimeo video is added in the post content, grab its thumbnail and set it as the featured image
 */
function wds_set_media_as_featured_image($post_id, $post)
{
    $content = isset($post->post_content) ? $post->post_content : '';
    // Only check the first 1000 characters of our post.
    $content = substr($content, 0, 800);
    // Props to @rzen for lending his massive brain smarts to help with the regex
    $do_video_thumbnail = isset($post->ID) && !has_post_thumbnail($post_id) && $content && (preg_match('/\\/\\/(www\\.)?youtube\\.com\\/(watch|embed)\\/?(\\?v=)?([a-zA-Z0-9\\-\\_]+)/', $content, $youtube_matches) || preg_match('#https?://(.+\\.)?vimeo\\.com/.*#i', $content, $vimeo_matches));
    if (!$do_video_thumbnail) {
        return update_post_meta($post_id, '_is_video', false);
    }
    $video_thumbnail_url = false;
    $youtube_id = $youtube_matches[4];
    $vimeo_id = preg_replace("/[^0-9]/", "", $vimeo_matches[0]);
    if ($youtube_id) {
        // Check to see if our max-res image exists
        $file_headers = get_headers('http://img.youtube.com/vi/' . $youtube_id . '/maxresdefault.jpg');
        $video_thumbnail_url = $file_headers[0] !== 'HTTP/1.0 404 Not Found' ? 'http://img.youtube.com/vi/' . $youtube_id . '/maxresdefault.jpg' : 'http://img.youtube.com/vi/' . $youtube_id . '/hqdefault.jpg';
    } elseif ($vimeo_id) {
        $vimeo_data = wp_remote_get('http://www.vimeo.com/api/v2/video/' . intval($vimeo_id) . '.php');
        if (isset($vimeo_data['response']['code']) && '200' == $vimeo_data['response']['code']) {
            $response = unserialize($vimeo_data['body']);
            $video_thumbnail_url = isset($response[0]['thumbnail_large']) ? $response[0]['thumbnail_large'] : false;
        }
    }
    // If we found an image...
    $attachment_id = $video_thumbnail_url && !is_wp_error($video_thumbnail_url) ? wds_ms_media_sideload_image_with_new_filename($video_thumbnail_url, $post_id, sanitize_title(get_the_title())) : 0;
    // If attachment wasn't created, bail
    if (!$attachment_id) {
        return;
    }
    // Woot! we got an image, so set it as the post thumbnail
    set_post_thumbnail($post_id, $attachment_id);
    update_post_meta($post_id, '_is_video', true);
}
Exemplo n.º 16
0
function family_banner()
{
    ?>
	<div class="banner">
		<div class="wrap">
			<?php 
    if (is_front_page()) {
        family_get_header_image();
    } elseif (!is_front_page() && get_theme_mod('family_header_home')) {
        echo '';
    } else {
        // get title
        $id = get_option('page_for_posts');
        if ('posts' == get_option('show_on_front') && (is_day() || is_month() || is_year() || is_tag() || is_category() || is_singular('post') || is_home())) {
            family_get_header_image();
        } elseif (is_home() || is_singular('post')) {
            if (has_post_thumbnail($id)) {
                echo get_the_post_thumbnail($id, 'full');
            } else {
                family_get_header_image();
            }
        } elseif (has_post_thumbnail() && is_singular('page')) {
            the_post_thumbnail();
        } else {
            family_get_header_image();
        }
    }
    ?>
		</div><!-- .wrap -->
  	</div><!-- .banner -->
<?php 
}
 /**
  * Get post image
  * @since  1.0.0
  */
 public function get_image($link = 'link')
 {
     global $post;
     $post_type = get_post_type($post->ID);
     if (!post_type_supports($post_type, 'thumbnail')) {
         return;
     }
     if (!has_post_thumbnail()) {
         return;
     }
     $post_meta = Cherry_Services_Template_Callbacks::setup_meta();
     if (isset($post_meta['show_thumb']) && 'no' == $post_meta['show_thumb']) {
         return;
     }
     if ('unlink' == $link) {
         $format = '<figure class="cherry-services_thumb">%1$s</figure>';
     } else {
         $format = '<figure class="cherry-services_thumb"><a href="%2$s">%1$s</a></figure>';
     }
     $size = $this->atts['size'];
     if (is_integer($size)) {
         $size = array($size, $size);
     } elseif (!is_string($size)) {
         $size = 'thumbnail';
     }
     $image = get_the_post_thumbnail($post->ID, $size, array('alt' => get_the_title()));
     return sprintf($format, $image, get_permalink());
 }
Exemplo n.º 18
0
function oxy_shortcode_recent($atts, $content = '')
{
    // setup options
    extract(shortcode_atts(array('count' => 4, 'categories' => null, 'authors' => null, 'post_formats' => null, 'titles' => 'show'), $atts));
    $categories = null === $categories ? null : explode(',', $categories);
    $authors = null === $authors ? null : explode(',', $authors);
    $post_formats = null === $post_formats ? null : explode(',', $post_formats);
    $posts = oxy_get_recent_posts($count, $categories, $authors, $post_formats);
    $output = '';
    if (!empty($posts)) {
        $output .= '[raw]<ul class="oxyrecentposts">';
        global $post;
        foreach ($posts as $post) {
            setup_postdata($post);
            $output .= '<li>';
            $output .= '<a href="' . get_permalink() . '" class="recent-feature" >';
            if (has_post_thumbnail($post->ID)) {
                $output .= get_the_post_thumbnail($post->ID, array(64, 64), array('title' => $post->post_title, 'alt' => $post->post_title));
            } else {
                // $output .= oxy_theme_icon( oxy_get_post_icon( $post->ID ), 'span' );
            }
            $output .= '</a>';
            if ('show' == $titles) {
                $output .= '<h5>' . get_the_title($post->ID) . '</h5>';
                $output .= '<p>' . get_the_date() . '</p>';
            }
            $output .= '</li>';
        }
        $output .= '</ul>[/raw]';
    }
    // reset post data
    wp_reset_postdata();
    return $output;
}
Exemplo n.º 19
0
/**
 * Echo post image.
 *
 * @since 1.0.0
 */
function beans_post_image()
{
    if (!has_post_thumbnail()) {
        return false;
    }
    global $post;
    /**
     * Filter the arguments used by {@see beans_edit_image()} to edit the post image.
     *
     * @since 1.0.0
     *
     * @param bool|array $edit_args Arguments used by {@see beans_edit_image()}. Set to false to use WordPress
     *                              large size.
     */
    $edit_args = apply_filters('beans_edit_post_image_args', array('resize' => array(800, false)));
    if (empty($edit_args)) {
        $image = beans_get_post_attachment($post->ID, 'large');
    } else {
        $image = beans_edit_post_attachment($post->ID, $edit_args);
    }
    echo beans_open_markup('beans_post_image', 'div', array('class' => 'tm-article-image'));
    if (!is_singular()) {
        echo beans_open_markup('beans_post_image_link', 'a', array('href' => get_permalink(), 'title' => the_title_attribute('echo=0')));
    }
    echo beans_selfclose_markup('beans_post_image_item', 'img', array('width' => $image->width, 'height' => $image->height, 'src' => $image->src, 'alt' => esc_attr($image->alt)), $image);
    if (!is_singular()) {
        echo beans_close_markup('beans_post_image_link', 'a');
    }
    echo beans_close_markup('beans_post_image', 'div');
}
function ac_render_ac_easy_slideshow($full_width = false, $type = 'royalslider')
{
    // We need to build an array of posts to pass through to the RoyalSlider function
    $posts = array();
    // Should we include the featured image?
    if (has_post_thumbnail() && ac_get_meta('include_featured_image') == 1) {
        $posts[] = get_post(get_post_thumbnail_id());
    }
    // Get the images to use
    $images = ac_get_meta('images', array('type' => 'image_advanced'));
    // Add them to the slides
    foreach ($images as $image) {
        // Add to our slides
        $posts[] = get_post($image['ID']);
    }
    $args = array('slider_style' => 'no-caption', 'slider_size' => 'square', 'class' => 'ac_easy_slider');
    if ($full_width) {
        $args['full_width'] = true;
    }
    // Render the slideshow
    if (count($posts)) {
        if ($type == 'royalslider') {
            echo ac_render_posts_slideshow($args, $posts);
        } else {
            echo ac_render_slick_carousel($args, $posts);
        }
        return true;
    }
    return false;
}
Exemplo n.º 21
0
/**
 * 
 * @global type $post
 * 
 */
function dfi_download_featured_images()
{
    global $post;
    //get featured enable lists
    $post_options = (array) json_decode(get_option('featured_enable'));
    $singular = '';
    $is_page = '';
    if (!empty($post_options['page'])) {
        $is_page = is_page();
        unset($post_options['page']);
    }
    if (!empty($post_options)) {
        $post_options = array_values($post_options);
        $singular = is_singular($post_options);
    } else {
        $singular = $is_page;
    }
    if (!empty($post_options) && $is_page != '') {
        $singular = $is_page || $singular;
    }
    //    echo '<pre>';
    //    print_r($post_options);
    //    exit;
    if ($singular && has_post_thumbnail()) {
        $url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
        $icon = get_post_meta($post->ID, 'featured_download', true);
        if ($url[0] != '' && $icon == 'yes') {
            dfi_add_download_button($url[0]);
        }
    }
}
Exemplo n.º 22
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $number = $instance['number'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
		<div class="recent-works-items clearfix">
		<?php 
        $args = array('post_type' => 'evolve_portfolio', 'posts_per_page' => $number, 'has_password' => false);
        $portfolio = new WP_Query($args);
        if ($portfolio->have_posts()) {
            ?>
		<?php 
            while ($portfolio->have_posts()) {
                $portfolio->the_post();
                ?>
		<?php 
                if (has_post_thumbnail()) {
                    ?>
		<?php 
                    $link_target = "";
                    $url_check = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
                    if (!empty($url_check)) {
                        $new_permalink = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
                        if (get_post_meta(get_the_ID(), 'pyre_link_icon_target', true) == "yes") {
                            $link_target = ' target="_blank"';
                        }
                    } else {
                        $new_permalink = get_permalink();
                    }
                    ?>
		<a href="<?php 
                    echo $new_permalink;
                    ?>
"<?php 
                    echo $link_target;
                    ?>
 title="<?php 
                    the_title();
                    ?>
">
			<?php 
                    the_post_thumbnail('recent-works-thumbnail');
                    ?>
		</a>
		<?php 
                }
            }
        }
        wp_reset_query();
        ?>
		</div>

		<?php 
        echo $after_widget;
    }
 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     echo $args['before_widget'];
     $display_title = !empty($instance['display_title']) ? $instance['display_title'] : '';
     $numberofposts = !empty($instance['numberofposts']) ? absint($instance['numberofposts']) : '';
     if ($display_title == 'on') {
         if (!empty($instance['title'])) {
             echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
         }
     }
     $post_query_args = array('post_type' => array('post'), 'pagination' => false, 'posts_per_page' => $numberofposts, 'ignore_sticky_posts' => true, 'cache_results' => true, 'update_post_meta_cache' => true, 'update_post_term_cache' => true);
     $post_query = new WP_Query($post_query_args);
     if ($post_query->have_posts()) {
         while ($post_query->have_posts()) {
             $post_query->the_post();
             global $post;
             $output = '';
             $output .= '<div class="widget-recent-post clearfix">';
             $output .= has_post_thumbnail($post->ID) ? '<div class="recent-post-image">' : '';
             $output .= has_post_thumbnail($post->ID) ? get_the_post_thumbnail($post->ID, 'illdy-widget-recent-posts') : '';
             $output .= has_post_thumbnail($post->ID) ? '</div><!--/.recent-post-image-->' : '';
             $output .= '<a href="' . esc_url(get_the_permalink()) . '" title="' . esc_attr(get_the_title()) . '" class="recent-post-title">' . esc_html(get_the_title()) . '</a>';
             $output .= '<a href="' . esc_url(get_the_permalink()) . '" title="' . __('More...', 'illdy') . '" class="recent-post-button">' . __('More...', 'illdy') . '</a>';
             $output .= '</div><!--/.widget-recent-post.clearfix-->';
             echo $output;
         }
     } else {
         echo __('No posts found.', 'illdy');
     }
     wp_reset_postdata();
     echo $args['after_widget'];
 }
function image_cpt_shortcode($attr)
{
    if ($attr['page'] <= 10) {
        $per_page['page'] = $attr['page'];
    } else {
        $per_page['page'] = 10;
    }
    $output = '<h2 class="winner-title">Hall of Winners</h2><h3 class="winner-subtitle">Congratulations to all of our winners</h3>';
    $args = array('post_type' => 'image_post_type', 'posts_per_page' => $per_page['page']);
    $loop = new WP_query($args);
    if ($loop->have_posts()) {
        while ($loop->have_posts()) {
            $loop->the_post();
            $output .= '<div class="winner-div"><h3>';
            $output .= get_the_title();
            $output .= '</h3>';
            if (has_post_thumbnail()) {
                // check if the post has a post thumbnail assigned to it.
                $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($loop->ID), 'full');
                $url = $thumb['0'];
                $output .= '<img src="' . $url . '"/>';
            }
            $output .= '</div>';
        }
    } else {
        // if no content, include the "no posts found" template.
        get_template_part('content', 'none');
    }
    return $output;
}
Exemplo n.º 25
0
 function gabfire_media($parameters)
 {
     if (!post_password_required()) {
         global $post, $gab_video, $gab_thumb, $gab_flv, $gab_iframe;
         $gab_thumb = get_post_meta($post->ID, 'thumbnail', true);
         $gab_flv = get_post_meta($post->ID, 'videoflv', true);
         $gab_iframe = get_post_meta($post->ID, 'iframe', true);
         /* If we have installed and activated Gabfire Media Plugin */
         if (function_exists('gabfire_mediaplugin_thumbnail')) {
             if ($gab_flv != '' and $parameters['enable_video'] == 1) {
                 gabfire_mediaplugin_localvideo($parameters);
             } elseif ($gab_iframe != '' and $parameters['enable_video'] == 1) {
                 gabfire_mediaplugin_oembedvideo($parameters);
             } elseif (has_post_thumbnail() and $parameters['enable_thumb'] == 1) {
                 gabfire_mediaplugin_thumbnail($parameters);
             } elseif ($parameters['enable_default'] == 1) {
                 gabfire_mediaplugin_default($parameters);
             }
         } else {
             if ($gab_iframe != '' and $parameters['enable_video'] == 1) {
                 gabfire_call_iframe($parameters);
             } elseif (has_post_thumbnail() and $parameters['enable_thumb'] == 1) {
                 gabfire_call_post_thumb($parameters);
             } elseif ($parameters['enable_default'] == 1) {
                 gabfire_call_default_thumb($parameters);
             }
         }
     }
 }
Exemplo n.º 26
0
    /**
     * Display an optional post thumbnail.
     *
     * Wraps the post thumbnail in an anchor element on index views, or a div
     * element when on single views.
     *
     * @since Twenty Fifteen 1.0
     */
    function launchpad_post_thumbnail()
    {
        if (post_password_required() || is_attachment() || !has_post_thumbnail()) {
            return;
        }
        if (is_singular()) {
            ?>

            <div class="post-thumbnail">
                <?php 
            the_post_thumbnail();
            ?>
            </div><!-- .post-thumbnail -->

        <?php 
        } else {
            ?>

            <a class="post-thumbnail" href="<?php 
            the_permalink();
            ?>
" aria-hidden="true">
                <?php 
            the_post_thumbnail('post-thumbnail', array('alt' => get_the_title()));
            ?>
            </a>

        <?php 
        }
        // End is_singular()
    }
Exemplo n.º 27
0
function selenenw_post_thumbnail()
{
    if (post_password_required() || is_attachment() || !has_post_thumbnail()) {
        return;
    }
    if (is_singular()) {
        ?>

        <div class="entry-featured">
            <?php 
        the_post_thumbnail();
        ?>
        </div><!-- .post-thumbnail -->

    <?php 
    } else {
        ?>

        <figure>
            <a href="<?php 
        the_permalink();
        ?>
">
                <?php 
        the_post_thumbnail('post-thumbnail', array('alt' => get_the_title()));
        ?>
            </a>
        </figure>

    <?php 
    }
    // End is_singular()
}
Exemplo n.º 28
0
function ipin_head()
{
    //Opengraph
    if (is_single()) {
        global $post;
        setup_postdata($post);
        $output = '<meta property="og:type" content="article" />' . "\n";
        $output .= '<meta property="og:title" content="' . preg_replace('/[\\n\\r]/', ' ', mb_strimwidth(the_title_attribute('echo=0'), 0, 255, ' ...')) . '" />' . "\n";
        $output .= '<meta property="og:url" content="' . get_permalink() . '" />' . "\n";
        if ($post->post_content == '') {
            $meta_categories = get_the_category($post->ID);
            foreach ($meta_categories as $meta_category) {
                $meta_category_name = $meta_category->name;
            }
            if (ipin_get_post_board()) {
                $meta_board_name = ipin_get_post_board()->name;
            } else {
                $meta_board_name = __('Untitled', ipin);
            }
            $output .= '<meta property="og:description" content="' . esc_attr(__('Pinned onto', 'ipin') . ' ' . $meta_board_name . ' ' . __('Board in', 'ipin') . ' ' . $meta_category_name . ' ' . __('Category', 'ipin')) . '" />' . "\n";
        } else {
            $output .= '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />' . "\n";
        }
        if (has_post_thumbnail()) {
            $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
            $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
        }
        if (get_option('wsl_settings_Facebook_app_id')) {
            $output .= '<meta property="fb:app_id" content="' . get_option('wsl_settings_Facebook_app_id') . '" />' . "\n";
        }
        echo $output;
    }
    if (is_tax('board')) {
        global $post, $wp_query, $wp_taxonomies;
        setup_postdata($post);
        $output = '<meta property="og:type" content="article" />' . "\n";
        $output .= '<meta property="og:title" content="' . esc_attr($wp_query->queried_object->name) . '" />' . "\n";
        $output .= '<meta property="og:url" content="' . home_url('/' . $wp_taxonomies["board"]->rewrite['slug'] . '/' . sanitize_title($wp_query->queried_object->name, '_') . '/') . $wp_query->queried_object->term_id . '/" />' . "\n";
        $output .= '<meta property="og:description" content="" />' . "\n";
        if (has_post_thumbnail()) {
            $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
            $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
        }
        echo $output;
    }
    if (is_author()) {
        global $wp_query, $wp_rewrite;
        $user_info = get_user_by('id', $wp_query->query_vars['author']);
        $output = '<meta property="og:type" content="article" />' . "\n";
        $output .= '<meta property="og:title" content="' . esc_attr($user_info->display_name) . ' (' . $user_info->user_nicename . ')" />' . "\n";
        $output .= '<meta property="og:url" content="' . home_url('/') . $wp_rewrite->author_base . '/' . $user_info->user_nicename . '/" />' . "\n";
        $output .= '<meta property="og:description" content="' . esc_attr($user_info->description) . '" />' . "\n";
        $avatar_id = get_user_meta($user_info->ID, 'ipin_user_avatar', true);
        if ($avatar_id != '' && $avatar_id != 'deleted') {
            $user_avatar = wp_get_attachment_image_src($avatar_id, 'full');
            $output .= '<meta property="og:image" content="' . $user_avatar[0] . '" />' . "\n";
        }
        echo $output;
    }
}
    /**
     * Displays the output
     *
     * @param array $args
     * @param array $instance
     * @since Achievements (3.3)
     */
    public function widget($args, $instance)
    {
        $settings = $this->parse_settings($instance);
        $settings['post_id'] = absint(apply_filters('dpa_featured_achievement_post_id', $settings['post_id'], $instance, $this->id_base));
        // Get the specified achievement
        $achievement = get_posts(array('no_found_rows' => true, 'numberposts' => 1, 'p' => $settings['post_id'], 'post_status' => 'publish', 'post_type' => dpa_get_achievement_post_type(), 'suppress_filters' => false));
        // Bail if it doesn't exist
        if (empty($achievement)) {
            return;
        }
        $achievement = array_shift($achievement);
        $title = dpa_get_achievement_title($achievement->ID);
        echo $args['before_widget'];
        echo $args['before_title'] . $title . $args['after_title'];
        if (has_post_thumbnail($achievement->ID)) {
            ?>
			<a href="<?php 
            dpa_achievement_permalink($achievement->ID);
            ?>
"><?php 
            echo get_the_post_thumbnail($achievement->ID, 'thumbnail', array('alt' => $title));
            ?>
</a>
		<?php 
        }
        dpa_achievement_excerpt($settings['post_id']);
        echo $args['after_widget'];
    }
Exemplo n.º 30
-7
 function widget($args, $instance)
 {
     global $post;
     extract($args, EXTR_SKIP);
     echo $before_widget;
     $title = empty($instance['title']) ? __('Recent Posts', 'lan-thinkupthemes') : apply_filters('widget_title', $instance['title']);
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     $posts = new WP_Query('orderby=date&posts_per_page=' . $instance['postcount'] . '');
     while ($posts->have_posts()) {
         $posts->the_post();
         // Insert post date if needed.
         if ($instance['postdate'] == 'on') {
             $date_input = '<a href="' . get_permalink() . '" class="date">' . get_the_date('M j, Y') . '</a>';
         }
         // HTML output
         echo '<div class="recent-posts">';
         if (has_post_thumbnail() and $instance['imageswitch'] == 'on') {
             echo '<div class="image">', '<a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_post_thumbnail($post->ID, array(65, 65)) . '<div class="image-overlay"></div></a>', '</div>', '<div class="main">', '<a href="' . get_permalink() . '">' . get_the_title() . '</a>', $date_input, '</div>';
         } else {
             echo '<div class="main">', '<a href="' . get_permalink() . '">' . get_the_title() . '</a>', $date_input, '</div>';
         }
         echo '</div>';
     }
     wp_reset_query();
     echo $after_widget;
 }