Changeset 551510
- Timestamp:
- 05/31/2012 06:41:44 PM (14 years ago)
- Location:
- lazy-content-slider/tags/2.1
- Files:
-
- 2 edited
-
lzcs.php (modified) (4 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lazy-content-slider/tags/2.1/lzcs.php
r551450 r551510 5 5 Description: This is a content slider that shows 5 slides from a "Featured Category" 6 6 Author: Lee Thompson 7 Version: 2. 17 Version: 2.2 8 8 Author URI: http://mysqlhow2.com 9 9 … … 90 90 } 91 91 92 function drawslider() { 93 global $post; 94 echo "<div id=\"featured\" >"; 95 echo "<ul class=\"ui-tabs-nav\">"; 92 function getDisplayPosts($limit = 4) 93 { 96 94 $posts = get_option('lzcs_cat'); 97 95 $args = array('category' => $posts ); 98 96 $recent_posts = wp_get_recent_posts( $args ); 99 100 $limit = 4; 101 $displayedPosts = 0; 102 97 98 $output = array(); 99 foreach ($recent_posts as $post) { 100 setup_postdata($post); 101 if (has_post_thumbnail($post['ID'])) { 102 $output[] = $post; 103 } 104 105 if (count($output) > $limit) break; 106 } 107 108 return $output; 109 } 110 111 function drawslider() { 112 global $post; 113 $recent_posts = getDisplayPosts(); 114 115 if (count($recent_posts) == 0) { 116 return; 117 } 118 119 echo "<div id=\"featured\" >"; 120 echo "<ul class=\"ui-tabs-nav\">"; 121 103 122 foreach( $recent_posts as $recent ){ 104 123 setup_postdata($recent); 105 124 $postid = $recent["ID"]; 106 if (!has_post_thumbnail($postid)) { 107 continue; 108 } 109 110 if (++$displayedPosts > $limit) break; 111 125 112 126 $thumbnail = get_the_post_thumbnail( $postid, array(50, 50) ); 113 127 … … 124 138 echo '</ul>'; // Closing the div.ui-tabs-nav 125 139 126 $displayedPosts = 0; 127 140 128 141 foreach( $recent_posts as $recent ){ 129 142 $postid = $recent["ID"]; … … 132 145 $postexcerpt = string_limit_words($postexcerpt,15); 133 146 134 if (!has_post_thumbnail($postid)) {135 continue;136 }137 138 if (++$displayedPosts > $limit) break;139 140 147 $largeimage = get_the_post_thumbnail( $postid, array(400, 250)); 141 148 ?> -
lazy-content-slider/tags/2.1/readme.txt
r551450 r551510 5 5 Requires at least: 2.9.2 6 6 Tested up to: 3.3.2 7 Stable tag: 2. 17 Stable tag: 2.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 51 51 52 52 == Frequently Asked Questions == 53 Just want to give shout out to Tim Garrison who helped with my looping and53 Just want to give shout out to Tim Garrison [http://www.skudd.com/] who helped with my looping and 54 54 webdeveloperplus with the great tutorial on the slider using jquery. 55 55 … … 71 71 = 2.1 = 72 72 Added Excerpt to div.info 73 = 2.2 = 74 Refactored to not show the div if no thumbnail-enabled posts are found - 75 tgarrison 73 76 74 77 … … 89 92 = 2.1 = 90 93 Added Excerpt to div.info 94 = 2.2 = 95 Refactored to not show the div if no thumbnail-enabled posts are found - 96 tgarrison 97
Note: See TracChangeset
for help on using the changeset viewer.