Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

default.php

By: a guest on Jan 17th, 2011  |  syntax: PHP  |  size: 2.77 KB  |  hits: 357  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /*
  3. Plugin Name: List Category Posts - Template
  4. Plugin URI: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
  5. Description: Template file for List Category Post Plugin for Wordpress which is used by plugin by argument template=value.php
  6. Version: 0.8
  7. Author: Radek Uldrych & Fernando Briano
  8. Author URI: http://picandocodigo.net http://radoviny.net
  9. */
  10.  
  11. /* Copyright 2009  Radek Uldrych  (email : verex@centrum.cz), Fernando Briano (http://picandocodigo.net)
  12.  
  13. This program is free software; you can redistribute it and/or modify
  14. it under the terms of the GNU General Public License as published by
  15. the Free Software Foundation; either version 3 of the License, or
  16. any later version.
  17.  
  18. This program is distributed in the hope that it will be useful,
  19. but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. GNU General Public License for more details.
  22.  
  23. You should have received a copy of the GNU General Public License
  24. along with this program; if not, write to the Free Software
  25. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  26. */
  27.  
  28. //Show category?
  29.         if ($atts['catlink'] == 'yes'){
  30.                 $lcp_output = '<a href="' . $cat_link . '" title="View the ' . $cat_title . ' category">' . $cat_title . '</a>';
  31. }else{
  32.         $lcp_output = '';
  33. }
  34. $lcp_output .= '<ul class="lcp_catlist">';//For default ul
  35. //Posts loop:
  36. foreach($catposts as $single):
  37.         $lcp_output .= '<li><a href="' . get_permalink($single->ID) . '">' . $single->post_title . '</a>';
  38.         //Show comments?
  39.         if($atts['comments'] == yes){
  40.                 $lcp_output .= ' (' . $single->comment_count . ')';
  41.         }
  42.         //Style for date:
  43.         if($atts['date']=='yes'){
  44.                 $lcp_output .= ' - ' . get_the_time($atts['dateformat'], $single);
  45.         }
  46.         //Show author?
  47.         if($atts['author']=='yes'){
  48.                 $lcp_userdata = get_userdata($single->post_author);
  49.                 $lcp_output .=" - ".$lcp_userdata->display_name;
  50.         }
  51.         //Show thumbnail?
  52.         if($atts['thumbnail']=='yes'){
  53.     if(has_post_thumbnail($single->ID)){
  54.       $lcp_output .= '<div class="lcp_thumbnail"><a href="' . get_permalink($single->ID) . '">' . get_the_post_thumbnail($single->ID, array('40','40'))   . '</a></div>';
  55.                 }
  56.         }
  57.         //Show content?
  58.         if($atts['content']=='yes' && $single->post_content){
  59.                 $lcpcontent = apply_filters('the_content', $single->post_content); // added to parse shortcodes
  60.                 $lcpcontent = str_replace(']]>', ']]&gt', $lcpcontent); // added to parse shortcodes
  61.                 $lcp_output .= '<p>' . $lcpcontent . '</p>'; // line tweaked to output filtered content
  62.         }
  63.         //Show excerpt?
  64.         if($atts['excerpt']=='yes' && !($atts['content']=='yes' && $single->post_content) ){
  65.                 $lcp_output .= lcp_excerpt($single);
  66.         }
  67.         $lcp_output .='</li>';
  68. endforeach;
  69. $lcp_output .= '</ul>';
  70. ?>