Example #1
0
    function raindrops_tile($args = array())
    {
        global $query_string;
        $defaults = array('posts_per_page' => 3, 'numberposts' => -1, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => get_option('sticky_posts'), 'raindrops_tile_col' => 3);
        $args = wp_parse_args($args, $defaults);
        $args['paged'] = get_query_var('page');
        if (!isset($args['paged'])) {
            $args['paged'] = 1;
        }
        if ($args['paged'] > 0) {
            $args['offset'] = ($args['paged'] - 1) * $args['posts_per_page'];
        } else {
            $args['offset'] = 0;
        }
        $raindrops_posts = get_posts($args);
        $raindrops_html_page = '<li><a href="%1$s" class="%2$s"><span class="%3$st">%4$s</span></a></li>';
        if (!empty($raindrops_posts)) {
            ?>
<div id="portfolio" class="portfolio column-<?php 
            echo $args['raindrops_tile_col'];
            ?>
"><?php 
            do_action('raindrops_tile_pre');
            raindrops_loop_title();
            $raindrops_loop_number = 1;
            foreach ($raindrops_posts as $post) {
                setup_postdata($post);
                $raindrops_loop_class = raindrops_loop_class($raindrops_loop_number, $post->ID);
                printf('<li class="loop-%1$s%2$s" %3$s>', trim($raindrops_loop_class[0]), apply_filters('raindrops_tile_class', ' ' . trim($raindrops_loop_class[1]), $post->ID), apply_filters('raindrops_tile_style', $raindrops_loop_class[2], $post->ID));
                $raindrops_loop_number++;
                ?>
<div id="post-<?php 
                echo $post->ID;
                ?>
"><<?php 
                raindrops_doctype_elements('div', 'article');
                ?>
 id="post-tile-<?php 
                echo $post->ID;
                ?>
" <?php 
                raindrops_post_class('', $post->ID);
                ?>
 >
					<h2 class="entry-title"><a href="<?php 
                echo get_permalink($post->ID);
                ?>
">
							<?php 
                $title = get_the_title($post->ID);
                $title = wp_html_excerpt($title, apply_filters('raindrops_tile_title_length', 40), apply_filters('raindrops_tile_title_more', '...'));
                echo raindrops_fallback_title($title, $post->ID);
                ?>
</a></h2>
					<div class="posted-on">
						<?php 
                raindrops_posted_on();
                ?>
					</div>
					<div class="entry-content clearfix">
						<a href="<?php 
                echo get_comments_link($post->ID);
                ?>
" class="raindrops-comment-link"><span class="raindrops-comment-string point"></span><em><?php 
                esc_html_e('Comment', 'raindrops');
                ?>
</em></a>
					</div>
					<div class="entry-meta">
						<?php 
                edit_post_link(esc_html__('Edit', 'raindrops') . raindrops_link_unique('Post', $post->ID), '<span class="edit-link">', '</span>', $post->ID);
                ?>
					</div>
					<br class="clear" />
					</<?php 
                raindrops_doctype_elements('div', 'article');
                ?>
></div>
				</li>
			<?php 
            }
            //foreach( $raindrops_posts as $post )
            ?>
			</ul>
			<br class="clear" />
			<?php 
            $html = '';
            if (0 == $args['paged']) {
                if (is_front_page()) {
                    $url = esc_url(add_query_arg('page', 2)) . '#portfolio';
                    $html = '<li><a href="' . esc_url($url) . '" title="page 2" class="portfolio-page2">' . esc_html__('Page', 'raindrops') . '2</a></li>';
                } else {
                    $url = esc_url(add_query_arg('page', 2)) . '#portfolio';
                    $html = '<li><a href="' . esc_url($url) . '" title="page 2" class="portfolio-page2">' . esc_html__('Page', 'raindrops') . '2</a></li>';
                }
            } elseif ($args['paged'] > 0) {
                $page = $args['paged'] + 1;
                $url = esc_url(add_query_arg('page', $page)) . '#portfolio';
                $html = sprintf($raindrops_html_page, esc_url($url), 'portfolio-next portfolio-' . $page, 'portfolio-nav-next', esc_html__('Page', 'raindrops') . ' ' . $page);
            }
            $url = esc_url(add_query_arg('page', $args['paged'])) . '#portfolio';
            $raindrops_page_for_posts = get_option('page_for_posts');
            $raindrops_html_page = '<li><a href="%1$s" class="%2$s"><span class="%3$st">%4$s</span></a></li>';
            if ($args['post_type'] == 'post' && $raindrops_page_for_posts) {
                $html .= sprintf($raindrops_html_page, esc_url(get_permalink($raindrops_page_for_posts)), 'portfolio-link-to-page-for-posts', 'link-to-page-title', get_the_title($raindrops_page_for_posts));
            }
            if (2 == $args['paged']) {
                $page = $args['paged'] - 1;
                $url = esc_url(add_query_arg('page', $page)) . '#portfolio';
                $html .= sprintf($raindrops_html_page, esc_url($url), 'portfolio-prev portfolio-home', 'portfolio-nav-prev', __('Portfolio Home', 'raindrops'));
            } elseif ($args['paged'] > 2) {
                $page = $args['paged'];
                $page = $page - 1;
                $url = esc_url(add_query_arg('page', $page)) . '#portfolio';
                $html .= sprintf($raindrops_html_page, esc_url($url), 'portfolio-prev portfolio-' . $page, 'portfolio-nav-prev', esc_html__('Page', 'raindrops') . ' ' . $page);
            }
            echo apply_filters('raindrops_portfolio_nav', sprintf('<div class="portfolio-nav"><ul>%1$s</ul></div>', $html));
        } else {
            //! empty( $raindrops_posts )
            ?>
<div  id="post-<?php 
            the_ID();
            ?>
"><<?php 
            raindrops_doctype_elements('div', 'article');
            ?>
 <?php 
            raindrops_post_class('no-portfolio');
            ?>
 ><?php 
            $url = remove_query_arg('page', get_permalink());
            $raindrops_html_page = '<p style="text-align:center;"><a href="%1$s" class="%2$s" ><span class="%3$st">%4$s</span></a></p>';
            if (preg_match('!page=!', $query_string)) {
                ?>
<h3 style="text-align:center" class="h1 portfolio-navigation-last">End</h3><?php 
                echo apply_filters('raindrops_portfolio_nav', sprintf($raindrops_html_page, esc_url($url), 'portfolio-home', 'portfolio-home-text', esc_html__('Portfolio Home', 'raindrops')));
            }
            echo apply_filters('raindrops_portfolio_nav', sprintf($raindrops_html_page, home_url(), 'portfolio blog-home-link', 'portfolio-nav', esc_html__('Home', 'raindrops')));
            ?>
</<?php 
            raindrops_doctype_elements('div', 'article');
            ?>
></div><?php 
        }
        wp_reset_postdata();
        do_action('raindrops_tile_after');
        ?>
		</div>
		<?php 
    }
Example #2
0
            echo '<!--Single Post Format or 2 Category ' . $cat . ' start-->';
        }
        raindrops_before_article();
        ?>
						<div id="post-<?php 
        the_ID();
        ?>
"  class="<?php 
        echo raindrops_article_wrapper_class();
        ?>
">
                        <<?php 
        raindrops_doctype_elements('div', 'article');
        ?>
 <?php 
        raindrops_post_class(array('clearfix'));
        ?>
>	
                        <?php 
        $raindrops_sticky_conditional = raindrops_warehouse_clone('raindrops_display_sticky_post');
        if (is_sticky() && 'only_home' == $raindrops_sticky_conditional) {
            ?>
                            <div class="sticky-single-follow-text">

                                <strong><a href="<?php 
            echo $raindrops_home_url;
            ?>
"><?php 
            esc_html_e('Sticky Post Shows Only WEB Site Home.', 'raindrops');
            ?>
</a></strong>
Example #3
0
                        <div class="entry page"><?php 
        raindrops_before_article();
        ?>
<div  id="post-<?php 
        the_ID();
        ?>
" class="<?php 
        echo raindrops_article_wrapper_class();
        ?>
">
								
                            <<?php 
        raindrops_doctype_elements('div', 'article');
        ?>
 <?php 
        raindrops_post_class();
        ?>
>

                            <?php 
        the_post_thumbnail('full', 'class=page-featured-image');
        raindrops_entry_title();
        ?>
                            <div class="entry-content">
                                <?php 
        raindrops_prepend_entry_content();
        raindrops_entry_content();
        ?>
                                <br class="clear" />
                                <?php 
        raindrops_append_entry_content();
Example #4
0
 function widget($args, $instance)
 {
     global $attachment;
     extract($args);
     echo $before_widget;
     if (isset($instance['id']) && preg_match('!,!', $instance['id'])) {
         $instance['id'] = explode(',', $instance['id']);
         $count = count($instance['id']);
         $num = rand(0, $count - 1);
         $instance['id'] = $instance['id'][$num];
     }
     if (isset($instance['id']) && isset($instance['inline_style']) && !empty($instance['inline_style'])) {
         $style = str_replace(PHP_EOL, '', $instance['inline_style']);
         $style = wp_strip_all_tags($style);
         echo '<div id="pinup-' . absint($instance['id']) . '" ' . raindrops_post_class('', absint($instance['id']), false) . ' style="' . $style . '">';
     } else {
         if (isset($instance['id']) && isset($instance['inline_style'])) {
             $style = str_replace(PHP_EOL, '', $instance['inline_style']);
             $style = wp_strip_all_tags($style);
             echo '<div id="pinup-' . absint($instance['id']) . '" ' . raindrops_post_class('', absint($instance['id']), false) . ' style="' . $style . '">';
         }
     }
     if (isset($instance['inline_style']) && ($instance['content'] == 'content' || $instance['content'] == 'excerpt') && !is_single($instance['id'])) {
         $posts = get_posts(array('include' => absint($instance['id']), 'post_type' => sanitize_key($instance['type'])));
         $pinup_entry_title_class = apply_filters('raindrops_pinup_entry_title_class', ' title pinup-entry-title ');
         $pinup_entry_title_class = trim($pinup_entry_title_class);
         $html_title = '<h2 class="' . esc_attr($pinup_entry_title_class) . '" id="approach-%1$s"><a href="%2$s"><span>%3$s</span></a></h2>';
         foreach ($posts as $post) {
             setup_postdata($post);
             printf($html_title, absint($post->ID), esc_url(get_permalink($post->ID)), get_the_title($post->ID));
             if (isset($instance['content']) and $instance['content'] == 'excerpt') {
                 the_excerpt();
             } else {
                 if (isset($post->post_content) && !empty($post->post_content)) {
                     $raindrops_pinup_content = $post->post_content;
                     if (preg_match('/<!--more[^-]*-->/u', $raindrops_pinup_content, $matches)) {
                         list($raindrops_pinup_content, $raindrops_pinup_sub_content) = explode($matches[0], $raindrops_pinup_content, 2);
                         $raindrops_pinup_content = apply_filters('the_content', $raindrops_pinup_content);
                         $raindrops_pinup_content = apply_filters('raindrops_entry_content', $raindrops_pinup_content);
                         $raindrops_pinup_content = str_replace(']]>', ']]&gt;', $raindrops_pinup_content);
                         echo $raindrops_pinup_content;
                     } elseif (preg_match('/<!--nextpage-->/u', $raindrops_pinup_content, $matches)) {
                         list($raindrops_pinup_content, $raindrops_pinup_sub_content) = explode($matches[0], $raindrops_pinup_content, 2);
                         $raindrops_pinup_content = apply_filters('the_content', $raindrops_pinup_content);
                         $raindrops_pinup_content = apply_filters('raindrops_entry_content', $raindrops_pinup_content);
                         $raindrops_pinup_content = str_replace(']]>', ']]&gt;', $raindrops_pinup_content);
                         echo $raindrops_pinup_content;
                     } else {
                         $raindrops_pinup_content = get_post(absint($post->ID));
                         $raindrops_pinup_content = apply_filters('the_content', $raindrops_pinup_content->post_content);
                         $raindrops_pinup_content = apply_filters('raindrops_entry_content', $raindrops_pinup_content);
                         $raindrops_pinup_content = str_replace(']]>', ']]&gt;', $raindrops_pinup_content);
                         echo $raindrops_pinup_content;
                     }
                 }
             }
         }
         wp_reset_postdata();
     }
     if (isset($instance['inline_style']) && $instance['content'] == 'attachment' && !is_single($instance['id'])) {
         $args = array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => 'public', 'post_parent' => $instance['id']);
         $attachments = get_posts($args);
         $attachments_num = count($attachments);
         if (isset($attachments) && $attachments_num > 1) {
             $attachment_key = rand(0, $attachments_num - 1);
             $post = $attachments[$attachment_key];
         } elseif ($attachments_num == 1) {
             $post = $attachments[0];
         } else {
         }
         if (isset($attachments) && $attachments_num > 0) {
             setup_postdata($post);
             $raindrops_image_size = 'midium';
             if (raindrops_warehouse_clone('raindrops_right_sidebar_width_percent') > 25) {
                 $raindrops_image_size = 'large';
             }
             $html = '<a href="%1$s" class="approach-image">%2$s</a>';
             $check_alt_exists = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
             if (!empty($check_alt_exists)) {
                 $alt_attribute = esc_attr($check_alt_exists);
             } else {
                 $alt_attribute = wp_kses(get_the_title($instance['id']), array());
             }
             $attr = array('alt' => trim($alt_attribute));
             printf($html, get_permalink($instance['id']), wp_get_attachment_image($post->ID, apply_filters('raindrops_pinup_image_size', $raindrops_image_size, get_the_ID()), false, $attr));
             $html = '<h2 class="entry-title raindrops-entrywidget-attachment-title" id="approach-%2$s">%1$s</h2>';
             printf($html, get_the_title($instance['id']), absint($instance['id']));
             wp_reset_postdata();
         }
     }
     if (isset($instance['inline_style']) && $instance['content'] == 'featured' && !is_single($instance['id'])) {
         if (has_post_thumbnail($instance['id'])) {
             $html = '<a href="%1$s" class="approach-image">%2$s</a>';
             $raindrops_image_size = 'midium';
             if (raindrops_warehouse_clone('raindrops_right_sidebar_width_percent') > 25) {
                 $raindrops_image_size = 'large';
             }
             $alt_attribute = wp_kses(get_the_title($instance['id']), array());
             $attr = array('alt' => trim($alt_attribute));
             printf($html, esc_url(get_permalink($instance['id'])), get_the_post_thumbnail($instance['id'], apply_filters('raindrops_pinup_image_size', $raindrops_image_size, get_the_ID())), $attr);
             $html = '<h2 class="entry-title raindrops-entrywidget-attachment-title" id="approach-%2$s">%1$s</h2>';
             printf($html, get_the_title($instance['id']), absint($instance['id']));
         } else {
             $html = '<h2 class="entry-title raindrops-entrywidget-attachment-title" id="approach-%2$s"><a href="%3$s" class="approach-image">%1$s</a></h2>';
             printf($html, get_the_title($instance['id']), absint($instance['id']), esc_url(get_permalink($instance['id'])));
         }
     }
     if (isset($instance['id'])) {
         echo '</div>';
     }
     echo $after_widget;
 }