hi fellows, can someone help me with a little thing? I have installed an wordpress theme but have a bug... Look here: http://mag1.31f.info/?wptheme=WP_009 You can see the text link that says "More from this category" But that doesnt work because have the following URL link: http://mag1.31f.info/?cat= The cat ID is missing... But that was fixed here: http://mag1.31f.info/?wptheme=WP_010 The problem is that I have the first theme installed and dont want to install the new one. Can someone help me fixing this? I have found the code... The bug code: function query_my_posts($wpsQuery,$blockTitle){ global $wpdb,$post; $output = '<div class="Block" style="width:289px;float:left"><div class="Block-body"><div class="BlockHeader"><div class="l"></div><div class="r"></div><div class="header-tag-icon"><div class="t">'; $output .= $blockTitle; $output .= '</div></div></div><div class="BlockContent"><div class="BlockContent-tl"></div><div class="BlockContent-tr"></div><div class="BlockContent-bl"></div><div class="BlockContent-br"></div><div class="BlockContent-tc"></div><div class="BlockContent-bc"></div><div class="BlockContent-cl"></div><div class="BlockContent-cr"></div><div class="BlockContent-cc"></div><div class="BlockContent-body" style="margin:0;height:375px">'; //$recent = new WP_Query("cat=" . $catid . "&showposts=" . $num); while($wpsQuery->have_posts()) : $wpsQuery->the_post(); $permalink = get_permalink($post->ID); $post_title = stripslashes($post->post_title); $post_content = get_string_limit($post->post_content,100); $img = get_thumb($post->ID); $output .= '<div>'; $output .= '<div style="height:60px;overflow:hidden;margin:0px;">'; $output .= '<div style="float:left;padding:1px 5px 0 1px;">'; $output .= '<a href="'.$permalink.'" rel="bookmark" title="permalink to '.$post_title.'">'; $output .= '<img src="'.$img.'" alt="'.$post_title.'" style="height:60px;width:60px" />'; $output .= '</a>'; $output .= '</div>'; $output .= '<h2 style="margin:0;padding:0;text-align:left;"><a href="'.$permalink.'" rel="bookmark" title="Permanent Link to '.$post_title.'" style="font-size:14px;font-weight:bold;">'.$post_title.'</a></h2>'; $output .= '<div style="margin:2px 0 0 0;padding:0;font-size:85%;text-align:left;">'; $output .= $post_content; $output .= '</div>'; $output .= '</div>'; $output .= '<div class="sp-separator"></div>'; $output .= '</div>'; endwhile; $output .= '<div class="sp-read-more">'; $output .= '<a href="'.get_option("home").'/?cat='.$catid.'" rel="bookmark" title="Permanent Link to Read more from this category">Mais posts desta categoria</a>'; $output .= '</div>'; $output .= '<div class="cleared"></div></div></div><div class="cleared"></div></div></div>'; return $output; } // function get_random_posts($blogTitle,$num=5){ // return query_my_posts(new WP_Query('showposts='.$num.'&orderby=rand'),$blogTitle); // } // function get_recent_posts($blogTitle,$num=5){ // return query_my_posts(new WP_Query('showposts='.$num),$blogTitle); // } function get_feat_cat_posts($blogTitle,$catid,$num=4){ return query_my_posts(new WP_Query("cat=" . $catid . "&showposts=" . $num),$blogTitle); } Code (markup): The fixed code: function get_feat_cat_posts($sTitle,$catid,$num=4){ global $wpdb,$post; $output='<div class="art-Block catBlock"><div class="art-Block-tl"></div><div class="art-Block-tr"></div><div class="art-Block-bl"></div><div class="art-Block-br"></div><div class="art-Block-tc"></div><div class="art-Block-bc"></div><div class="art-Block-cl"></div><div class="art-Block-cr"></div><div class="art-Block-cc"></div><div class="art-Block-body"><div class="art-BlockHeader"><div class="l"></div><div class="r"></div><div class="art-header-tag-icon"><div class="t">'; $output.=$sTitle.'</div></div></div><div class="art-BlockContent"><div class="art-BlockContent-tl"></div><div class="art-BlockContent-tr"></div><div class="art-BlockContent-bl"></div><div class="art-BlockContent-br"></div><div class="art-BlockContent-tc"></div><div class="art-BlockContent-bc"></div><div class="art-BlockContent-cl"></div><div class="art-BlockContent-cr"></div><div class="art-BlockContent-cc"></div><div class="art-BlockContent-body" style="margin:0;">'; $recent = new WP_Query("cat=" . $catid . "&showposts=" . $num); while($recent->have_posts()) : $recent->the_post(); $permalink = get_permalink($post->ID); $post_title = get_string_limit($post->post_title,100); $post_content = get_string_limit($post->post_content,100); $output.= '<div><div style="height:60px;overflow:hidden;margin:5px;"><div style="float:left;padding:1px 5px 0 1px;"><a href="'; $output.= $permalink . '" rel="bookmark" title="'.$post_title.'">'; $output.= '<img src="'.get_thumb($post->ID) . '" alt="'.$post_title.'" style="height:60px;width:60px" /></a></div>'; $output.= '<h2 style="margin:0;padding:0;text-align:left;"><a href="'.$permalink.'" rel="bookmark" title="Permanent Link to '.$post_title.'" style="font-size:14px;font-weight:bold;">'.$post_title.'</a></h2>'; $output.= '<div style="margin:0;padding:0;font-size:85%;text-align:left;">'.$post_content.'</div></div><div class="sp-separator"></div></div>'; endwhile; $output.= '<div class="sp-read-more"><a href="'.get_option("home").'/?cat='.$catid.'" rel="bookmark" title="Permanent Link to Read more from this category">More from this category</a></div><div class="cleared"></div></div></div><div class="cleared"></div></div></div>'; return $output; } Code (markup): What I have to change? Please help... my php knowledge is very very poor...
This is the bug code - should be working (untested): function query_my_posts($wpsQuery,$blockTitle,$catid){ global $wpdb,$post; $output = '<div class="Block" style="width:289px;float:left"><div class="Block-body"><div class="BlockHeader"><div class="l"></div><div class="r"></div><div class="header-tag-icon"><div class="t">'; $output .= $blockTitle; $output .= '</div></div></div><div class="BlockContent"><div class="BlockContent-tl"></div><div class="BlockContent-tr"></div><div class="BlockContent-bl"></div><div class="BlockContent-br"></div><div class="BlockContent-tc"></div><div class="BlockContent-bc"></div><div class="BlockContent-cl"></div><div class="BlockContent-cr"></div><div class="BlockContent-cc"></div><div class="BlockContent-body" style="margin:0;height:375px">'; while($wpsQuery->have_posts()) : $wpsQuery->the_post(); $permalink = get_permalink($post->ID); $post_title = stripslashes($post->post_title); $post_content = get_string_limit($post->post_content,100); $img = get_thumb($post->ID); $output .= '<div>'; $output .= '<div style="height:60px;overflow:hidden;margin:0px;">'; $output .= '<div style="float:left;padding:1px 5px 0 1px;">'; $output .= '<a href="'.$permalink.'" rel="bookmark" title="permalink to '.$post_title.'">'; $output .= '<img src="'.$img.'" alt="'.$post_title.'" style="height:60px;width:60px" />'; $output .= '</a>'; $output .= '</div>'; $output .= '<h2 style="margin:0;padding:0;text-align:left;"><a href="'.$permalink.'" rel="bookmark" title="Permanent Link to '.$post_title.'" style="font-size:14px;font-weight:bold;">'.$post_title.'</a></h2>'; $output .= '<div style="margin:2px 0 0 0;padding:0;font-size:85%;text-align:left;">'; $output .= $post_content; $output .= '</div>'; $output .= '</div>'; $output .= '<div class="sp-separator"></div>'; $output .= '</div>'; endwhile; $output .= '<div class="sp-read-more">'; $output .= '<a href="'.get_option("home").'/?cat='.$catid.'" rel="bookmark" title="Permanent Link to Read more from this category">Mais posts desta categoria</a>'; $output .= '</div>'; $output .= '<div class="cleared"></div></div></div><div class="cleared"></div></div></div>'; return $output; } // function get_random_posts($blogTitle,$num=5){ // return query_my_posts(new WP_Query('showposts='.$num.'&orderby=rand'),$blogTitle); // } // function get_recent_posts($blogTitle,$num=5){ // return query_my_posts(new WP_Query('showposts='.$num),$blogTitle); // } function get_feat_cat_posts($blogTitle,$catid,$num=4){ return query_my_posts(new WP_Query("cat=" . $catid . "&showposts=" . $num),$blogTitle,$catid); } PHP:
------------------------------------------------------------------------------------------------------------- Hello Deacalion, I hope you can give solution for my coding errors, while making seo friendly urls, we are getting few errors, would you please resolve the problems, My coding error:Sorry unable to process your request at this moment. Please try later. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in on line 36 Sorry unable to process your request at this moment. Please try later. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in on line 42 My site rentalnetworks.com/beta/CISCO871W-G-E-K9.html