cat_ID] = $category_list->cat_name;
}
$wp_listposts = array(2,4,6,8,10,12,14,16);
$wp_dropdown_rd_admin2 = get_pages('hide_empty=0&orderby=name');
$wp_getpages = array();
foreach ($wp_dropdown_rd_admin2 as $page_list) {
$wp_getpages[$page_list->ID] = $page_list->post_title;
}
//print_r($wp_getpages);
function mytheme_bz_admin() {
global $themename, $shortname, $options, $wp_getcat, $wp_getpages, $wp_listposts;
if ( $_REQUEST['saved'] ) echo '
'.$themename.' settings saved.
';
if ( $_REQUEST['reset'] ) echo '
'.$themename.' settings reset.
';
?>
post_excerpt;
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
$output = __('There is no excerpt because this is a protected post.');
return $output;
}
}
// If we haven't got an excerpt, make one.
if ((($output == '') && ($fakeit == 1)) || ($fakeit == 2)) {
$output = $post->post_content;
$output = strip_tags($output, $allowedtags);
$blah = explode(' ', $output);
if (count($blah) > $excerpt_length) {
$k = $excerpt_length;
$use_dotdotdot = 1;
} else {
$k = count($blah);
$use_dotdotdot = 0;
}
$excerpt = '';
for ($i=0; $i<$k; $i++) {
$excerpt .= $blah[$i] . ' ';
}
// Display "more" link (use css class 'more-link' to set layout).
if (($use_more_link && $use_dotdotdot) || $force_more_link) {
$excerpt .= "$more_link_text";
} else {
$excerpt .= ($use_dotdotdot) ? '...' : '';
}
$output = $excerpt;
} // end if no excerpt
return $output;
}
function getFeaturedPost (){
global $wpdb, $post;
$my_wpdata = $wpdb->get_results("SELECT * FROM $wpdb->posts where post_status='publish' and post_type='post' order by ID desc");
foreach ($my_wpdata as $mpdi=>$mpdv){
$market = "";
$featured = get_post_meta($mpdv->ID, 'is_slider', true);
if ($featured==1){
$featuredPosts[] = $mpdv->ID;
}
}
//return $post_title[0]->post_title;
//$key_1_value = get_post_meta(76, 'key_1', true);
return $featuredPosts;
}
function geteditorpost (){
global $wpdb, $post;
$my_wpdata = $wpdb->get_results("SELECT * FROM $wpdb->posts where post_status='publish'");
foreach ($my_wpdata as $mpdi=>$mpdv){
$market = "";
$featured = get_post_meta($mpdv->ID, 'is_editor', true);
$image = get_post_meta($mpdv->ID, 'image', true);
if ($featured==1){
$market["permalink"] = get_permalink($mpdv->ID);
if ($image!=""){
$market["image"] = $image;
}else{
$market["image"] = get_bloginfo('template_directory') . "/images/default2.gif";
}
$market["description"] = substr(strip_tags($mpdv->post_content),0,160);
$market["title"] = substr(strip_tags($mpdv->post_title),0,25); //strip_tags($mpdv->post_title),0,40);
$market["longtitle"] = $mpdv->post_title;
$featuredPosts[] = $market;
}
}
//return $post_title[0]->post_title;
//$key_1_value = get_post_meta(76, 'key_1', true);
return $featuredPosts;
}
function get_foldername($gallery){
global $table_prefix;
$tbl = $table_prefix . "ngg_gallery";
$q = mysql_query("select * from $tbl where gid=$gallery");
return mysql_fetch_array($q);
}
function get_scroller($limit = 12) {
global $wpdb, $post, $table_prefix;
$tbl = $table_prefix . "ngg_pictures";
$images = $wpdb->get_results("select * from $tbl order by pid desc LIMIT $limit");
//print_r($images);
$xvv = 1;
foreach ($images as $post) {
$folder = get_foldername($post->galleryid);
$folder = $folder[path];
$image = get_bloginfo("url") . "/" . $folder . "/" . $post->filename;
$images = $image
//$image = get_post_custom_values("featured-image")==""?get_bloginfo ("template_directory") . "/images/posts/default-img.gif":get_post_custom_values("featured-image");
?>
get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_date, post_content, COUNT($wpdb->comments.comment_post_ID) AS 'comment_total' FROM $wpdb->posts LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date_gmt < '".gmdate("Y-m-d H:i:s")."' AND post_status = 'publish' AND post_password = '' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_total DESC LIMIT $limit");
$a = 1;
foreach ($mostcommenteds as $post) {
$post_title = htmlspecialchars(stripslashes($post->post_title));
//$post_title_short = the_title();
$post_image = get_post_meta($post->ID, 'image', true);
if ( $post_image ) {
$img = get_bloginfo('template_directory') . "/thumb.php?src=" . str_replace('http://'.$_SERVER['HTTP_HOST'], "", $post_image) . "&h=40&w=52&zc=1&q=100";
}else{
$post_image = get_bloginfo('template_directory') . "/images/default2.gif";
$img = get_bloginfo('template_directory') . "/thumb.php?src=" . str_replace('http://'.$_SERVER['HTTP_HOST'], "", $post_image) . "&h=40&w=52&zc=1&q=100";
}
?>
get_var("
SELECT comment_author_url
FROM $wpdb->comments
WHERE comment_author = '".addslashes($user)."'
AND comment_author_url != 'http://'
AND comment_approved = 1
ORDER BY comment_date DESC LIMIT 1
");
return $url;
}
function get_post_info($post) {
global $wpdb;
$url = $wpdb->get_var("
SELECT post_title
FROM $wpdb->posts
WHERE ID = '".$post."'
");
return $url;
}
function substr_ellipse($str, $len) {
if(strlen($str) > $len) {
$str = substr($str, 0, $len-3) . "...";
}
return $str;
}
function show_top_commentators($limitList=20) {
// Each widget can store its own options. We keep strings here.
$limitChar = 30;
$limitList = " LIMIT " . $limitList;
$listNull = "No commentators.";
$makeLink = $options['makeLink'];
$noFollow = $options['noFollow'];
$showCount = $options['showCount'];
// This sets the type of list to be used
$listStart = "";
$listEnd = "";
// This writes out the proper SQL whether to group commenters
// by e-mail or user name
$groupBy = "GROUP BY comment_author";
// These lines generate our output. Widgets can be very complex
// but as you can see here, they can also be very, very simple.
global $wpdb;
$commenters = $wpdb->get_results("
SELECT COUNT(comment_author) AS comment_comments, comment_author, comment_author_url, comment_author_email
FROM $wpdb->comments
WHERE comment_type != 'pingback'
AND comment_author != ''
AND comment_approved = '1'
$excludeNames
$groupBy
ORDER BY comment_comments DESC, comment_author ASC
$limitList");
if(is_array($commenters)) {
$countList = 0;
foreach ($commenters as $k) {
$url = get_user_url($k->comment_author);
$url = $url==""?"#":$url;
echo "
";
}
}
}
function recent_replies($limitList=6) {
// Each widget can store its own options. We keep strings here.
$limitChar = 42;
$limitList = " LIMIT " . $limitList;
$listNull = "No commentators.";
$makeLink = $options['makeLink'];
$noFollow = $options['noFollow'];
$showCount = $options['showCount'];
// This sets the type of list to be used
$listStart = "";
$listEnd = "";
// This writes out the proper SQL whether to group commenters
// by e-mail or user name
// These lines generate our output. Widgets can be very complex
// but as you can see here, they can also be very, very simple.
global $wpdb;
$commenters = $wpdb->get_results("
SELECT comment_post_ID, comment_author, comment_author_url, comment_author_email
FROM $wpdb->comments
WHERE comment_type != 'pingback'
AND comment_author != ''
AND comment_approved = '1'
ORDER BY comment_ID DESC
$limitList");
if(is_array($commenters)) {
$countList = 0;
foreach ($commenters as $k) {
$url = get_permalink($k->comment_post_ID);//get_user_url($k->comment_author);
$url = $url==""?"#":$url;
$postInfo = get_post_info($k->comment_post_ID);
$post_data=get_post($k->comment_post_ID, ARRAY_A);
$post_image = get_post_meta($k->comment_post_ID, 'image', true);
//$post_data = get_post($k->comment_post_ID, ARRAY_A);
//print_r($post_data);
if ( $post_image ) {
$img = get_bloginfo('template_directory') . "/thumb.php?src=" . str_replace('http://'.$_SERVER['HTTP_HOST'], "", $post_image) . "&h=40&w=52&zc=1&q=100";
}else{
$post_image = get_bloginfo('template_directory') . "/images/default2.gif";
$img = get_bloginfo('template_directory') . "/thumb.php?src=" . str_replace('http://'.$_SERVER['HTTP_HOST'], "", $post_image) . "&h=40&w=52&zc=1&q=100";
}
?>
'Sidebar',
'before_widget' => '