/*
Plugin Name: Limit Posts
Plugin URI: http://labitacora.net/comunBlog/limit-post.phps Description: Limits the displayed text length on the index page entries and generates a link to a page to read the full content if its bigger than the selected maximum length.
Usage: the_content_limit($max_charaters, $more_link)
Version: 1.1
Author: Alfonso Sanchez-Paus Diaz y Julian Simon de Castro
Author URI: http://labitacora.net/ License: GPL
Download URL: http://labitacora.net/comunBlog/limit-post.phps Make:
In file index.php
replace the_content()
with the_content_limit(1000, "more")
*/
function dp_recent_comments($no_comments = 10, $comment_len = 90) {
global $wpdb;
$request = "SELECT * FROM $wpdb->comments";
$request .= " JOIN $wpdb->posts ON ID = comment_post_ID";
$request .= " WHERE comment_approved = '1' AND post_status = 'publish' AND post_password ='' AND comment_type = ''";
$request .= " ORDER BY comment_date DESC LIMIT $no_comments";
$comments = $wpdb->get_results($request);
echo "$before_title"."$settings[title]"."$after_title";
if ($comments) {
foreach ($comments as $comment) {
$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;";
?>
$recent = new WP_Query("showposts=$number&orderby=id&order=DESC");
while( $recent->have_posts() ) : $recent->the_post();
global $post; global $wp_query;
global $wpdb;
$sql = "SELECT ID, post_title, comment_count FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ";
// What's the chosen timeline?
switch ($timeline) {
case "thismonth":
$sql .= "AND MONTH(post_date) = MONTH(NOW()) AND YEAR(post_date) = YEAR(NOW()) ";
break;
case "thisyear":
$sql .= "AND YEAR(post_date) = YEAR(NOW()) ";
break;
default:
$sql .= "";
}
// Make sure only integers are entered
if (!ctype_digit($maxposts)) {
$maxposts = 10;
} else {
// Reformat the submitted text value into an integer
$maxposts = $maxposts + 0;
// Only accept sane values
if ($maxposts <= 0 or $maxposts > 10) {
$maxposts = 10;
}
}
$sql .= "AND comment_count > 0 ORDER BY comment_count DESC LIMIT ". $maxposts;
$res = $wpdb->get_results($sql);
if($res) {
$mcpcounter = 1;
foreach ($res as $r) {
// Get our options and see if we're handling a form submission.
$options = get_option('ft_popular_posts_options');
if ( !is_array($options) )
$options = array(
'title'=>__('Popular Posts'),
'sincewhen' => 'forever',
'maxposts'=> 10
);
if ( $_POST['htnetmcp-submit'] ) {
// Remember to sanitize and format use input appropriately.
$options['title'] = strip_tags(stripslashes($_POST['htnetmcp-title']));
$options['sincewhen'] = strip_tags(stripslashes($_POST['htnetmcp-sincewhen']));
$options['maxposts'] = strip_tags(stripslashes($_POST['htnetmcp-maxposts']));
update_option('ft_popular_posts_options', $options);
}
// Be sure you format your options to be valid HTML attributes.
$title = htmlspecialchars($options['title'], ENT_QUOTES);
$sincewhen = htmlspecialchars($options['sincewhen'], ENT_QUOTES);
$maxposts = htmlspecialchars($options['maxposts'], ENT_QUOTES);
// Here is our little form segment. Notice that we don't need a form. This will be embedded into the existing form.
echo '';
echo '';
echo '';
echo '';
}
// ADD OPTIONS FOR THE FEATURED POSTS WIDGET
$widget_featured_posts_options = array(
'featured_works_tag_slug' => "featured",
'featured_works_side' => "6",
'featured_works_title' => "Featured Posts");
add_option('widget_featured_works_settings', $widget_featured_posts_options );
/*
Plugin Name: Ping/Track/Comment Count
Plugin URI: http://txfx.net/code/wordpress/ping-track-comment-count/ Version: 1.1
Description: Provides unctions that return or display the number of trackbacks, pingbacks, comments or combined pings recieved by a given post. Other authors: Chris J. Davis, Scott "Skippy" Merrill
Author: Mark Jaquith
Author URI: http://markjaquith.com/ */
/*
This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
function get_comment_type_count($type='all', $post_id = 0) {
global $cjd_comment_count_cache, $id, $post;
if ( !$post_id )
$post_id = $post->ID;
if ( !$post_id )
return;
function update_comment_type_cache(&$queried_posts) {
global $cjd_comment_count_cache, $wpdb;
if ( !$queried_posts )
return $queried_posts;
foreach ( (array) $queried_posts as $post )
if ( !isset($cjd_comment_count_cache[$post->ID]) )
$post_id_list[] = $post->ID;
if ( $post_id_list ) {
$post_id_list = implode(',', $post_id_list);
foreach ( array('', 'pingback', 'trackback') as $type ) {
$counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount
FROM $wpdb->posts
LEFT JOIN $wpdb->comments ON ( comment_post_ID = ID AND comment_approved = '1' AND comment_type='$type' )
WHERE post_status = 'publish' AND ID IN ($post_id_list)
GROUP BY ID");
/*
Function Name: getCategories
Version: 1.0
Description: Gets the list of categories. Represents a workaround for the get_categories bug in WP 2.8
Author: Dumitru Brinzan
Author URI: http://www.brinzan.net */
$q = "SELECT $tb1.term_id,$tb1.name,$tb1.slug FROM $tb1,$tb2 WHERE $tb1.term_id = $tb2.term_id AND $tb2.taxonomy = 'category' $qqq ORDER BY $tb1.name ASC";
$q = $wpdb->get_results($q);
foreach ($q as $cat) {
$categories[$cat->term_id] = $cat->name;
} // foreach
return($categories);
} // end func
/*
Function Name: getPages
Version: 1.0
Description: Gets the list of pages. Represents a workaround for the get_categories bug in WP 2.8
Author: Dumitru Brinzan
Author URI: http://www.brinzan.net */
function getPages() {
global $wpdb, $table_prefix;
$tb1 = "$table_prefix"."posts";
$q = "SELECT $tb1.ID,$tb1.post_title FROM $tb1 WHERE $tb1.post_type = 'page' AND $tb1.post_status = 'publish' ORDER BY $tb1.post_title ASC";
$q = $wpdb->get_results($q);
foreach ($q as $pag) {
$pages[$pag->ID] = $pag->post_title;
} // foreach
return($pages);
} // end func
$wrappeddate