Changeset 193586
- Timestamp:
- 01/13/2010 02:29:37 PM (16 years ago)
- Location:
- mm-breaking-news/trunk
- Files:
-
- 3 edited
-
changelog.txt (modified) (1 diff)
-
mm-bnlist.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mm-breaking-news/trunk/changelog.txt
r107565 r193586 1 2009-04-03 0.5.2 Milan Milosevic 1 2010-01-13, ver 0.6, Milan Milosevic 2 Added shortcode [mm-breaking-news] for displaying a list in a page/post 2 3 4 2009-12-25, ver 0.5.3, Milan Milosevic 5 Bugfix: Wordpress 2.9 6 7 2009-04-03, ver 0.5.2, Milan Milosevic 3 8 Bugfix: problem with CSS file 4 9 5 2009-03-6 0.5 Milan Milosevic 6 10 2009-03-6, ver 0.5, Milan Milosevic 7 11 Uploaded to Wordpress.org -
mm-breaking-news/trunk/mm-bnlist.php
r187043 r193586 6 6 Author: Milan Milosevic 7 7 Author URI: http://www.mmilan.com/ 8 Version: 0. 5.38 Version: 0.6 9 9 License: GPL v3 - http://www.gnu.org/licenses/ 10 10 … … 73 73 echo "<b>".$opt_tmp['title'][$i]."</b>"; 74 74 echo "<ul>"; 75 global $post;76 75 $catid = Array(); 77 76 if (!empty($opt_tmp['in'][$i])) foreach ($opt_tmp['in'][$i] as $tmp) $catid[] = $tmp; … … 82 81 if ($show_rand[$i] == "YES") $myposts = get_posts("numberposts=$num&category=$catids&orderby=rand"); 83 82 else $myposts = get_posts("numberposts=$num&category=$catids"); 84 foreach($myposts as $ post) :85 setup_postdata($ post);83 foreach($myposts as $show_post) : 84 setup_postdata($show_post); 86 85 if ($show_date[$i] == "YES") $sh_date = the_date('M dS, Y', ' (', '', FALSE); 87 86 else $sh_date = ''; 88 if ($show_comments[$i] == "YES") $no_com = "".$ post->comment_count." comments)";87 if ($show_comments[$i] == "YES") $no_com = "".$show_post->comment_count." comments)"; 89 88 else $no_com = ''; 90 89 if (($show_date[$i] == "YES") and ($show_comments[$i] == "YES")) $sep = "; "; … … 92 91 else $sep = " ("; 93 92 if (($show_date[$i] != "YES") and ($show_comments[$i] != "YES")) $sep = ""; 94 print "<li><a href=\"".get_permalink()."\">".$ post->post_title."</a><span class=\"date_com\">".$sh_date.$sep.$no_com."</span></li>";93 print "<li><a href=\"".get_permalink()."\">".$show_post->post_title."</a><span class=\"date_com\">".$sh_date.$sep.$no_com."</span></li>"; 95 94 endforeach; 96 95 echo "</ul>"; … … 102 101 } 103 102 } 103 104 // Add shortcode 105 function mm_bnlist_code ($attr) { 106 107 // Read in existing option value from database 108 $opt_name = array( 109 'n' =>'mm_bnlist_n', 110 'in' => 'mm_bnlist_in', 111 'out' => 'mm_bnlist_out', 112 'num' => 'mm_bnlist_num', 113 'title' => 'mm_bnlist_title', 114 ); 115 116 $opt_val = array( 117 'n' => get_option( $opt_name['n'] ), 118 'in' => get_option( $opt_name['in'] ), 119 'out' => get_option( $opt_name['out'] ), 120 'num' => get_option( $opt_name['num'] ), 121 'title' => get_option( $opt_name['title'] ), 122 ); 123 if ($opt_val['n'] < 1) $opt_val['n'] = 1; 124 125 $opt_tmp['title'] = unserialize($opt_val['title']); 126 $opt_tmp['num'] = unserialize($opt_val['num']); 127 $opt_tmp['in'] = unserialize($opt_val['in']); 128 $opt_tmp['out'] = unserialize($opt_val['out']); 129 $show_comments = unserialize(get_option('mm_bnlist_comments')); 130 $show_date = unserialize(get_option('mm_bnlist_date')); 131 $show_rand = unserialize(get_option('mm_bnlist_rand')); 132 133 for ( $i = 0; $i < $opt_val['n']; $i+=1 ) { 134 echo "<h3>".$opt_tmp['title'][$i]."</h3>"; 135 echo "<ul>"; 136 $catid = Array(); 137 if (!empty($opt_tmp['in'][$i])) foreach ($opt_tmp['in'][$i] as $tmp) $catid[] = $tmp; 138 if (!empty($opt_tmp['out'][$i])) foreach ($opt_tmp['out'][$i] as $tmp) $catid[] = -$tmp; 139 $catids = implode(',', $catid); 140 141 $num = $opt_tmp['num'][$i]; 142 if ($show_rand[$i] == "YES") $myposts = get_posts("numberposts=$num&category=$catids&orderby=rand"); 143 else $myposts = get_posts("numberposts=$num&category=$catids"); 144 foreach($myposts as $show_post) : 145 setup_postdata($show_post); 146 if ($show_date[$i] == "YES") $sh_date = the_date('M dS, Y', ' (', '', FALSE); 147 else $sh_date = ''; 148 if ($show_comments[$i] == "YES") $no_com = "".$show_post->comment_count." comments)"; 149 else $no_com = ''; 150 if (($show_date[$i] == "YES") and ($show_comments[$i] == "YES")) $sep = "; "; 151 else if ($show_date[$i] == "YES") $sep = ")"; 152 else $sep = " ("; 153 if (($show_date[$i] != "YES") and ($show_comments[$i] != "YES")) $sep = ""; 154 print "<li><a href=\"".get_permalink()."\">".$show_post->post_title."</a><span class=\"date_com\">".$sh_date.$sep.$no_com."</span></li>"; 155 endforeach; 156 echo "</ul>"; 157 } 158 159 if (get_option('mm_bnlist_credits') != "NO") 160 echo "<p style=\"text-align: right; font-size: 0.7em \">Plugin by <a href=\"http://www.mmilan.com\">mmilan.com</a></p>"; 161 } 162 163 add_shortcode('mm-breaking-news', 'mm_bnlist_code'); 104 164 105 165 // Admin menu -
mm-breaking-news/trunk/readme.txt
r187043 r193586 4 4 Tags: latest, post, category, front, page, archive, news 5 5 Requires at least: 2.6 6 Tested up to: 2.9 7 Stable tag: 0. 5.36 Tested up to: 2.9.1 7 Stable tag: 0.6 8 8 9 9 Displays lists of posts from selected categories. You can select how many different lists you want, sort posts by date or random. … … 17 17 Lists can be show whereber you want - above or below posts, in archive, or on single post or page. Also, you can place it in sidebar. You can choose to show lists only on first page or not. 18 18 19 If you want to show a list on one page (or post) you can use a shortcode [mm-breaking-news] when you write and the whole bullet list will be displayed. 20 19 21 Changelog: 20 22 21 2009-12-25 0.5.3 Milan Milosevic 23 2010-01-13, ver 0.6, Milan Milosevic 24 Added shortcode [mm-breaking-news] for displaying a list in a page/post 25 26 2009-12-25, ver 0.5.3, Milan Milosevic 22 27 Bugfix: Wordpress 2.9 23 28 24 2009-04-03 0.5.1Milan Milosevic29 2009-04-03, ver 0.5.2, Milan Milosevic 25 30 Bugfix: problem with CSS file 26 31 27 2009-03-6 0.5 Milan Milosevic 28 First realase! 32 2009-03-6, ver 0.5, Milan Milosevic 33 Uploaded to Wordpress.org 34 29 35 30 36 == Installation ==
Note: See TracChangeset
for help on using the changeset viewer.