/**
  * 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;
 }
Example #2
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;
 }
/**
 * 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;
    }
}
Example #4
0
function samfujera_home_featured_image()
{
    // display the featured image for the front page. Large, please.
    global $post;
    $image = get_the_post_thumbnail($post->ID, 'original', array('alt' => the_title_attribute('echo=0'), 'title' => the_title_attribute('echo=0')));
    echo $image;
}
Example #5
0
    /**
     * 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)
    {
        $recent_posts = wp_get_recent_posts(array('numberposts' => 9, 'post_type' => 'wedding_registry', 'orderby' => 'post_date', 'post_status' => 'publish'));
        $i = 0;
        echo '<div class="registry-row">';
        foreach ($recent_posts as $recent) {
            $i++;
            $spouse_a = get_post_meta($recent["ID"], 'wedding_registry_field_a', true);
            $spouse_b = get_post_meta($recent["ID"], 'wedding_registry_field_b', true);
            if ($i < 9) {
                echo '
						<div class="hidden-xs hidden-sm col-md-4 col-lg-3 reg-widg center-block">
							<a href="' . get_permalink($recent['ID']) . '" title="' . $spouse_a . ' & ' . $spouse_b . '">
										<div class="lgcaption caption registry-overlay text-center" style="display:none;">
											<span class="icon-heart icom circled-icon"></span><p class="solid-text">' . $spouse_a . '<br/> & <br/>' . $spouse_b . '</p>
										</div>
										<div class="registry-widget-thumbnail center-block">' . get_the_post_thumbnail($recent['ID'], 'medium-cropped', array('class' => 'img-responsive center-block reg-thumb')) . '</div>
							</a>
							</div>';
            } else {
                echo '
						<div class="col-md-4 col-lg-3 reg-widg center-block last-reg">
										<a href="' . get_permalink($recent['ID']) . '" title="' . $spouse_a . ' & ' . $spouse_b . '">
													<div class="caption registry-overlay text-center" style="display:none;">
														<span class="icon-heart icom circled-icon"></span><p class="solid-text">' . $spouse_a . '<br/> & <br/>' . $spouse_b . '</p>
													</div>
													<div class="registry-widget-thumbnail center-block last-reg">' . get_the_post_thumbnail($recent['ID'], 'medium-cropped', array('class' => 'center-block reg-thumb')) . '</div>
										</a>
										</div>';
            }
        }
        echo '</div><div class="clearfix">&nbsp;</div>';
    }
Example #6
0
 /**
  * Get the thumbnail image for a post's image
  * 
  * Attempts to find the URL for the thumbnail size of an image attached to a Post
  * 
  * @param int $post_id The ID of the WordPress Post
  * @param string $image_url The URL of the image to get a thumbnail for
  * 
  * @global $wpdb
  * 
  * @uses current_theme_supports()
  * @uses get_the_post_thumbnail()
  * @uses wpdb::prepare()
  * @uses wpdb::get_row()
  * @uses wp_get_attachment_image()
  * @uses wp_upload_dir()
  * 
  * @return string
  */
 private function _get_post_thumbnail($post_id, $image_url)
 {
     global $wpdb;
     $thumbnail_src = $image_url;
     $thumbnail_html = "";
     // Use the post thumbnail if possible
     if (current_theme_supports('post-thumbnails')) {
         $thumbnail_html = get_the_post_thumbnail($post_id, 'thumbnail');
     }
     // Process for a thumbnail version of the background image
     $url_parts = parse_url($image_url);
     // Get array of URL parts of the image
     $wp_upload_dir = wp_upload_dir();
     // Get array of URL parts of the upload directory
     $relative_upload_base = str_replace(ABSPATH, "", str_replace($wp_upload_dir['subdir'], "", $wp_upload_dir['path']));
     if (isset($url_parts['host']) && $url_parts['host'] == $_SERVER['HTTP_HOST'] && strpos($url_parts['path'], "/" . $relative_upload_base) !== false) {
         $image_url_original = preg_replace("/\\-[0-9]+x[0-9]+\\.(jpeg|jpg|gif|png|bmp)\$/", ".\$1", $image_url);
         $post = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->posts} WHERE guid = %s", $image_url_original));
         if (!empty($post)) {
             $thumbnail_html = wp_get_attachment_image($post->ID, 'thumbnail');
         }
     }
     if (!empty($thumbnail_html)) {
         $matches = array();
         preg_match("/ src\\=\"([^\"]+)\"/", $thumbnail_html, $matches);
         if (count($matches) > 1) {
             $thumbnail_src = $matches[1];
         }
     }
     return $thumbnail_src;
 }
Example #7
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";
 }
Example #8
0
 function uw_blogroll_shortcode($atts = array())
 {
     //allow pagebuilder widgets to run the shortcode, block all other posts to prevent infinite loops
     if (get_post_type() == 'post' && !is_home()) {
         return '';
     }
     $params = array_merge(array('excerpt' => 'true', 'trim' => 'false', 'image' => 'hide', 'author' => 'show', 'titletag' => 'h2', 'number' => 5), $atts);
     if (!array_key_exists('numberposts', $params)) {
         $params['numberposts'] = $params['number'];
     }
     $posts = get_posts($params);
     foreach ($posts as $post) {
         if (!stripos($post->post_content, '[blogroll')) {
             //to prevent infinite loops in pagebuilder widgets
             $postID = $post->ID;
             $link = get_permalink($postID);
             if (in_array($params['excerpt'], array('show', 'true'))) {
                 $excerpt = strlen($post->post_excerpt) > 0 ? $post->post_excerpt : apply_filters('widget_text', $post->post_content);
                 if (in_array($params['trim'], array('show', 'true'))) {
                     $excerpt = wp_trim_words($excerpt);
                 }
                 $excerpt = wpautop($excerpt);
                 //using apply_filters('the_content', $excerpt) causes an infinite loop
                 if (in_array($params['image'], array('show', 'true'))) {
                     $image = get_the_post_thumbnail($postID, 'thumbnail', array('style' => 'float:left;padding-right:10px;'));
                     $class = 'class="pull-left"';
                 }
             }
             $author = $params['author'] === 'show' ? '<p class="author-info">' . get_the_author_meta('display_name', $post->post_author) . '</p>' : '';
             $postDate = get_the_time(get_option('date_format'), $postID);
             $html .= "<li {$class}>{$image}<span><p class=\"date\">{$postDate}</p><" . $params['titletag'] . "><a href=\"{$link}\">{$post->post_title}</a></" . $params['titletag'] . ">{$author}{$excerpt}</span></li>";
         }
     }
     return "<ul class=\"shortcode-blogroll\">{$html}</ul>";
 }
function ya_product_thumbnail($size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0)
{
    global $post;
    $html = '';
    $id = get_the_ID();
    $gallery = get_post_meta($id, '_product_image_gallery', true);
    $attachment_image = '';
    if (!empty($gallery)) {
        $gallery = explode(',', $gallery);
        $first_image_id = $gallery[0];
        $attachment_image = wp_get_attachment_image($first_image_id, $size, false, array('class' => 'hover-image back'));
    }
    $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), '');
    if (has_post_thumbnail()) {
        if ($attachment_image) {
            $html .= '<div class="product-thumb-hover">';
            $html .= get_the_post_thumbnail($post->ID, $size) ? get_the_post_thumbnail($post->ID, $size) : '<img src="' . get_template_directory_uri() . '/assets/img/placeholder/' . $size . '.png" alt="No thumb">';
            $html .= $attachment_image;
            $html .= '</div>';
            /* quickview */
            $nonce = wp_create_nonce("ya_quickviewproduct_nonce");
            $link = admin_url('admin-ajax.php?ajax=true&amp;action=ya_quickviewproduct&amp;post_id=' . $post->ID . '&amp;nonce=' . $nonce);
            $html .= '<a href="' . $link . '" data-fancybox-type="ajax" class="group fancybox fancybox.ajax">' . apply_filters('out_of_stock_add_to_cart_text', __('Quick View ', 'yatheme')) . '</a>';
        } else {
            $html .= get_the_post_thumbnail($post->ID, $size) ? get_the_post_thumbnail($post->ID, $size) : '<img src="' . get_template_directory_uri() . '/assets/img/placeholder/' . $size . '.png" alt="No thumb">';
        }
        return $html;
    } else {
        $html .= '<img src="' . get_template_directory_uri() . '/assets/img/placeholder/' . $size . '.png" alt="No thumb">';
        return $html;
    }
}
function us_post_format_image_preview($thumbnail_size = 'blog-grid', &$content = null)
{
    global $post;
    $thumbnail = get_the_post_thumbnail(get_the_ID(), $thumbnail_size);
    $preview = "";
    if (empty($content)) {
        $content = $post->post_content;
    }
    if (!$thumbnail) {
        preg_match("%^(https?(?://([^/?#]*))?([^?#]*?\\.(?:jpg|gif|png)))%", $content, $image_link_result);
        if (!empty($image_link_result[0])) {
            $preview = '<img src="' . $image_link_result[0] . '" alt="">';
            $content = str_replace($image_link_result[0], "", $content);
        } else {
            preg_match("%^<img.+?>%", $content, $image_tag_result);
            if (!empty($image_tag_result[0])) {
                $preview = $image_tag_result[0];
                $content = str_replace($image_tag_result[0], "", $content);
            }
        }
    } else {
        $preview = $thumbnail;
    }
    $post->post_content = $content;
    return $preview;
}
Example #11
0
 function x_featured_image($cropped = '')
 {
     $stack = x_get_stack();
     $fullwidth = in_array('x-full-width-active', get_body_class()) ? true : false;
     if (has_post_thumbnail()) {
         if ($cropped == 'cropped') {
             if ($fullwidth) {
                 $thumb = get_the_post_thumbnail(NULL, 'entry-' . $stack . '-cropped-fullwidth', NULL);
             } else {
                 $thumb = get_the_post_thumbnail(NULL, 'entry-' . $stack . '-cropped', NULL);
             }
         } else {
             if ($fullwidth) {
                 $thumb = get_the_post_thumbnail(NULL, 'entry-' . $stack . '-fullwidth', NULL);
             } else {
                 $thumb = get_the_post_thumbnail(NULL, 'entry-' . $stack, NULL);
             }
         }
         switch (is_singular()) {
             case true:
                 printf('<div class="entry-thumb">%s</div>', $thumb);
                 break;
             case false:
                 printf('<a href="%1$s" class="entry-thumb" title="%2$s">%3$s</a>', esc_url(get_permalink()), esc_attr(sprintf(__('Permalink to: "%s"', '__x__'), the_title_attribute('echo=0'))), $thumb);
                 break;
         }
     }
 }
Example #12
0
/**
 * Helper function to grab and display thumbnail from specified post
 * @since 1.4.0
 */
function ar2_get_thumbnail($size = 'thumbnail', $id = NULL, $attr = array())
{
    global $post, $ar2_image_sizes;
    if ($post) {
        $id = $post->ID;
    }
    if (!key_exists('alt', $attr)) {
        $attr['alt'] = esc_attr(get_the_excerpt());
    }
    if (!key_exists('title', $attr)) {
        $attr['title'] = esc_attr(get_the_title());
    }
    if (has_post_thumbnail($id)) {
        return get_the_post_thumbnail($id, $size, $attr);
    } else {
        // Could it be an attachment?
        if ($post->post_type == 'attachment') {
            return wp_get_attachment_image($id, $size, false, $attr);
        }
        // Use first thumbnail if auto thumbs is enabled.
        if (ar2_get_theme_option('auto_thumbs')) {
            $img_id = ar2_get_first_post_image_id();
            if ($img_id) {
                return wp_get_attachment_image($img_id, $size, false, $attr);
            }
        }
    }
    // Return empty thumbnail if all else fails.
    return '<img src="' . get_template_directory_uri() . '/images/empty_thumbnail.gif" alt="' . $attr['alt'] . '" title="' . $attr['title'] . '" />';
}
Example #13
0
function slickc_load_images($attributes)
{
    $args = array('post_type' => 'slickc', 'posts_per_page' => '-1', 'orderby' => $attributes['orderby'], 'order' => $attributes['order']);
    if (!empty($attributes['category'])) {
        $args['carousel_category'] = $attributes['category'];
    }
    if (!empty($attributes['id'])) {
        $args['p'] = $attributes['id'];
    }
    $loop = new WP_Query($args);
    $images = array();
    $output = '';
    while ($loop->have_posts()) {
        $loop->the_post();
        $image = get_the_post_thumbnail(get_the_ID(), 'full');
        if (!empty($image)) {
            $post_id = get_the_ID();
            $title = get_the_title();
            $content = get_the_excerpt();
            $image_src = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $image_src = $image_src[0];
            $url = get_post_meta(get_the_ID(), 'slickc_image_url');
            $url_openblank = get_post_meta(get_the_ID(), 'slickc_image_url_openblank');
            $images[] = array('post_id' => $post_id, 'title' => $title, 'content' => $content, 'image' => $image, 'img_src' => $image_src, 'url' => esc_url($url[0]), 'open_blank' => $url_openblank[0]);
        }
    }
    return $images;
}
/**
 * Custom Image Output for Simple Image & Content template.
 */
function mm_posts_output_custom_post_image_simple_image_content($post, $context, $args)
{
    $custom_output = apply_filters('mm_posts_post_image', '', $post, $context, $args);
    if ('' !== $custom_output) {
        echo $custom_output;
        return;
    }
    // Default to using the 'post-thumbnail' size.
    if ('' !== $args['featured_image_size']) {
        $image_size = esc_attr($args['featured_image_size']);
    } else {
        $image_size = 'post-thumbnail';
    }
    // Check for existing featured image
    if (has_post_thumbnail($post->ID)) {
        $image_tag = get_the_post_thumbnail($post->ID, $image_size);
    } else {
        $fallback_image = $args['fallback_image'];
        // Support the fallback image
        if (is_numeric($fallback_image)) {
            $image_tag = wp_get_attachment_image($fallback_image, $image_size);
        }
    }
    // Output image with/without link
    if (mm_true_or_false($args['link_title'])) {
        printf('<div class="entry-image"><a href="%s">%s</a></div>', get_permalink($post->ID), $image_tag);
    } else {
        printf('<div class="entry-image">%s</div>', $image_tag);
    }
}
function hp_landingpages_shortcode($atts, $content)
{
    //get any attributes that may have been passed; override defaults
    $opts = shortcode_atts(array('id' => '', 'exclude' => '', 'type' => ''), $atts);
    // get child pages
    global $wp_query;
    $id = $opts['id'] == "" ? $wp_query->post->ID : $opts['id'];
    $children = get_pages("child_of=" . $id . "&parent=" . $id . "&hierarchical=0&exclude=" . $opts['exclude'] . "&posts_per_page=-1&post_type=page&sort_column=menu_order&sort_order=ASC");
    foreach ((array) $children as $c) {
        if ($opts['type'] == 'list') {
            $output .= "<li><a href='" . get_permalink($c->ID) . "'>" . get_the_title($c->ID) . "</a></li>";
        } else {
            $excerpt = '';
            if ($c->post_excerpt) {
                $excerpt = $c->post_excerpt;
            } else {
                if (strlen($c->post_content) > 200) {
                    $excerpt = substr(strip_tags($c->post_content), 0, 200) . "&hellip;";
                } elseif ($c->post_content == "" || $c->post_content == 0) {
                    $excerpt = "";
                } else {
                    $excerpt = strip_tags($c->post_content);
                }
            }
            $output .= "\n\t\t\t<div class='htlandingpage clearfix'>\n\t\t\t  " . get_the_post_thumbnail($c->ID, "listingthumb", "class=listingthumb") . "\n\t\t\t  <h2><a href='" . get_permalink($c->ID) . "'>" . get_the_title($c->ID) . "</a></h2>\n\t\t\t  <p>" . $excerpt . "</p>\n\t\t\t</div>\n\t\t\t";
        }
    }
    if ($opts['type'] == 'list') {
        $html = "<ul>" . $output . "</li>";
    } else {
        $html = "<div class='htlandingpageblock'>" . $output . "</div>";
    }
    return $html;
}
 /**
  * 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'];
 }
 /**
  * Outputs the HTML of the widget
  *
  * @param array $args
  *
  * @param array $instance
  *
  * @since 1.4
  */
 public function widget($args, $instance)
 {
     extract($args);
     if (is_single()) {
         $fields = get_post_meta(get_the_ID(), 'read_more_links', true);
         if ($fields) {
             echo $args['before_widget'];
             echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
             echo '<aside class="read-more-about-widget">';
             foreach ($fields as $field) {
                 echo '<div class="story">';
                 if ($field['read_more_about_in_ex'] == 'internal') {
                     if (has_post_thumbnail($field['read_more_about_internal_link'])) {
                         echo '<div class="photo"><a href="' . get_the_permalink($field['read_more_about_internal_link']) . '">' . get_the_post_thumbnail($field['read_more_about_internal_link'], 'read-more') . '</a></div>';
                     }
                     echo '<h3 class="story-title"><a href="' . get_the_permalink($field['read_more_about_internal_link']) . '">' . get_the_title($field['read_more_about_internal_link']) . '</a></h3>';
                 } else {
                     echo '<h3 class="story-title"><a href="' . $field['read_more_about_link'] . '" target="_blank">' . $field['read_more_about_external_title'] . '</a></h3>';
                 }
                 echo '</div>';
             }
             echo '</aside>';
             echo $args['after_widget'];
         }
     }
 }
Example #18
0
function show_category($cid = 1)
{
    $args = array('showposts' => 4, 'cat' => $cid, 'orderby' => 'post_date', 'order' => 'desc');
    query_posts($args);
    global $the_post;
    $category = '';
    while (have_posts()) {
        the_post();
        $cat = get_the_category(get_the_ID());
        $link = get_permalink(get_the_ID());
        $src = get_the_post_thumbnail(get_the_ID(), 'index_thumb');
        $c_name = $cat[0]->name;
        $title = get_the_title();
        echo $category .= <<<EOF
        <div class="box">
          <a href="{$link}">
          <div class="boximg">{$src}</div>
          <div class="category">{$c_name}</div>
          <p>{$title}</p>
          </a>
        </div>
EOF;
    }
    wp_reset_query();
    return $category;
}
 /**
  * Add custom column contents in administration
  * @param string $columnName
  */
 public function owl_column($columnName)
 {
     global $post;
     if ($columnName == 'thumbnail') {
         echo edit_post_link(get_the_post_thumbnail($post->ID, 'thumbnail'), null, null, $post->ID);
     }
 }
 /**
  * This function actually adds the post to the list of network recent posts when it is published for the first time.
  *
  * If the content on the post is empty then the title will be 'Auto Draft' and so it is not added to the list
  * until it is published with content.  Once a post has made it to the list it is never added back to the beginning.
  * That is, if you update the post it will not come back on to the list, nor would it move to the front if it was
  * already on the list.
  */
 function Add_Post_To_H1_Recent_Posts_From_Network()
 {
     global $post;
     if ($post->post_title == __('Auto Draft')) {
         return;
     }
     if (!get_post_meta($post->ID, 'published_once', true) && ($post->ID != 1 || strpos($post->content, $this->first_post) === false)) {
         global $wpdb;
         $domains = array();
         $blog_id = get_current_blog_id();
         // Ignore main site posts
         if ($blog_id == BLOG_ID_CURRENT_SITE) {
             return;
         }
         $rows = $wpdb->get_results("SELECT * FROM {$wpdb->dmtable} WHERE `blog_id`={$blog_id} ORDER BY id DESC LIMIT 0,1");
         foreach ($rows as $key => $val) {
             $domains[] = 'http://' . $val->domain;
         }
         $orig_blogurl = get_option('home') ? get_option('home') : get_option('siteurl');
         $mapped_blogurl = count($domains) > 0 ? $domains[0] : $orig_blogurl;
         $thumbnail = get_the_post_thumbnail($post->ID, 'medium', array('class' => 'hrpn-alignleft hrpn-thumb'));
         $essential_post_data = array('title' => $post->post_title, 'permalink' => str_replace($orig_blogurl, $mapped_blogurl, get_the_permalink($post->ID)), 'thumbnail' => $thumbnail, 'date' => $post->post_date);
         $current_recent_posts = get_site_option('network_latest_posts');
         if (empty($current_recent_posts)) {
             $current_recent_posts = array();
         }
         array_unshift($current_recent_posts, $essential_post_data);
         $new_recent_posts = array_slice($current_recent_posts, 0, 50);
         update_site_option('network_latest_posts', $new_recent_posts);
         update_post_meta($post->ID, 'published_once', 'true');
     }
 }
Example #21
0
function testimonialssingle($att)
{
    //echo '<pre>';
    $posts = get_post($att['id']);
    //print_r($posts);
    return '<div class="testmlist"><p><i class="fa-left-quote"></i><span>' . $posts->post_content . '</span><i class="fa-right-quote"></i></p> <div class="test-details">' . get_the_post_thumbnail($posts->ID) . '</div><div class="test-name"><strong>' . $posts->post_title . '</strong> ' . get_field('position', $posts->ID) . '</div></div>';
}
Example #22
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 
}
    /**
     * 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'];
    }
    function widget($args, $instance)
    {
        global $post;
        // Preserve global $post
        $preserve = $post;
        extract($args);
        // only useful on post pages
        if (!is_single()) {
            return;
        }
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Read Next', 'largo') : $instance['title'], $instance, $this->id_base);
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $related = new Largo_Related($instance['qty']);
        //get the related posts
        $rel_posts = new WP_Query(array('post__in' => $related->ids(), 'nopaging' => 1, 'posts_per_page' => $instance['qty'], 'ignore_sticky_posts' => 1));
        if ($rel_posts->have_posts()) {
            echo '<ul class="related">';
            while ($rel_posts->have_posts()) {
                $rel_posts->the_post();
                echo '<li>';
                echo '<a href="' . get_permalink() . '"/>' . get_the_post_thumbnail(get_the_ID(), 'thumbnail', array('class' => 'alignleft')) . '</a>';
                ?>
				<h4><a href="<?php 
                the_permalink();
                ?>
" title="Read: <?php 
                esc_attr(the_title('', '', FALSE));
                ?>
"><?php 
                the_title();
                ?>
</a></h4>
				<h5 class="byline">
					<span class="by-author"><?php 
                largo_byline(true, true);
                ?>
</span>
					<time class="entry-date updated dtstamp pubdate" datetime="<?php 
                echo esc_attr(get_the_date('c'));
                ?>
"><?php 
                largo_time();
                ?>
</time>
				</h5>
				<?php 
                // post excerpt/summary
                largo_excerpt(get_the_ID(), 2, false, '', true);
                echo '</li>';
            }
            echo "</ul>";
        }
        echo $after_widget;
        // Restore global $post
        wp_reset_postdata();
        $post = $preserve;
    }
Example #25
0
 /**
  * Latest blog posts
  *
  * @param int    $limit post display limit
  *
  * @param string $thumbnail_size
  *
  * @return array
  */
 public static function getRecent($limit = 10, $thumbnail_size = 'thumbnail')
 {
     $args = array('numberposts' => $limit, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending', 'suppress_filters' => true);
     $array_out = array();
     $recent_posts = \get_posts(\wp_parse_args($args));
     /*$like_bool    = Option::get_theme_option( 'blog_list_like' );
       if ( $like_bool === '1' ) {
           $PostLike = \SilverWp\Ajax\PostLike::getInstance();
       }*/
     foreach ($recent_posts as $key => $recent) {
         \setup_postdata($recent);
         $post_id = $recent->ID;
         //$array_out[ $key ] = $recent;
         $array_out[$key]['ID'] = $post_id;
         $array_out[$key]['post_title'] = \get_the_title($post_id);
         $array_out[$key]['url'] = \get_the_permalink($post_id);
         $array_out[$key]['post_author'] = \get_the_author();
         $array_out[$key]['post_date'] = \get_the_date('', $post_id);
         $array_out[$key]['post_date_utc'] = \get_the_time('c', $post_id);
         //$array_out[ $key ]['post_like'] = ($like_bool === '1') ? $PostLike->getPostLikeCount($post_id) : '';
         $array_out[$key]['post_comment_count'] = $recent->comment_count;
         if (strpos($recent->post_content, '<!--more-->') || empty($recent->post_excerpt)) {
             $array_out[$key]['post_excerpt'] = \get_the_excerpt();
         } else {
             $array_out[$key]['post_excerpt'] = $recent->post_excerpt;
         }
         $array_out[$key]['image_html'] = \get_the_post_thumbnail($post_id, $thumbnail_size);
         // Thumbnail
         $array_out[$key]['categories'] = self::getTaxonomy($post_id);
     }
     \wp_reset_postdata();
     return $array_out;
 }
Example #26
0
 public static function infoW()
 {
     global $javo_tso;
     $javo_query = new JAVO_ARRAY($_POST);
     $javo_result = array("state" => "fail");
     if (false !== ($post_id = $javo_query->get("post_id", false))) {
         $post = get_post($post_id);
         // Get Strings
         $javo_meta_query = new javo_get_meta($post->ID);
         // Get Ratings
         $javo_rating = new javo_RATING($post->ID);
         //
         if (false == ($javo_this_author = get_userdata($post->post_author))) {
             $javo_this_author = new stdClass();
             $javo_this_author->display_name = '';
         }
         // Post Thumbnail
         if ('' === ($javo_this_thumb = get_the_post_thumbnail($post->ID, 'javo-map-thumbnail'))) {
             $javo_this_thumb = sprintf('<img src="%s" class="img-responsive wp-post-image" style="width:150px; height:168px;">', $javo_tso->get('no_image', JAVO_IMG_DIR . '/no-image.png'));
         }
         // Other Informations
         $javo_result = array('state' => 'success', 'post_id' => $post->ID, 'post_title' => $post->post_title, 'permalink' => get_permalink($post->ID), 'thumbnail' => $javo_this_thumb, 'category' => $javo_meta_query->cat('item_category', __('No Category', 'javo_fr')), 'location' => $javo_meta_query->cat('item_location', __('No Location', 'javo_fr')), 'phone' => get_post_meta($post->ID, 'jv_item_phone', true), 'website' => get_post_meta($post->ID, 'jv_item_website', true), 'email' => get_post_meta($post->ID, 'jv_item_email', true), 'address' => get_post_meta($post->ID, 'jv_item_address', true), 'author_name' => $javo_this_author->display_name);
     }
     die(json_encode($javo_result));
 }
Example #27
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 
}
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     $posts = isset($instance['posts']) ? $instance['posts'] : array();
     if (!empty($posts)) {
         echo '<div class="widget widget_text">
                         <h3 class="widget-title">' . $title . '</h3>
                         <div class="textwidget">';
         foreach ($posts as $key => $post) {
             $image = get_the_post_thumbnail($key, 'members-widget-thumb');
             $email = tfuse_page_options('member_email', '', $key);
             $job = tfuse_page_options('member_job', '', $key);
             $phone = tfuse_page_options('member_phone', '', $key);
             echo '<div class="contact-person">
                                 ' . $image . '
                                 <div class="contact-person-info">
                                     <strong>' . get_the_title($key) . '</strong>';
             if (!empty($job)) {
                 echo '<em>' . $job . '</em>';
             }
             if (!empty($phone)) {
                 echo '<span>' . $phone . '</span>';
             }
             if (!empty($email)) {
                 echo '<a href="mailto:' . $email . '">' . $email . '</a>';
             }
             echo '</div>
                             </div>';
         }
         echo '</div>
                     </div>';
     }
 }
Example #29
-1
/**
 * Testimonials custom columns content.
 */
function showcase_posts_columns($column, $post_id)
{
    global $post;
    switch ($column) {
        case 'showcase_image':
            $sc_carousel_thumb = get_the_post_thumbnail($post_id, 'thumbnail');
            echo sprintf('<a href="%1$s" title="%2$s">%3$s</a>', admin_url('post.php?post=' . $post_id . '&action=edit'), get_the_title(), $sc_carousel_thumb);
            break;
        case 'showcase_texto':
            $sc_carousel_texto = get_post_field('post_content', $post_id);
            /* or you can use get_the_title() */
            $sc_carousel_getlength = strlen($sc_carousel_texto);
            $sc_carousel_thelength = 120;
            echo substr($sc_carousel_texto, 0, $sc_carousel_thelength);
            if ($sc_carousel_getlength > $sc_carousel_thelength) {
                echo "...";
            }
            break;
        case 'showcase_url':
            $vc_showcase_facebook = get_post_meta($post_id, 'vc_showcase_facebook', true);
            $vc_showcase_google_plus = get_post_meta($post_id, 'vc_showcase_google_plus', true);
            $vc_showcase_linkedin = get_post_meta($post_id, 'vc_showcase_linkedin', true);
            $vc_showcase_custom_link = get_post_meta($post_id, 'vc_showcase_custom_link', true);
            echo !empty($vc_showcase_facebook) ? sprintf('<a href="%1$s" target="_blank">%1$s</a><br />', esc_url($vc_showcase_facebook)) : '';
            echo !empty($vc_showcase_google_plus) ? sprintf('<a href="%1$s" target="_blank">%1$s</a><br />', esc_url($vc_showcase_google_plus)) : '';
            echo !empty($vc_showcase_linkedin) ? sprintf('<a href="%1$s" target="_blank">%1$s</a><br />', esc_url($vc_showcase_linkedin)) : '';
            echo !empty($vc_showcase_custom_link) ? sprintf('<a href="%1$s" target="_blank">%1$s</a><br />', esc_url($vc_showcase_custom_link)) : '';
            break;
    }
}
Example #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;
 }