/** ** Front-end display of widget. ** ** @see WP_Widget::widget() ** ** @param array $args Widget arguments. ** @param array $instance Saved values from database. **/ function widget($args, $instance) { extract($args); $thisTitle = $instance['title']; $thisNumber = $instance['num']; $thisCategory = $instance['cat']; $category_link = get_category_link($thisCategory); $titleBarSpan = '<span class="block section-title-bar">' . $thisTitle . '</span>'; $titleBarLink = '<a href="' . esc_url($category_link) . '">' . $titleBarSpan . '</a>'; $argsQueryPosts = array('cat' => $thisCategory, 'showposts' => $thisNumber); $thisQuery = new WP_Query($argsQueryPosts); echo "\n"; echo ' <div class="container newlife-widget newlife-snippet-posts">' . "\n"; if ($thisCategory != 0) { echo ' ' . $titleBarLink . "\n"; } else { echo ' ' . $titleBarSpan . "\n"; } echo ' <div class="snippet-posts">' . "\n"; while ($thisQuery->have_posts()) { $thisQuery->the_post(); ob_start(); ?> <div class="post"> <div class="post-title"> <h2><a href="<?php echo get_permalink(); ?> " rel="bookmark"><?php echo the_title(); ?> </a></h2> </div> <div class="post-entry"> <?php the_excerpt(); echo "\n"; ?> </div> <div class="post-meta"> <?php newlife_post_data(); echo "\n"; ?> </div> <div class="clear"></div> </div> <?php echo ob_get_clean(); } echo ' <div class="navigation-posts">' . "\n"; echo ' </div>' . "\n"; echo ' <div class="clear"></div>' . "\n"; echo ' </div>' . "\n"; echo " </div>\n"; wp_reset_postdata(); }
/** ** Front-end display of widget. ** ** @see WP_Widget::widget() ** ** @param array $args Widget arguments. ** @param array $instance Saved values from database. **/ function widget($args, $instance) { extract($args); $thisTitle = $instance['title']; $thisNumber = $instance['num']; $thisCategory = $instance['cat']; $argsQueryPosts = array('cat' => $thisCategory, 'showposts' => $thisNumber); $thisQuery = new WP_Query($argsQueryPosts); echo "\n"; echo ' <div class="container newlife-widget newlife-expandable-posts">' . "\n"; echo ' <span class="block section-title-bar cursor-pointer" onclick="toggleExpandablePosts(this);">' . $thisTitle . '<span class="expandable-icon"></span><div class="clear"></div></span>' . "\n"; echo ' <div class="expandable expandable-posts">' . "\n"; while ($thisQuery->have_posts()) { $thisQuery->the_post(); ob_start(); ?> <div class="post"> <div class="post-title"> <h2><a href="<?php echo get_permalink(); ?> " rel="bookmark"><?php echo the_title(); ?> </a></h2> </div> <div class="post-entry"> <?php the_content('Read the rest of this entry »'); echo "\n"; ?> </div> <div class="post-meta"> <?php newlife_post_data(); echo "\n"; ?> </div> <div class="clear"></div> </div> <?php echo ob_get_clean(); } echo ' <div class="navigation-posts">' . "\n"; echo ' </div>' . "\n"; echo ' <div class="clear"></div>' . "\n"; echo ' </div>' . "\n"; echo " </div>\n"; wp_reset_postdata(); }
<h2><a href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a></h2> </div> <div class="post-entry"> <?php the_content('Read the rest of this entry »'); ?> </div> <div class="post-meta"> <?php newlife_post_data(); ?> </div> <div class="clear"></div> </div> <?php } ?> <div class="navigation-posts"> <?php if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?> <div class="alignleft"><?php next_posts_link('« Older Entries');