- Bana iletişim formumdan ulaşan bir makale isteğini hazırlayıp sizlere sunuyorum. Artık bu tarz isteklerinizi ve sorunlarınızı bana Wordpress Sıkça Sorulan Sorular konu başlığı altında yorum bölümüne sorununuzu yazarak ta iletebilirsiniz. Tabiyki sizlerinde katkılarını bekliyorum. Bu makalede yapılan işlem benzer yazıların resimli şekilde görüntülenmesini sağlamak için neler yapmanız gerektiğini anlatacağım.
- Benzer yazıların Wordpress 2.6.2 için çıkan son versiyonu (v1.0) aşağıda verdiğim kodla beraber resimli benzer yazılar eklentisi haline dönüşüyor.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | <?php /* Plugin Name: WordPress Related Posts Version: 1.0 Plugin URI: http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/ Description: Generate a related posts list via tags of WordPress Author: Denis Author URI: http://fairyfish.net/ Copyright (c) 2007 Released under the GPL license http://www.gnu.org/licenses/gpl.txt This file is part of WordPress. WordPress is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA INSTALL: Just install the plugin in your blog and activate */ add_action('init', 'init_textdomain'); function init_textdomain(){ load_plugin_textdomain('wp_related_posts',PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) . '/lang'); } function wp_get_related_posts() { global $wpdb, $post,$table_prefix; $wp_rp = get_option("wp_rp"); $exclude = explode(",",$wp_rp["wp_rp_exclude"]); $limit = $wp_rp["wp_rp_limit"]; $wp_rp_title = $wp_rp["wp_rp_title"]; $wp_no_rp = $wp_rp["wp_no_rp"]; $wp_no_rp_text = $wp_rp["wp_no_rp_text"]; $show_date = $wp_rp["wp_rp_date"]; $show_comments_count = $wp_rp["wp_rp_comments"]; if ( $exclude != '' ) { $q = "SELECT tt.term_id FROM ". $table_prefix ."term_taxonomy tt, " . $table_prefix . "term_relationships tr WHERE tt.taxonomy = 'category' AND tt.term_taxonomy_id = tr.term_taxonomy_id AND tr.object_id = $post->ID"; $cats = $wpdb->get_results($q); foreach(($cats) as $cat) { if (in_array($cat->term_id, $exclude) != false){ return; } } } if(!$post->ID){return;} $now = current_time('mysql', 1); $tags = wp_get_post_tags($post->ID); //print_r($tags); $taglist = "'" . $tags[0]->term_id. "'"; $tagcount = count($tags); if ($tagcount > 1) { for ($i = 1; $i <= $tagcount; $i++) { $taglist = $taglist . ", '" . $tags[$i]->term_id . "'"; } } if ($limit) { $limitclause = "LIMIT $limit"; } else { $limitclause = "LIMIT 10"; } $q = "SELECT p.ID, p.post_title, p.post_date, p.comment_count, count(t_r.object_id) as cnt FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p WHERE t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = p.ID AND (t_t.term_id IN ($taglist)) AND p.ID != $post->ID AND p.post_status = 'publish' AND p.post_date_gmt < '$now' GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC $limitclause;"; //echo $q; $related_posts = $wpdb->get_results($q); $output = ""; if (!$related_posts){ if(!$wp_no_rp || ($wp_no_rp == "popularity" && !function_exists('akpc_most_popular'))) $wp_no_rp = "text"; if($wp_no_rp == "text"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("No Related Post",'wp_related_posts'); $output .= '<li>'.$wp_no_rp_text .'</li>'; } else{ if($wp_no_rp == "random"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("Random Posts",'wp_related_posts'); $related_posts = wp_get_random_posts($limitclause); } elseif($wp_no_rp == "commented"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("Most Commented Posts",'wp_related_posts'); $related_posts = wp_get_most_commented_posts($limitclause); } elseif($wp_no_rp == "popularity"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("Most Popular Posts",'wp_related_posts'); $related_posts = wp_get_most_popular_posts($limitclause); }else{ return __("Something wrong",'wp_related_posts');; } $wp_rp_title = $wp_no_rp_text; } } foreach ($related_posts as $related_post ){ $output .= ''; if ($show_date){ $dateformat = get_option('date_format'); $output .= mysql2date($dateformat, $related_post->post_date) . " -- "; } $output .= '<a href="'.get_permalink($related_post->ID).'" title="'.wptexturize($related_post->post_title).'"><img src="'. get_post_meta($related_post->ID, 'Benzer', $single = true).'" width="183" height="150" alt=""/>'; if ($show_comments_count){ $output .= " (" . $related_post->comment_count . ")"; } $output .= '</a>'; } $output = '<p>' . $output . '</p>'; if($wp_rp_title != '') $output = '<h3>'.$wp_rp_title .'</h3>'. $output; return $output; } function wp_related_posts(){ $output = wp_get_related_posts() ; echo $output; } function wp23_related_posts() { wp_related_posts(); } function wp_related_posts_for_feed($content=""){ $wp_rp = get_option("wp_rp"); $wp_rp_rss = ($wp_rp["wp_rp_rss"] == 'yes') ? 1 : 0; if ( (! is_feed()) || (! $wp_rp_rss)) return $content; $output = wp_get_related_posts() ; $content = $content . $output; return $content; } add_filter('the_content', 'wp_related_posts_for_feed',1); function wp_related_posts_auto($content=""){ $wp_rp = get_option("wp_rp"); $wp_rp_auto = ($wp_rp["wp_rp_auto"] == 'yes') ? 1 : 0; if ( (! is_single()) || (! $wp_rp_auto)) return $content; $output = wp_get_related_posts() ; $content = $content . $output; return $content; } add_filter('the_content', 'wp_related_posts_auto',99); function wp_get_random_posts ($limitclause="") { global $wpdb, $tableposts, $post; $q = "SELECT ID, post_title, post_date, comment_count FROM $tableposts WHERE post_status = 'publish' AND post_type = 'post' AND ID != $post->ID ORDER BY RAND() $limitclause"; return $wpdb->get_results($q); } function wp_random_posts ($number = 10){ $limitclause="LIMIT " . $number; $random_posts = wp_get_random_posts ($limitclause); foreach ($random_posts as $random_post ){ $output .= ''; $output .= '<a href="'.get_permalink($related_post->ID).'" title="'.wptexturize($related_post->post_title).'"><img src="'. get_post_meta($related_post->ID, 'Benzer', $single = true).'" width="183" height="150" alt=""/></a>'; } $output = '<p>' . $output . '</p>'; echo $output; } function wp_get_most_commented_posts($limitclause="") { global $wpdb; $q = "SELECT ID, post_title, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC $limitclause"; return $wpdb->get_results($q); } function wp_most_commented_posts ($number = 10){ $limitclause="LIMIT " . $number; $most_commented_posts = wp_get_most_commented_posts ($limitclause); foreach ($most_commented_posts as $most_commented_post ){ $output .= ''; $output .= '<a href="'.get_permalink($related_post->ID).'" title="'.wptexturize($related_post->post_title).'"><img src="'. get_post_meta($related_post->ID, 'Benzer', $single = true).'" width="183" height="150" alt=""/></a>'; } $output = '<p>' . $output . '</p>'; echo $output; } function wp_get_most_popular_posts ($limitclause="") { global $wpdb, $table_prefix; $q = $sql = "SELECT p.ID, p.post_title, p.post_date, p.comment_count FROM ". $table_prefix ."ak_popularity as akpc,".$table_prefix ."posts as p WHERE p.ID = akpc.post_id ORDER BY akpc.total DESC $limitclause";; return $wpdb->get_results($q); } function wp_most_popular_posts ($number = 10){ $limitclause="LIMIT " . $number; $most_popular_posts = wp_get_most_popular_posts ($limitclause); foreach ($most_popular_posts as $most_popular_post ){ $output .= ''; $output .= '<a href="'.get_permalink($related_post->ID).'" title="'.wptexturize($related_post->post_title).'"><img src="'. get_post_meta($related_post->ID, 'Benzer', $single = true).'" width="183" height="150" alt=""/></a>'; } $output = '<p>' . $output . '</p>'; echo $output; } add_action('admin_menu', 'wp_add_related_posts_options_page'); function wp_add_related_posts_options_page() { if (function_exists('add_options_page')) { add_options_page( __('WordPress Related Posts','wp_related_posts'), __('WordPress Related Posts','wp_related_posts'), 8, basename(__FILE__), 'wp_related_posts_options_subpanel'); } } function wp_related_posts_options_subpanel() { if($_POST["wp_rp_Submit"]){ $message = "WordPress Related Posts Setting Updated"; $wp_rp_saved = get_option("wp_rp"); $wp_rp = array ( "wp_rp_title" => $_POST['wp_rp_title_option'], "wp_no_rp" => $_POST['wp_no_rp_option'], "wp_no_rp_text" => $_POST['wp_no_rp_text_option'], "wp_rp_limit" => $_POST['wp_rp_limit_option'], 'wp_rp_exclude' => $_POST['wp_rp_exclude_option'], 'wp_rp_auto' => $_POST['wp_rp_auto_option'], 'wp_rp_rss' => $_POST['wp_rp_rss_option'], 'wp_rp_comments'=> $_POST['wp_rp_comments_option'], 'wp_rp_date' => $_POST['wp_rp_date_option'] ); if ($wp_rp_saved != $wp_rp) if(!update_option("wp_rp",$wp_rp)) $message = "Update Failed"; echo '<div id="message" class="updated fade"><p>'.$message.'.</p></div>'; } $wp_rp = get_option("wp_rp"); ?> <div class="wrap"> <h2 id="write-post"><?php _e("Related Posts Options…",'wp_related_posts');?></h2> <p><?php _e("WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.",'wp_related_posts');?></p> <div style="float:right;"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_donations"> <input type="hidden" name="business" value="honghua.deng@gmail.com"> <input type="hidden" name="item_name" value="Donate to fairyfish.net"> <input type="hidden" name="no_shipping" value="0"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="tax" value="0"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="bn" value="PP-DonationsBF"> <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"><br /> </form> </div> <h3><?php _e("Related Posts Preference",'wp_related_posts');?></h3> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo basename(__FILE__); ?>"> <table class="form-table"> <tr> <th><?php _e("Related Posts Title:",'wp_related_posts'); ?></th> <td> <input type="text" name="wp_rp_title_option" value="<?php echo $wp_rp["wp_rp_title"]; ?>" /> </td> </tr> <tr> <th><?php _e("When No Related Posts, Dispaly:",'wp_related_posts'); ?></th> <td> <?php $wp_no_rp = $wp_rp["wp_no_rp"]; ?> <select name="wp_no_rp_option" > <option value="text" <?php if($wp_no_rp == 'text') echo 'selected' ?> ><?php _e("Text: 'No Related Posts'",'wp_related_posts'); ?></option> <option value="random" <?php if($wp_no_rp == 'random') echo 'selected' ?>><?php _e("Random Posts",'wp_related_posts'); ?></option> <option value="commented" <?php if($wp_no_rp == 'commented') echo 'selected' ?>><?php _e("Most Commented Posts",'wp_related_posts'); ?></option> <?php if (function_exists('akpc_most_popular')){ ?> <option value="popularity" <?php if($wp_no_rp == 'popularity') echo 'selected' ?>><?php _e("Most Popular Posts",'wp_related_posts'); ?></option> <?php } ?> </select> </td> </tr> <tr> <th><?php _e("No Related Post's Title or Text:",'wp_related_posts'); ?></th> <td> <input type="text" name="wp_no_rp_text_option" value="<?php echo $wp_rp["wp_no_rp_text"]; ?>" /> </td> </tr> <tr> <th><?php _e("Limit:",'wp_related_posts');?></th> <td> <input type="text" name="wp_rp_limit_option" value="<?php echo $wp_rp["wp_rp_limit"]; ?>" /> </td> </tr> <tr> <th><?php _e("Exclude(category IDs):",'wp_related_posts');?></th> <td> <input type="text" name="wp_rp_exclude_option" value="<?php echo $wp_rp["wp_rp_exclude"]; ?>" /> </td> </tr> <tr> <th><?php _e("Other Setting:",'wp_related_posts');?></th> <td> <label> <?php if ( $wp_rp["wp_rp_auto"] == 'yes' ) { echo '<input name="wp_rp_auto_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_auto_option" type="checkbox" value="yes">'; } ?> <?php _e("Auto Insert Related Posts",'wp_related_posts');?> </label> <br /> <label> <?php if ( $wp_rp["wp_rp_rss"] == 'yes' ) { echo '<input name="wp_rp_rss_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_rss_option" type="checkbox" value="yes">'; } ?> <?php _e("Related Posts for RSS",'wp_related_posts');?> </label> <br /> <label> <?php if ( $wp_rp["wp_rp_comments"] == 'yes' ) { echo '<input name="wp_rp_comments_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_comments_option" type="checkbox" value="yes">'; } ?> <?php _e("Display Comments Count",'wp_related_posts');?> </label> <br /> <label> <?php if ( $wp_rp["wp_rp_date"] == 'yes' ) { echo '<input name="wp_rp_date_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_date_option" type="checkbox" value="yes">'; } ?> <?php _e("Display Post Date",'wp_related_posts');?> </label> <br /> </td> </tr> </table> <p class="submit"><input type="submit" value="<?php _e("Update Preferences »",'wp_related_posts');?>" name="wp_rp_Submit" /></p> </form> </div> <?php }?> |
NOT: Burada dikkat edilmesi gereken tek nokta artık Özel Alan eklerken resmin adı yerine resmin tam url adresini yazmanız yeterli olacaktır… Geriye kalan tüm ayarlar aynen devam.
- Benzer Yazılar eklentisinin yeni versiyonu Wp 2.5.1. sürümüne uygun hale getirilmiş. Yine aynı şekilde benzer yazılar eklentisini resimli olarak kulanmak isterseniz.
Eklentiyi İndirebileceğiniz adres: Related Post 0.9
* Eklentiyi indirin ve gelişmiş bir web editör programında wp_related_posts.php dosyasını açın. Tümünü seçip sildikten sonra aşağıdaki kodu komple kopyalayıp yapıştırın. En son kaydetmeniz yeterli.. Diğer ayarlar bir önceki versiyonda yazdığım dökümantasyon ile aynı..
Eklentinin çalışan versiyonunu yeni açtığım siteden de canlı olarak görebilirsiniz.
Adres: http://www.otomottv.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | <?php /* Plugin Name: WordPress Related Posts Version: 0.9 Plugin URI: http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/ Description: Generate a related posts list via tags of WordPress Author: Denis Author URI: http://fairyfish.net/ Copyright (c) 2007 Released under the GPL license http://www.gnu.org/licenses/gpl.txt This file is part of WordPress. WordPress is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA INSTALL: Just install the plugin in your blog and activate */ add_action('init', 'init_textdomain'); function init_textdomain(){ load_plugin_textdomain('wp_related_posts',PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) . '/lang'); } function wp_get_related_posts() { global $wpdb, $post,$table_prefix; $wp_rp = get_option("wp_rp"); $exclude = explode(",",$wp_rp["wp_rp_exclude"]); $limit = $wp_rp["wp_rp_limit"]; $wp_rp_title = $wp_rp["wp_rp_title"]; $wp_no_rp = $wp_rp["wp_no_rp"]; $wp_no_rp_text = $wp_rp["wp_no_rp_text"]; $show_date = $wp_rp["wp_rp_date"]; $show_comments_count = $wp_rp["wp_rp_comments"]; if ( $exclude != '' ) { $q = "SELECT tt.term_id FROM ". $table_prefix ."term_taxonomy tt, " . $table_prefix . "term_relationships tr WHERE tt.taxonomy = 'category' AND tt.term_taxonomy_id = tr.term_taxonomy_id AND tr.object_id = $post->ID"; $cats = $wpdb->get_results($q); foreach(($cats) as $cat) { if (in_array($cat->term_id, $exclude) != false){ return; } } } if(!$post->ID){return;} $now = current_time('mysql', 1); $tags = wp_get_post_tags($post->ID); //print_r($tags); $taglist = "'" . $tags[0]->term_id. "'"; $tagcount = count($tags); if ($tagcount > 1) { for ($i = 1; $i <= $tagcount; $i++) { $taglist = $taglist . ", '" . $tags[$i]->term_id . "'"; } } if ($limit) { $limitclause = "LIMIT $limit"; } else { $limitclause = "LIMIT 10"; } $q = "SELECT DISTINCT p.ID, p.post_title, p.post_date, p.comment_count, count(t_r.object_id) as cnt FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p WHERE t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = p.ID AND (t_t.term_id IN ($taglist)) AND p.ID != $post->ID AND p.post_status = 'publish' AND p.post_date_gmt < '$now' GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC $limitclause;"; //echo $q; $related_posts = $wpdb->get_results($q); $output = ""; if (!$related_posts){ if(!$wp_no_rp || ($wp_no_rp == "popularity" && !function_exists('akpc_most_popular'))) $wp_no_rp = "text"; if($wp_no_rp == "text"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("No Related Post",'wp_related_posts'); $output .= '<li>'.$wp_no_rp_text .'</li>'; } else{ if($wp_no_rp == "random"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("Random Posts",'wp_related_posts'); $related_posts = wp_get_random_posts($limitclause); } elseif($wp_no_rp == "commented"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("Most Commented Posts",'wp_related_posts'); $related_posts = wp_get_most_commented_posts($limitclause); } elseif($wp_no_rp == "popularity"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("Most Popular Posts",'wp_related_posts'); $related_posts = wp_get_most_popular_posts($limitclause); }else{ return __("Something wrong",'wp_related_posts');; } $wp_rp_title = $wp_no_rp_text; } } foreach ($related_posts as $related_post ){ $output .= ''; if ($show_date){ $dateformat = get_option('date_format'); $output .= mysql2date($dateformat, $related_post->post_date) . " -- "; } $output .= '<a href="'.get_permalink($related_post->ID).'" title="'.wptexturize($related_post->post_title).'"><img src="http://localhost/start/videotheme/wp-content/uploads/benzer/'.get_post_meta($related_post->ID, 'Benzer', $single = true).'.jpg" alt="" /></a>'; if ($show_comments_count){ $output .= " (" . $related_post->comment_count . ")"; } $output .= '</a>'; } $output = '<div class="benzer_bolum">' . $output . '</div>'; if($wp_rp_title != '') $output = '<p>'.$wp_rp_title .'</p>'. $output; return $output; } function wp_related_posts(){ global $id; $preview = $_GET['preview']; $output_old = get_post_meta($id, "related_posts", $single = true); if($output_old){ $time = time(); if(($time - $output_old["time"])<600){ echo $output_old["related_posts"]; return; } } $output = wp_get_related_posts() ; $output_new = array("time"=>time(),"related_posts"=>$output); if($output_old){ update_post_meta($id, 'related_posts', $output_new); }else{ if(!add_post_meta($id, 'related_posts', $output_new, true)){ update_post_meta($id, 'related_posts', $output_new); } } echo $output; } function wp23_related_posts() { wp_related_posts(); } function wp_related_posts_for_feed($content=""){ $wp_rp = get_option("wp_rp"); $wp_rp_rss = ($wp_rp["wp_rp_rss"] == 'yes') ? 1 : 0; if ( (! is_feed()) || (! $wp_rp_rss)) return $content; $output = wp_get_related_posts() ; $content = $content . $output; return $content; } add_filter('the_content', 'wp_related_posts_for_feed',1); function wp_related_posts_auto($content=""){ $wp_rp = get_option("wp_rp"); $wp_rp_auto = ($wp_rp["wp_rp_auto"] == 'yes') ? 1 : 0; if ( (! is_single()) || (! $wp_rp_auto)) return $content; $output = wp_get_related_posts() ; $content = $content . $output; return $content; } add_filter('the_content', 'wp_related_posts_auto',99); function wp_get_random_posts ($limitclause="") { global $wpdb, $tableposts, $post; $q = "SELECT ID, post_title, post_date, comment_count FROM $tableposts WHERE post_status = 'publish' AND post_type = 'post' AND ID != $post->ID ORDER BY RAND() $limitclause"; return $wpdb->get_results($q); } function wp_random_posts ($number = 10){ $limitclause="LIMIT " . $number; $random_posts = wp_get_random_posts ($limitclause); foreach ($random_posts as $random_post ){ $output .= ''; $output .= '<a href="'.get_permalink($random_post->ID).'" title="'.wptexturize($random_post->post_title).'"><img src="http://localhost/start/videotheme/wp-content/uploads/benzer/'.get_post_meta($related_post->ID, 'Benzer', $single = true).'.jpg" alt="" /></a>'; } $output = '<div class="benzer_bolum">' . $output . '</div>'; echo $output; } function wp_get_most_commented_posts($limitclause="") { global $wpdb; $q = "SELECT ID, post_title, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC $limitclause"; return $wpdb->get_results($q); } function wp_most_commented_posts ($number = 10){ $limitclause="LIMIT " . $number; $most_commented_posts = wp_get_most_commented_posts ($limitclause); foreach ($most_commented_posts as $most_commented_post ){ $output .= ''; $output .= '<a href="'.get_permalink($most_commented_post->ID).'" title="'.wptexturize($most_commented_post->post_title).'"><img src="http://localhost/start/videotheme/wp-content/uploads/benzer/'.get_post_meta($related_post->ID, 'Benzer', $single = true).'.jpg" alt="" /></a>'; } $output = '<div class="benzer_bolum">' . $output . '</div>'; echo $output; } function wp_get_most_popular_posts ($limitclause="") { global $wpdb, $table_prefix; $q = $sql = "SELECT p.ID, p.post_title, p.post_date, p.comment_count FROM ". $table_prefix ."ak_popularity as akpc,".$table_prefix ."posts as p WHERE p.ID = akpc.post_id ORDER BY akpc.total DESC $limitclause";; return $wpdb->get_results($q); } function wp_most_popular_posts ($number = 10){ $limitclause="LIMIT " . $number; $most_popular_posts = wp_get_most_popular_posts ($limitclause); foreach ($most_popular_posts as $most_popular_post ){ $output .= ''; $output .= '<a href="'.get_permalink($most_popular_post->ID).'" title="'.wptexturize($most_popular_post->post_title).'"><img src="http://localhost/start/videotheme/wp-content/uploads/benzer/'.get_post_meta($related_post->ID, 'Benzer', $single = true).'.jpg" alt="" /></a>'; } $output = '<div class="benzer_bolum">' . $output . '</div>'; echo $output; } add_action('admin_menu', 'wp_add_related_posts_options_page'); function wp_add_related_posts_options_page() { if (function_exists('add_options_page')) { add_options_page( __('WordPress Related Posts','wp_related_posts'), __('WordPress Related Posts','wp_related_posts'), 8, basename(__FILE__), 'wp_related_posts_options_subpanel'); } } function wp_related_posts_options_subpanel() { if($_POST["wp_rp_Submit"]){ $message = "WordPress Related Posts Setting Updated"; $wp_rp_saved = get_option("wp_rp"); $wp_rp = array ( "wp_rp_title" => $_POST['wp_rp_title_option'], "wp_no_rp" => $_POST['wp_no_rp_option'], "wp_no_rp_text" => $_POST['wp_no_rp_text_option'], "wp_rp_limit" => $_POST['wp_rp_limit_option'], 'wp_rp_exclude' => $_POST['wp_rp_exclude_option'], 'wp_rp_auto' => $_POST['wp_rp_auto_option'], 'wp_rp_rss' => $_POST['wp_rp_rss_option'], 'wp_rp_comments'=> $_POST['wp_rp_comments_option'], 'wp_rp_date' => $_POST['wp_rp_date_option'] ); if ($wp_rp_saved != $wp_rp) if(!update_option("wp_rp",$wp_rp)) $message = "Update Failed"; echo '<div id="message" class="updated fade"><p>'.$message.'.</p></div>'; } $wp_rp = get_option("wp_rp"); ?> <div class="wrap"> <h2 id="write-post"><?php _e("Related Posts Options…",'wp_related_posts');?></h2> <p><?php _e("WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.",'wp_related_posts');?></p> <div style="float:right;"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_donations"> <input type="hidden" name="business" value="honghua.deng@gmail.com"> <input type="hidden" name="item_name" value="Donate to fairyfish.net"> <input type="hidden" name="no_shipping" value="0"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="tax" value="0"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="bn" value="PP-DonationsBF"> <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"><br /> </form> </div> <h3><?php _e("Related Posts Preference",'wp_related_posts');?></h3> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo basename(__FILE__); ?>"> <table class="form-table"> <tr> <th><?php _e("Related Posts Title:",'wp_related_posts'); ?></th> <td> <input type="text" name="wp_rp_title_option" value="<?php echo $wp_rp["wp_rp_title"]; ?>" /> </td> </tr> <tr> <th><?php _e("When No Related Posts, Dispaly:",'wp_related_posts'); ?></th> <td> <?php $wp_no_rp = $wp_rp["wp_no_rp"]; ?> <select name="wp_no_rp_option" > <option value="text" <?php if($wp_no_rp == 'text') echo 'selected' ?> ><?php _e("Text: 'No Related Posts'",'wp_related_posts'); ?></option> <option value="random" <?php if($wp_no_rp == 'random') echo 'selected' ?>><?php _e("Random Posts",'wp_related_posts'); ?></option> <option value="commented" <?php if($wp_no_rp == 'commented') echo 'selected' ?>><?php _e("Most Commented Posts",'wp_related_posts'); ?></option> <?php if (function_exists('akpc_most_popular')){ ?> <option value="popularity" <?php if($wp_no_rp == 'popularity') echo 'selected' ?>><?php _e("Most Popular Posts",'wp_related_posts'); ?></option> <?php } ?> </select> </td> </tr> <tr> <th><?php _e("No Related Post's Title or Text:",'wp_related_posts'); ?></th> <td> <input type="text" name="wp_no_rp_text_option" value="<?php echo $wp_rp["wp_no_rp_text"]; ?>" /> </td> </tr> <tr> <th><?php _e("Limit:",'wp_related_posts');?></th> <td> <input type="text" name="wp_rp_limit_option" value="<?php echo $wp_rp["wp_rp_limit"]; ?>" /> </td> </tr> <tr> <th><?php _e("Exclude(category IDs):",'wp_related_posts');?></th> <td> <input type="text" name="wp_rp_exclude_option" value="<?php echo $wp_rp["wp_rp_exclude"]; ?>" /> </td> </tr> <tr> <th><?php _e("Other Setting:",'wp_related_posts');?></th> <td> <label> <?php if ( $wp_rp["wp_rp_auto"] == 'yes' ) { echo '<input name="wp_rp_auto_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_auto_option" type="checkbox" value="yes">'; } ?> <?php _e("Auto Insert Related Posts",'wp_related_posts');?> </label> <br /> <label> <?php if ( $wp_rp["wp_rp_rss"] == 'yes' ) { echo '<input name="wp_rp_rss_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_rss_option" type="checkbox" value="yes">'; } ?> <?php _e("Related Posts for RSS",'wp_related_posts');?> </label> <br /> <label> <?php if ( $wp_rp["wp_rp_comments"] == 'yes' ) { echo '<input name="wp_rp_comments_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_comments_option" type="checkbox" value="yes">'; } ?> <?php _e("Display Comments Count",'wp_related_posts');?> </label> <br /> <label> <?php if ( $wp_rp["wp_rp_date"] == 'yes' ) { echo '<input name="wp_rp_date_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_date_option" type="checkbox" value="yes">'; } ?> <?php _e("Display Post Date",'wp_related_posts');?> </label> <br /> </td> </tr> </table> <p class="submit"><input type="submit" value="<?php _e("Update Preferences »",'wp_related_posts');?>" name="wp_rp_Submit" /></p> </form> </div> <?php }?> |
Plugin Name: WordPress Related Posts
Version: 0.8
Plugin URI: http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/
Description: Generate a related posts list via tags of WorPdress
Eklentiyi indirmeniz için gereken adres: Related Posts Plugin
1 Eklentiyi indirip zip klasöründen çıkartmanız gerekiyor.
2 WPRP klaösrü içindeki wp_related_posts.php dosyasını sizin isteğinize kalmış 2 yolla resimli benzer yazılar özelliği ekleyebilirsiniz.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | <?php /* Plugin Name: WordPress Related Posts Version: 0.8 Plugin URI: http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/ Description: Generate a related posts list via tags of WorPdress Author: Denis Author URI: http://fairyfish.net/ Copyright (c) 2007 Released under the GPL license http://www.gnu.org/licenses/gpl.txt This file is part of WordPress. WordPress is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA INSTALL: Just install the plugin in your blog and activate */ load_plugin_textdomain('wp_related_posts',PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) . '/lang'); function wp_get_related_posts() { global $wpdb, $post,$table_prefix; $wp_rp = get_option("wp_rp"); $exclude = explode(",",$wp_rp["wp_rp_exclude"]); $limit = $wp_rp["wp_rp_limit"]; $wp_rp_title = $wp_rp["wp_rp_title"]; $wp_no_rp = $wp_rp["wp_no_rp"]; $wp_no_rp_text = $wp_rp["wp_no_rp_text"]; $show_date = $wp_rp["wp_rp_date"]; $show_comments_count = $wp_rp["wp_rp_comments"]; if ( $exclude != '' ) { $q = "SELECT tt.term_id FROM ". $table_prefix ."term_taxonomy tt, " . $table_prefix . "term_relationships tr WHERE tt.taxonomy = 'category' AND tt.term_taxonomy_id = tr.term_taxonomy_id AND tr.object_id = $post->ID"; $cats = $wpdb->get_results($q); foreach(($cats) as $cat) { if (in_array($cat->term_id, $exclude) != false){ return; } } } if(!$post->ID){return;} $now = current_time('mysql', 1); $tags = wp_get_post_tags($post->ID); //print_r($tags); $taglist = "'" . $tags[0]->term_id. "'"; $tagcount = count($tags); if ($tagcount > 1) { for ($i = 1; $i <= $tagcount; $i++) { $taglist = $taglist . ", '" . $tags[$i]->term_id . "'"; } } if ($limit) { $limitclause = "LIMIT $limit"; } else { $limitclause = "LIMIT 10"; } $q = "SELECT DISTINCT p.ID, p.post_title, p.post_date, p.comment_count, count(t_r.object_id) as cnt FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p WHERE t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = p.ID AND (t_t.term_id IN ($taglist)) AND p.ID != $post->ID AND p.post_status = 'publish' AND p.post_date_gmt < '$now' GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC $limitclause;"; //echo $q; $related_posts = $wpdb->get_results($q); $output = ""; if (!$related_posts){ if(!$wp_no_rp || ($wp_no_rp == "popularity" && !function_exists('akpc_most_popular'))) $wp_no_rp = "text"; if($wp_no_rp == "text"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("No Related Post",'wp_related_posts'); $output .= '<li>'.$wp_no_rp_text .'</li>'; } else{ if($wp_no_rp == "random"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("Random Posts",'wp_related_posts'); $related_posts = wp_get_random_posts($limitclause); } elseif($wp_no_rp == "commented"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("Most Commented Posts",'wp_related_posts'); $related_posts = wp_get_most_commented_posts($limitclause); } elseif($wp_no_rp == "popularity"){ if(!$wp_no_rp_text) $wp_no_rp_text= __("Most Popular Posts",'wp_related_posts'); $related_posts = wp_get_most_popular_posts($limitclause); }else{ return __("Something wrong",'wp_related_posts');; } $wp_rp_title = $wp_no_rp_text; } }get_post_meta($post->ID, 'Image', $single = true); foreach ($related_posts as $related_post ){ $output .= '<li>'; $output .= '<img src="'.get_post_meta($related_post->ID, 'Resim', $single = true).'" alt="" /><br /><a href="'.get_permalink($related_post->ID).'" title="'.wptexturize($related_post->post_title).'">'.wptexturize($related_post->post_title).'</a>'; if ($show_date){ $dateformat = get_option('date_format'); $output .= " - " . mysql2date($dateformat, $related_post->post_date) . " - "; } if ($show_comments_count){ $output .= " (" . $related_post->comment_count . ")"; } $output .= '</li>'; } $output = '<ul class="related_post">' . $output . '</ul>'; if($wp_rp_title != '') $output = '<h3>'.$wp_rp_title .'</h3>'. $output; return $output; } function wp_related_posts(){ global $id; $output_old = get_post_meta($id, "related_posts", $single = true); if($output_old){ $time = time(); if(($time - $output_old["time"])<600){ echo $output_old["related_posts"]; return; } } $output = wp_get_related_posts() ; $output_new = array("time"=>time(),"related_posts"=>$output); if($output_old){ update_post_meta($id, 'related_posts', $output_new); }else{ if(!add_post_meta($id, 'related_posts', $output_new, true)){ update_post_meta($id, 'related_posts', $output_new); } } echo $output; } function wp23_related_posts() { wp_related_posts(); } function wp_related_posts_for_feed($content=""){ $wp_rp = get_option("wp_rp"); $wp_rp_rss = ($wp_rp["wp_rp_rss"] == 'yes') ? 1 : 0; if ( (! is_feed()) || (! $wp_rp_rss)) return $content; $output = wp_get_related_posts() ; $content = $content . $output; return $content; } add_filter('the_content', 'wp_related_posts_for_feed',1); function wp_related_posts_auto($content=""){ $wp_rp = get_option("wp_rp"); $wp_rp_auto = ($wp_rp["wp_rp_auto"] == 'yes') ? 1 : 0; if ( (! is_single()) || (! $wp_rp_auto)) return $content; $output = wp_get_related_posts() ; $content = $content . $output; return $content; } add_filter('the_content', 'wp_related_posts_auto',99); function wp_get_random_posts ($limitclause="") { global $wpdb, $tableposts, $post; $q = "SELECT ID, post_title, post_date, comment_count FROM $tableposts WHERE post_status = 'publish' AND post_type = 'post' AND ID != $post->ID ORDER BY RAND() $limitclause"; return $wpdb->get_results($q); } function wp_random_posts ($number = 10){ $limitclause="LIMIT " . $number; $random_posts = wp_get_random_posts ($limitclause); foreach ($random_posts as $random_post ){ $output .= '<li>'; $output .= '<img src="'.get_post_meta($related_post->ID, 'Resim', $single = true).'" alt="" /><br /><a href="'.get_permalink($random_post->ID).'" title="'.wptexturize($random_post->post_title).'">'.wptexturize($random_post->post_title).'</a></li>'; } $output = '<ul class="randome_post">' . $output . '</ul>'; echo $output; } function wp_get_most_commented_posts($limitclause="") { global $wpdb; $q = "SELECT ID, post_title, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC $limitclause"; return $wpdb->get_results($q); } function wp_most_commented_posts ($number = 10){ $limitclause="LIMIT " . $number; $most_commented_posts = wp_get_most_commented_posts ($limitclause); foreach ($most_commented_posts as $most_commented_post ){ $output .= '<li>'; $output .= '<img src="'.get_post_meta($related_post->ID, 'Resim', $single = true).'" alt="" /><br /><a href="'.get_permalink($most_commented_post->ID).'" title="'.wptexturize($most_commented_post->post_title).'">'.wptexturize($most_commented_post->post_title).'</a></li>'; } $output = '<ul class="most_commented_post">' . $output . '</ul>'; echo $output; } function wp_get_most_popular_posts ($limitclause="") { global $wpdb, $table_prefix; $q = $sql = "SELECT p.ID, p.post_title, p.post_date, p.comment_count FROM ". $table_prefix ."ak_popularity as akpc,".$table_prefix ."posts as p WHERE p.ID = akpc.post_id ORDER BY akpc.total DESC $limitclause";; return $wpdb->get_results($q); } function wp_most_popular_posts ($number = 10){ $limitclause="LIMIT " . $number; $most_popular_posts = wp_get_most_popular_posts ($limitclause); foreach ($most_popular_posts as $most_popular_post ){ $output .= '<li>'; $output .= '<img src="'.get_post_meta($related_post->ID, 'Resim', $single = true).'" alt="" /><br /><a href="'.get_permalink($most_popular_post->ID).'" title="'.wptexturize($most_popular_post->post_title).'">'.wptexturize($most_popular_post->post_title).'</a></li>'; } $output = '<ul class="most_popular_post">' . $output . '</ul>'; echo $output; } add_action('admin_menu', 'wp_add_related_posts_options_page'); function wp_add_related_posts_options_page() { if (function_exists('add_options_page')) { add_options_page( __('WordPress Related Posts','wp_related_posts'), __('WordPress Related Posts','wp_related_posts'), 8, basename(__FILE__), 'wp_related_posts_options_subpanel'); } } function wp_related_posts_options_subpanel() { if($_POST["wp_rp_Submit"]){ $message = "WordPress Related Posts Setting Updated"; $wp_rp_saved = get_option("wp_rp"); $wp_rp = array ( "wp_rp_title" => $_POST['wp_rp_title_option'], "wp_no_rp" => $_POST['wp_no_rp_option'], "wp_no_rp_text" => $_POST['wp_no_rp_text_option'], "wp_rp_limit" => $_POST['wp_rp_limit_option'], 'wp_rp_exclude' => $_POST['wp_rp_exclude_option'], 'wp_rp_auto' => $_POST['wp_rp_auto_option'], 'wp_rp_rss' => $_POST['wp_rp_rss_option'], 'wp_rp_comments'=> $_POST['wp_rp_comments_option'], 'wp_rp_date' => $_POST['wp_rp_date_option'] ); if ($wp_rp_saved != $wp_rp) if(!update_option("wp_rp",$wp_rp)) $message = "Update Failed"; echo '<div id="message" class="updated fade"><p>'.$message.'.</p></div>'; } $wp_rp = get_option("wp_rp"); ?> <div class="wrap"> <h2 id="write-post"><?php _e("Related Posts Options…",'wp_related_posts');?></h2> <p><?php _e("WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.",'wp_related_posts');?></p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo basename(__FILE__); ?>"> <h3><?php _e("Related Posts Preference",'wp_related_posts');?></h3> <table class="form-table"> <tr> <th><?php _e("Related Posts Title:",'wp_related_posts'); ?></th> <td> <input type="text" name="wp_rp_title_option" value="<?php echo $wp_rp["wp_rp_title"]; ?>" /> </td> </tr> <tr> <th><?php _e("When No Related Posts, Dispaly:",'wp_related_posts'); ?></th> <td> <?php $wp_no_rp = $wp_rp["wp_no_rp"]; ?> <select name="wp_no_rp_option" > <option value="text" <?php if($wp_no_rp == 'text') echo 'selected' ?> ><?php _e("Text: 'No Related Posts'",'wp_related_posts'); ?></option> <option value="random" <?php if($wp_no_rp == 'random') echo 'selected' ?>><?php _e("Random Posts",'wp_related_posts'); ?></option> <option value="commented" <?php if($wp_no_rp == 'commented') echo 'selected' ?>><?php _e("Most Commented Posts",'wp_related_posts'); ?></option> <?php if (function_exists('akpc_most_popular')){ ?> <option value="popularity" <?php if($wp_no_rp == 'popularity') echo 'selected' ?>><?php _e("Most Popular Posts",'wp_related_posts'); ?></option> <?php } ?> </select> </td> </tr> <tr> <th><?php _e("No Related Post's Title or Text:",'wp_related_posts'); ?></th> <td> <input type="text" name="wp_no_rp_text_option" value="<?php echo $wp_rp["wp_no_rp_text"]; ?>" /> </td> </tr> <tr> <th><?php _e("Limit:",'wp_related_posts');?></th> <td> <input type="text" name="wp_rp_limit_option" value="<?php echo $wp_rp["wp_rp_limit"]; ?>" /> </td> </tr> <tr> <th><?php _e("Exclude(category IDs):",'wp_related_posts');?></th> <td> <input type="text" name="wp_rp_exclude_option" value="<?php echo $wp_rp["wp_rp_exclude"]; ?>" /> </td> </tr> <tr> <th><?php _e("Other Setting:",'wp_related_posts');?></th> <td> <label> <?php if ( $wp_rp["wp_rp_auto"] == 'yes' ) { echo '<input name="wp_rp_auto_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_auto_option" type="checkbox" value="yes">'; } ?> <?php _e("Auto Insert Related Posts",'wp_related_posts');?> </label> <br /> <label> <?php if ( $wp_rp["wp_rp_rss"] == 'yes' ) { echo '<input name="wp_rp_rss_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_rss_option" type="checkbox" value="yes">'; } ?> <?php _e("Related Posts for RSS",'wp_related_posts');?> </label> <br /> <label> <?php if ( $wp_rp["wp_rp_comments"] == 'yes' ) { echo '<input name="wp_rp_comments_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_comments_option" type="checkbox" value="yes">'; } ?> <?php _e("Display Comments Count",'wp_related_posts');?> </label> <br /> <label> <?php if ( $wp_rp["wp_rp_date"] == 'yes' ) { echo '<input name="wp_rp_date_option" type="checkbox" value="yes" checked>'; } else { echo '<input name="wp_rp_date_option" type="checkbox" value="yes">'; } ?> <?php _e("Display Post Date",'wp_related_posts');?> </label> <br /> </td> </tr> </table> <p class="submit"><input type="submit" value="<?php _e("Update Preferences »",'wp_related_posts');?>" name="wp_rp_Submit" /></p> </form> </div> <?php }?> |
Beni bu kadar zorlamayın dosyayı indirip yükleyeyim diyebilirsiniz:
Resimli Benzer Yazılar EklentisiDosya Boyutu: 3,9 KiB
İndirme Sayısı: 222 kez
Eklenme Tarihi: 22 Haziran 2008
Açıklama: Benzer yazılarınızın artık resimli olarak görüntülenmesini sağlayabilirsiniz.
3 kalösr içersine wp_related_posts.php dosya içine yada indirdiğiniz dosyayı kopyalayın.
4 WPRP(Dikkat: bu isimli klasörü taşıyın) klasörünü wp-content/plugins klasörünüzün içersine kopyalayın.
5 Yönetim Panelinizden Eklentiler sekmesine gelerek eklentiyi etkinleştirin.
6 Ayarlar(Settings) bölümü altında Wordpress Related Posts isimli sekme aktfi olacaktır. İçeriği aşağıdaki resimdeki gibidir.

Related Posts Title: Yazı başlığını yazmalısınız. Örn: Benzer Yazılar
When No Related Posts, Display: Bu bölümde 3 seçeneğiniz var. ben ilk seçeneği tercih ediyorum.
- Text : Daha çok etiket ve başlık+metin içindeki yazıları eşleştirmeye dayalı sistem.
- Random: rastgele yazı seçilip gösterilmesi.
- Most Commented: En çok yorum alınan konuları listelemesi için.
No Related Post’s Title or Text: eğer herhangi bir benzer yazı yoksa o bölümde ne yazmasını istiyorsanız onu yazınız. ÖRN: Benzer yazı bulunamdı.
Limit: kaç adet benzer yazı istiyorsunuz.
Exclude(category IDs): benzer yazılarda gösterilmesini istemediğiniz kategorinin numarasını yazarak, o kategorideki yazıların bu bölümde gösterimini engelleyebilirsiniz.
Other Setting:
- Auto Insert Related Posts: Benzer yazılar ilgili alana otomatik olarak eklensin. İşaretlemeyin.
- Related Posts for RSS: benzer yazılar RSS dosyanızada eklensin. işaretlemeyin.
- Display Comments Count: benzer yazılarda kaç adet yorum yapılmış göstersin. (isteğe bağlı)
- Display Post Date: benzer yazının yayınlanma tarihini göster (isteğe bağlı)
En sonunda ayarları kaydetmeniz yeterli…
7 Son bir işlem olarak gerekli kodu temanızın şablonuna eklemeniz gerekiyor. ben default tema üzerinde deneme yaptım ve o yönde size aktarıyorum. single.php dosyasını açıp Tag etiketinden sonra ;
1 | <?php wp_related_posts(); ?> |
kodunu kopyaladım ve kaydettim. Siz loop içersinde dilediğiniz yere bu kodu yerleştirebilirsiniz. (Loop içersine diyorum dikkat ediniz.
)
7 Bitti mi! hayır resimler nasıl gelecek değil mi? Mutlaka bizler yazı eklerken o yazıya ait bir resmi veritabanımıza kaydetmeliyiz ki o resim o yazıyla bağlantılı olduğu anlaşılsın. Bunun için ben custom field “Özel Alan” kullandım. Yazı yazma ekranında iken yazıyı yayınla demeden önce Özel Alanlar bölümüne gelip aşağıdaki işlemi uygulamanız gerekmekte.

Anahtar: Resim
Kesinlikle büyük küçük harfe dikkat ederek Resim yazmanız gerekiyor. Çünkü tanımlanan alan Resim.
Değer: http://otomot.net/res.gif
* Mutlaka web alanızın üzerindeki tam adresi yazmalısınız. Yoksa resim gözükmez. Bunun için size tavsiyem wp-content/uploads klasörünüzün içersine benzer isimli bir klasör yaratın ve yazılarla ilişkilendirdiğiniz resimleri bu klasör altında toplayınız. Bu sayede ordan burdan resim adresi bulmanız gerekmez. Sonuç olarak Değer alanına http://alanadınız/wp-content/uploads/benzer/resim1.jpg yazmanız yeterli.
- En önemli nokta ise Özel Alan Ekle tuşuna basmayı unutmayınız. Bu tuşa bastığınızda eklediğiniz veriler hemen üst bölümde yanıp sönerek eklendiğini göreceksiniz.
Benzer yazılar bölümünde görüntülenecek resimler için herhangi bir ebat belirlemesi yapmadım. Siz her zaman eklediğiniz resimleri belli bir ebatta yükleyerek görsel olarak güzel görünmesini sağlayabilirsiniz.
Örn ebatlar: 150X125px , 400X200px , 250X150px bu tamamen size kalmış.
- Artık yazınızı yayımlayabilirsiniz.



Destek
Takip

Bu makaleyi hazırladığınız için çok teşekkür ederim, öncelikle http://otomot.net/download/9/ burdan hazır dosyayı indirip kurdum fakat çalışmadı biraz üzüldüm, sonra yukardaki kodları kopyalayıp atınca çalışıtğını gördüm ve bu sefer sevinmeye başladım. Çok teşekkürler.
Kolay Gelsin.
Neden bu şekilde oldu bilmiyorum. Zipli dosya içersindeki kodu kopyaladım zaten. Neyse kullanmak isteyenler her ikisinide denesinler hangisini uygun o şekilde kullanabilirler.
TribunVideo
Bilen insan ayrı oluyor. Hemen şıp diye çözüyor işi. Güle güle kullan…
Eklentinin çalışma şeklini görmek için aşağıdaki siteyi ziyaret edebilirsiniz:
http://www.tribunvideo.com/inonuye-gelis.html
Ya forumda yazacaktım ama malesef girmek istemdim.. Aslında cevap yazmak istemedim.. Yine öyle işte anldın sen =)
Bu arada gerçekten güzel bir çalışma olmuş tebrik ederim..
Benimde sonraki ve önceki yazılarındaki linklerin resimli gözükmesiydi ama bunu özel alanları kullanarak yapmak değil niyeyim.. Veriyi bir önceki konudan sadece resim olarak alsın belli ebatta css ile küçültsün..
Dimi çok şey istiyorum =)
Böyle birşey hakkında bilgin var mı acaba.. Olursa tam süper olur gerçekten ayrıca buda şahane olmuş.. Birde css ile yan yana iki resim şeklinde çıksa daha bir şahane olacakmış..
eylultoprak
Aslında bu makaleyi TribunVideo isteği üzerine hazırladım ve kendi sitesinde bu şekilde gözükmesini istiyormuş. O nedenle hiç ellemedim o yönleri.
* Senin dediğine gelince ise css ile birkaç düzenleme yaparak istediğin gibi ayarlanabilir. Hatta resimler de istenilen ölçüde boyutlandırılabilir. İsteyen çıkarsa onuda eklerim yazının son kısmına. Ama yok o kadar uğraşmışsın bunuda ben yapayım derse biri : most_popular_post etiketini kullanarak ul ve li etiketleri tanımlamalı ve img etiketi ile de resim boyutunu oluşturabilir. 10 satır css kodu yazmak yeterli…
- Senin dediğin önceki ve sonraki yazıda yazı yerine resimli çıkma olayıda bir yerde gördüm sanki onu ama çok zaman oldu. eylultoprak sana şöyle bir şey söyleyeyim özel alanları kullanmadan o yazıya ait resmi nereden göstereceğiz? Kesinlikle kullanılması gerekmekte. Tabi alternatif yolları var ama ben en iyi bildiğim yolu tercih ediyorum..
İki eklenti buldum.. Ama adam tam ingiliz
Dediklerini pek anlamadım şuan deneyerek olayı çözmeye çalışıyorum
http://www.andrewgrant.org/get-post-image İlk bunu buldum daha deneyemedim.
İkinci olarak bunu buldum.. http://guff.szub.net/2006/02/0.....ent-293071
Sanırım bu değil.. Bunda hiç bir kod eklemesine gerek kalmadan 2.5.1 ile eklediğin resmi şak diye çıkartıyor tabi css olayını yok sayıp kafasına göre birkaç özelliği var tabi yaklaştım ama tam sonuç alamadım..
Benim istediğim özel alanlarsız olması çünkü bir önceki konudan eğer db bilgisi ve başlık çekiliyorsa ve bu eklentide o yazıdaki resim hiç bir resim ekleme kodu kullanılmadan yapıyorsa, mantıklı olarak dediğimde yapılır..
Bakalım fırsatım şuan varken biraz kurcalayım sağ solu..
Aklına gelen de çıksa iyi olur hani.. =)
eylultoprak
http://wordpress.org/support/topic/169024
http://wordpress.org/support/topic/173316
http://wordpress.org/support/t.....?replies=2
bu başlıklarda benzer işlemler uygulanmış. Üzerinde uğraşılması gerekiyor.
ve Codexten:
http://codex.wordpress.org/Tem.....s_nav_link
http://codex.wordpress.org/Tem....._post_link
http://codex.wordpress.org/Tem....._post_link
incelemeni öneriyorum.
NOT: Bu konuyla bağlantısı olmadığı için http://otomot.net/2008/06/19/w.....n-sorular/ böyle bir konu başlığı açmıştım. Oradan devam etsek daha iyi olacaktır. Ya da foruma da başlık açabilirsin…
=)
Ya ben bu başlığı gördüm ama ilişkisiz sanmıştım ilk paragrafı görünce.. Dikkatsizlik işte..
Şunun ile çözdüm..
http://wordpress.org/support/topic/169024
Süper oldu.. Birazdan da siteye atacağım..
Merhaba güzel döküman olmuş elinize sağlık yalnız her yazımızda özel alan ile eklenmiş resimimiz yoktu anasayfada yayınlarken boşluklar meydana geliyordu bu sorunu else kodları ile çözdük örneğin anasayfadaki yazıda bizim belirlediğimiz resim yoksa sabit atadığımız resim çıkmakta bu benzer yazılar ekentisinde de bu sorunla karşılaştık else kodlarını nasıl eklentiye tanıtıntabiliriz sizce ?
Hello;
My
şaka şaka ingilizce konuşup öldürmeyeceğim seni.
Bunun özel alanlar olmadan kullanımı mümkün mü onu soracağım.
http://meandmymac.net/plugins/randimage/ Bu adresteki eklenti ile son yazıları rastgele olarak gösterebiliyorum. Peki ilgili yazıları böyle resimli gösterebilmek mümkün mü acaba. Şu da var ama 2.7. BETA2 de çalışmadı. http://www.traderelic.com/blog.....ted-posts/
Sen ne dersin?
eylultoprak
Hi, Özel alanları kullanmadan olması mümkün ama illaki bir yerde o yazıya en az bir resmin atanması gerekiyor. Attachment ile eklenen resimler çekilip gösterilebilir.
- Her wordpress versiyonunda eklenti yenilenmekte. Eklenti sistemi biraz değişti son sürümde o nedenle çalışmıyor olabilir yada db tablo adları da değişmiş olabilir.
Php tam okuyamayan biri olarak
Okuyan biri biraz da değişikliğe giderse haberim olsun.. =) Bu arada mevcut son çalışmanı da DÖRT gözle bekliyorum =)
Görüşürüz teşekkür ederim..
Tekrar ben =)
İtalyan bir abimiz bunu yapmış ellerine sağlık diyor gözlerinden öpüyorum.. İtalyanlara çok sıcak bakıyorum şu sıralar =)
http://ziogeek.com/wordpress-r.....-thumb-01/