Posted by & filed under wordpress, Wordpress Plugin.

3Ok let me at first tell why this post ?
I have a wp plugin named wptinybn which enables users to write in unicode bangla for different types of bengali keyboard in wp visual editor which is based on tinymce. Actually my wp plugin is based on my tinymce plugin tinybn. That means besides the wptinybn the tinybn plugin is a standalone tinymce plugin. So it should work with everywhere with tinymce. ok.. I am 25% done :)

There is another wp plugin named TinyMCEComments which enables wp users to write comments through tinymce editor. I am 50% done. Cool na ?

One of my reader asked me how to add the tinybn support to TinyMCEComments. I just check that plugin’s code and I have that plugin installed in my own blog too though not enabled! Yes my answer is yes … that means it’s possible. It can be done in different ways. As a quick thinking I am giving a poor or faster (whatever u think) way to do that. I am 75% done… wait a bit man.

Download the wptinybn and TinyMCEComments plugin and install them. (if u want not to install wptinybn to do that then it’s ok, I mean no dependency). Check wptinybn(unzip first!) folder and you should find a folder in it named “banglafkb”.Copy this and paste in wp-includes/js/tinymce/plugins folders in your blog wp installation. Done ? ok now …

hmm now you have to be more brave to edit the TinyMCEComments plugin… not much in deed. Open file tinyMCEComments.php and find the word “pls”. Stop to it’s first occurance the word will be like $pls and it’s a array and here parts of code is like

$pls = array('separator','bold','italic','underline','strikethrough','justifyleft','justifycenter','justifyright','justifyfull','bullist','numlist','outdent','indent','cut','copy','paste','undo','redo','link','unlink','cleanup','help','code','hr','removeformat','sub','sup','forecolor','backcolor','charmap','visualaid','blockquote','spellchecker','fullscreen');

now place // before this line and it will be like bellow

//$pls = array('separator','bold','italic','underline','strikethrough','justifyleft','justifycenter','justifyright','justifyfull','bullist','numlist','outdent','indent','cut','copy','paste','undo','redo','link','unlink','cleanup','help','code','hr','removeformat','sub','sup','forecolor','backcolor','charmap','visualaid','blockquote','spellchecker','fullscreen');

we just kept the old code .
now in new line put this bellow code

$pls = array('separator','bold','italic','underline','strikethrough','justifyleft','justifycenter','justifyright','justifyfull','bullist','numlist','outdent','indent','cut','copy','paste','undo','redo','link','unlink','cleanup','help','code','hr','removeformat','sub','sup','forecolor','backcolor','charmap','visualaid','blockquote','spellchecker','fullscreen','banglafkb');

If you check the above code what I have added new here ? just that ,’banglafkb’

I am 90% done. Now to to your admin panel activate tinymcecomments plugin then from menu Settings go to it’s(that plugin’s) setting page and check (if you done above copy pase and code editing) ‘banglafkb’ is in the button list and in the available plugin list. Just click both banglafkb to add from button list and plugin list. For button list click seperator before banglafkb that will be make a | seperator in editor. Now save this new option and check your comment form.

Angry one me ? You have done every thing properly but nothing new in the editor and u don’t see any change in the preview editor int the plugin options page. Don’t worry. The plugin keeps the setting in cache for 10 days. So to get the changes within one sec just open the tinyMCEComments.php file and pls check from top few liens code

there is a line like
$mcecomment_expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache
make this line comment I mean like
//$mcecomment_expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache
and now put a new line bellow it like
$mcecomment_expiresOffset = 1; // Cache for 1 sec in browser cache

now save this file and check the option’s page’s preview editor.

I think I am 100% done now. mu ha ha.

Oh I forgot to say currently I am working on a joomla plugin to make the dates in bangla for front end for articles, actually it will work with com_content …hope to release this on the eid-durga puja vacation.

Again here is some screenshot(one is above) of this post’s summary.MCEComments Options ‹ Let’s start again… — WordPress_1251930556673MCEComments Options ‹ Let’s start again… — WordPress_1251930589424MCEComments Options ‹ Let’s start again… — WordPress_1251930628482

Posted by & filed under Java script, Joomla, Joomla Extention.

Dear Friends,

I know there is no update on tinybn for many days and it has so many bugs but I am not gone yet ! heh heh. I think who are very familiar with joomla and it’s content editor tinymce, are also familiar with jce(joomla content editor), a joomla conent editor based on tinymce with lots of feature. You can get jce here. Please check their donwload section to download the jce component and jce plugin/mambot(editor).

hmm, please don’t get sleep … I just made a plugin for jce to use my tinybn plugin directly in jce. No manuall install needed , I mean editing files to work with default tinymce.
So , here is the download file of tinybn for jce.


  Tinybn JCE Editor (12.1 KiB, 8,232 hits)

How to install

1. Install jce component (that will help you to modify or control jce editor and install new plugin and much more)
2. Install jce plugin
3. Now install tinybn plugin for jce. Go to Administrator-> Components-> JCE Administrations-> Install (see screenshot bellow)
4. Now browser the downloaded zip file and install it.


that’s it.
Install finish :) . Ok now go to article manager and try to open/write any new article. I think you are intelligent enough to make your editor default to jce or even disabled tinymce from plugins. If jce is your current editor and you have install the tinybn for jce according to instruction then you should see like bellow. Select keyboard and type in diff bengali layout.


mu ha ha…waiting for your feedback.

Posted by & filed under wordpress, Wordpress Plugin, Wordpress Themes.

Don't Follow MeOne of my senior brother just asked me, how to add no follow rel for comments in wordpress. May be there is plugin for this. Look to my code :)
How to use:
1.Open the functions.php file in ur current theme and put these code within php tags.

What it will do:
1. Will add ‘no follow’ as rel in url , if comment contains any url.
2. Will ad ‘external’ as rel in url , if comment contains any url.
3. Will add target=”_blank” in comment author’s url so that their web url open’s in new window/new tab as in browser settings
4. Will add target=”_blank” to url, if comment contains any url
5. Wp adds ‘no follow’, ‘external’ rel in comment author’s url by default. So we don’t need to add this 😛

1.If possible upgrade to wp2.8.2

      function nofollow($text) {
	        $text = preg_replace('/<a /i','<a rel="nofollow external" ',$text);
	        $text = preg_replace('/<a /i','<a target="_blank" ',$text);
	        return $text;
    function targetblank($text){
    		$text = preg_replace('/<a /i','<a target="_blank" ',$text);
	        return $text;

    add_filter('comment_text', 'nofollow');

any question ask me :)
p.s.: post image is just for fun 😛

BTW, are you afraid of editing your functions.php ? Ok, no problem you can add the above piece of code using the bellow wp plugin.

  Wp nofollow plugin for comment (997 bytes, 1,794 hits)

Duh, you are totally unhappy with this post, na ? You can to treat your commentors with “cake and cook”, ok no problem.Just forget my post and read this blog post …“The Single, Most Profound Way To Thank Your Commenters”.
Happy now ?

Posted by & filed under wordpress, Wordpress Plugin.

Yah, I know my developed tinybn (an ekushey project ,  tinymce plugin to write bangla in tinymce editor) has so many bugs and even I will recommend not to use in any live :P. But we are crazy to write bangla in web in any condition… heh heh.. hmm I didn’t get time to update the scripts. Though updated them to make compatible for tinymce3.x. Yes, I am so lazy …I didn’t udpate the lastest version in ekushey :(

Even I made a plugin for wordpress to use this plugin in wordpress editor in Visual mode (that means tinymce is enabled :D).hmm I didn’t release this too. Let me release this for every body. Please keep this mind that it has bugs, yes it has so many bugs but I will be happy if ppl use this and give me feedback so that I can update this when I am free.

Let me show how the tinybn plugin in wordpress will show [ Screenshot taken from my blog,wp2.8.2]

How to use:
1. Download the zip given here for download and then unzip.
2. Copy the folder wp_tinybn_fixed to your wodpress plugin dir.
3.Activate the plugin
4. Try to write any new post/page in visual mode
Licence: GPL2

  Wp tinybn plugin 2.2 (20.6 KiB, 2,047 hits)

Any kind of negative and positive comment/feedback is welcome :)

version 2.1 released
1. Fixed bug for js if the language mode is in bangla :P. That was my mistake to migrate the plugin from tinymce2.x compatible to 3.x. I forgot to change the language file setting for bangla language and I didn’t use this plugin while bangla is active in backend :(. Oh I have to fix same thing for jce version of tinybn.
2. Special thank to Hasan

Posted by & filed under Joomla, Projects.

It’s many days I didn’t write any thing here. I am not lost yet ! heh heh really I am not lost. Within last 4/5 months I did lots of projects. I said in many place that I started my professional career in jan 2008 and then it was hampered by so many things. I back to work again 4/5 months ago and now working as a full time freelancer at home. Yes I like to work with full freedom though working from home has some bad sides. Let me introduce you with some of my last 4/5 months projects. Hei ! I am really and here every thing is in brief.

ISLAM clone (look and feel) using wordpress: Though changes their layout frequently, I made a clone of it’s interface using wordpress, I mean the theme of wordpress. Here is snapshot of that. Oh yes, at first I made it red as and then changed the red color to greenish. It’s for

BBC NEWS_1248108686378 clone using wordpress: I mentioned in another post that I made a theme for wordpress with same look and feel of It’s front page is like and innner pages are like . sexy na ? heh heh.. wana see demo. check here. Here is screenshot. clone of A german site for furniture market. It’s using  joomla and market place component , though it’s customized too much. The main marketplace component is customized as needed and some custom modules are developed to give support to the component in front end. It’s in german language :) Visit the site from here(

Will update mores in another post :)

Posted by & filed under wordpress, Wordpress Plugin, Wordpress Themes.

I think to show the first image as thumb in wp front page or blog layout is very common for any theme. But to use it in wordpress mu version is not direct or need to do some hack or modify the normall process of adding timthub. Normally we upload images from wp media manager and use those in posts. In normal wordpress the upload dir is wp-content/uploads and files and images are uploaded to that directory. In wordpress mu version files are uploaded by user basis folder and for this wp-content/blogs.dir/userid is the uploaded dir for any image. here user id is named as folder name for each user. then wp-content/blogs.dir/userid/files. But when u browse the site the image link format is like http://yoursitename/files/year/month/image name but format is reshaped by the wp mu htacces which real physical path is like wp-content/blogs.dir/userid/files/year/month/image name.
Read more »

Posted by & filed under Joomla, Joomla Extention.

I think JW Player(flash player) by is well known to u all. There are so many extension for joomla, wordpress, drupal and other cms using this tool. Simple_video_flash_player is a joomla module to show flash and other videos. Today I used it with one of project. But after checking in ie6 I was tempered becuase it was showing a js error in ie and the modules config file I meant he xml file has not param to show module class suffix which is very important to style module using css. I searched google and got so many solution. Here is my code that helped to solve this issue in ie6.
Read more »

Posted by & filed under Joomla.

I always like to share web related silly problems that I face in my works.
If u are a joomla fan and u like to make a image gallery in joomla then rsgallery2 can be ur better(to me it’s best) choise. But one thing that I faced in joomla1.5(don’t know about the condition in joomla1.x series) about rsgallery2 is it’s title and pathway problem when it’s just connected as component from menu I mean just when u go to rsgallery2 as from menu as a component it doesn’t show any breadcrumb(pathway) and pagetitle

I searched google and joomla forum for this but didn’t get much help actually. BTW, at this time the rsgallery2 site is down for maintenance. So I gave a try to fix this as I always do.

At first let me clear about the problem. When first time u will go to rsgallery2 as component, in this condition no gallery is selected and no items in any gallery ie, no gallery id or current gallery is as no gallery id

Not clear yet, check the code in com_rsgallery2\templates\meta\display.class.php and in function showRSPathWay()…To get it clearly u have to check this function dear

see this
if ( $gallery->id == $currentGallery && empty($item) )

this is true when just go to rsgallery2 because no items and both the gallery id is null and currentgallery id is null and
as it’s true the code is executed as $pathway->addItem($gallery->name );
but as gallery id is null then it’s doesn’t show any gallery name… isn’t it a bug huh ? that means pathway fails to show any thing for this condition and same problem in
function metadata() which shows the pagetitle for rsgallery2 and meta information.

Here is the code that I edited for those two functions

/**     * shows proper Joomla path     */
function showRSPathWay() {
		global $mainframe, $mosConfig_live_site, $Itemid, $option;
		// if rsg2 isn't the component being displayed, don't show pathway
		if( $option != 'com_rsgallery2' )	return;

		$gallery = rsgInstance::getGallery();
		$currentGallery = $gallery->id;
		$item = rsgInstance::getItem();
		$galleries = array();
		$galleries[] = $gallery;
		while ( $gallery->parent != 0) {
			$gallery = $gallery->parent();
			$galleries[] = $gallery;
		$galleries = array_reverse($galleries);
		if( defined( 'J15B_EXEC' ) )
			// J1.0 method
			foreach( $galleries as $gallery )
				if ( $gallery->id == $currentGallery &amp;&amp; empty($item) )
				} else {
					$mainframe->appendPathWay('<a href="' . JRoute::_('index.php?option=com_rsgallery2&amp;Itemid='.$Itemid.'&amp;gid=' . $gallery->id) . '">' . $gallery->name . '</a>');
			if (!empty($item)) {
					$mainframe->appendPathWay( $item->title );
			// J1.5 method
			$pathway =&amp; $mainframe->getPathway();

			/*Edit start by manchumahara*/
			$document	=&amp; JFactory::getDocument();
			$params = &amp;$mainframe->getParams();
			$menus	= &amp;JSite::getMenu();
			$menu	= $menus->getActive();
			$pagetitle = '';
			if (is_object( $menu ))
				$menu_params = new JParameter( $menu->params );
				if (!$menu_params->get( 'page_title'))
					$pagetitle = JText::_('MRSGALLERYTITLE');
					//loading it from language file
				else $pagetitle =$menu_params->get( 'page_title');
				$pagetitle = JText::_('MRSGALLERYTITLE');
				//loading it from language file
			//$pagetitle = $mainframe->getPageTitle();
			foreach( $galleries as $gallery )
				if ( $gallery->id == $currentGallery &amp;&amp; empty($item) )
					if($gallery->id== 0){
						//gallery id zero and no items ie, if menu is link to component directly
						//gallery id not zero,ie gid id ok but no items in this gallery
						$pathway->addItem($gallery->name );
				} else
					$link = 'index.php?option=com_rsgallery2&amp;gid=' . $gallery->id;
					$pathway->addItem( $gallery->name, $link );
			/*Edit end by manchumahara*/

			/*Edit start by manchumahara*/
			if (!empty($item)) {
				$mainframe->appendPathWay($item->title );
				//$mainframe->appendPathWay( $title );
			else {$mainframe->appendPathWay($pagetitle);}
			/*Edit end by manchumahara*/
	/**	 * insert meta data into head	 */
	function metadata(){
		global $mainframe, $option;
		// if rsg2 isn't the component being displayed, don not append meta data
		if( $option != 'com_rsgallery2' )
			return;		/*Edit by manchumahara*/
		$document	=&amp; JFactory::getDocument();
		$params = &amp;$mainframe->getParams();
		$menus	= &amp;JSite::getMenu();
		$menu	= $menus->getActive();
		$pagetitle = '';
		if (is_object( $menu )) {
			$menu_params = new JParameter( $menu->params );
			if (!$menu_params->get( 'page_title')) {
				$pagetitle = JText::_('MRSGALLERYTITLE');
				//loading it from language file
			else $pagetitle =$menu_params->get( 'page_title');
			$pagetitle = JText::_('MRSGALLERYTITLE');
			//loading it from language file

		/*Edit start by manchumahara*/
		$title = $this->gallery->get('name');
		$description = htmlspecialchars(strip_tags($this->gallery->get('description')), ENT_QUOTES );
		$item = rsgInstance::getItem();
		if ($item != null){
			$title .= ' - ' . $item->title;
			$description .= ' -  ' . htmlspecialchars(strip_tags($item->descr), ENT_QUOTES );

		/*Edit end by manchumahara*/

		if($title == ''){ $title = $pagetitle;}

		/*Edit start by manchumahara*/
		$mainframe->setPageTitle( ' '. $title );
		$mainframe->appendMetaTag( 'description',  $description );

BTW, as if there is nothig set as pagetitle from menu then I showed it from language file and for this I made an entry in language file as like this. Open en-GB.ini file and put this line at the end

Posted by & filed under wordpress, Wordpress Themes.

bbcNow a days I am a great fan of wordpress. Recently I have done some projects on wordpress and getting expert day by day 😛 heh heh.

This post about how can we make menu in wordpress like Now a days some clients want clone sites. They don’t think about all the functionality but the look and feel clone :) .
So to clone the menu like we what we need:
1. wp function wp_list_categories(args)
2. CSS to give look and feel like

Before we start let’s check what we are going to do:
here is the image that we are going to make or the menu that we are doing to make using wp_list_categories function and css. Look this menu is 2 level deep. To keep the theme clean u can make a function in functions.php file like bellow and just call the function in theme where u want to place the menu.
Look here we are using echo= 0 as want to just return the output from this function. and depth =2 as we want to make two level hirarachy… check others params that I have used. To know details about the template tag wp_list_categories pls check this page in wp codex.

Now what we need is to apply the css to style the menu like… one thing to keep in mind. When u will browse through the category I mean u click the any category from the menu and posts will be shown using category.php template then active category will get an extra class automatic which is helpfull to highlight using css but if u browse any single.

function get_leftcatmenu(){
$excludecats = array();
$excludecats = array(1,2,3); //categories to exlclude
//$includecats = array ();
//$includecats = array(1,2,3); //categories to include

// same thing can be done using a simple plugin and saving the categories in option table , bellow code is for comma seperated cat list
$excludecats = explode(',', get_option('bbcnews_leftmenucid'));
$excludecats = implode( ",",$excludecats);
$includecats = explode(',', get_option('bbcnews_leftmenuscid'));
$includecats = implode( ",",$seccats);

//sample code to exclude
return wp_list_categories('orderby=name&amp;amp;amp;style=list&amp;amp;amp;hide_empty=0&amp;amp;amp;show_count=0&amp;amp;amp;title_li=&amp;amp;amp;exclude='.$excludecats.'&amp;amp;amp;hierarchical=true&amp;amp;amp;depth=2&amp;amp;amp;echo=0');

// sample code to inlclude
return wp_list_categories('orderby=id&amp;amp;amp;style=list&amp;amp;amp;hide_empty=0&amp;amp;amp;show_count=0&amp;amp;amp;title_li=&amp;amp;amp;include='.$includecats.'&amp;amp;amp;hierarchical=true&amp;amp;amp;depth=2&amp;amp;amp;echo=0');

post we need the hightlight the category in the menu to which the single post belongs to. But to make this happen that adding an extra class to the menu to make active while browsing any single posts I have used a plugin :) named “Show Active Category (while browsing a post)“. Note if any post belongs to more one category then it will add extra active class to each category.

Uff….now check the css code that I used:
Note: this css code works fine in ff3 and ie6 and I have no interest with other browser at this moment.
Code to use in theme:

<ul class="catmenu">
<li class="<?php if (is_home()){ echo"> home"><a href="<?php echo get_option('home'); ?>">News Front Page</a></li>

and code to add in style.css

ul.catmenu li{ background-color:#E5E5E5; margin-bottom:2px;}
ul.catmenu li a{ text-decoration:none;  line-height:19px;  font-size:11px; font-weight:bold;  padding:2px 0  2px 5px; color:#1F527B; vertical-align:middle; }
ul.catmenu li ul.children li a{ text-decoration:none; line-height:19px; font-family:9px; font-weight:normal; padding:2px 0  2px 5px; vertical-align:middle;}
ul.catmenu li:hover{ background-color:#D8D8D8;}
ul.catmenu li.current-cat{ background:#665F6E url(images/v3_square_rb.gif) repeat-y scroll right top;}
ul.catmenu li.current-cat:hover{ background-color:#665F6E;}
ul.catmenu li.current-cat a{ color:#FFFFFF;}
ul.catmenu li a:hover{ text-decoration:underline;}
ul.catmenu li ul.children{ background-color:#D3D3D3; display:none;}
ul.catmenu li ul.children li{ margin-bottom:0px;}
ul.catmenu li.current-cat-parent{ background:#665F6E;}
ul.catmenu li.current-cat-parent a{ color:#FFFFFF;}
ul.catmenu li.current-cat-parent ul li a,ul.catmenu li.current-cat ul li a{ color:#1F527B;}
ul.catmenu li.current-cat-parent ul li.current-cat{ background:#C0BFBF url(images/v3_square_rb.gif) repeat-y scroll right top;}
ul.catmenu li.current-cat ul.children,ul.catmenu li.current-cat-parent ul.children { display:block; background-color:#D3D3D3; }

ul.catmenu li.current-cat-parent ul li.current-cat a{ font-weight:bold; color:#1F527B;}

have not enogh time to discuss what the above css code do but it took me more than 1 hr to write the above css perfectly :( . If u are familiar with the abc of css then u will get the css code easily.

BTW, u need one image in the images folder and here is link for that image . Copy and paste the image in images folder. Pls keep in mind about the copy right of the image. Here the main thing that I wanted to highlight that how to make clone of any “look and feel” with own creativity that is what I actually did here.

Another screenshot:


Posted by & filed under wordpress, Wordpress Themes.

If u are reached here using search engine then I am sure that you are just fucked up :( .. is_home(), is_single(), is_category() are not working…specially in footer and other places. I faced the same problem. While working with a wordpress theme, this functions were working fine in footer but once I noticed that they are not working as they should be !….

Let me explain why and how this problem occurs and what’s the solution :

I think if u are familiar with the famus LOOP in wordpress. The following is_home(), is_single(), is_category() functions depends on the loop. ACtually when u visit the home page then header.php, index.php, sidebar.php and footer.php files are executed and in the same way when u visit a single post then normally header.php, single.php, sidebar.php and footer.php files are executed. Actually some global page specific query is done for single.php, index.php etc. is_home(), is_single(), is_category() they will work fine if u use the default theme and don’t add any custom query !

Let’s check the code for is_home() function …

* Whether current page view is the blog homepage.
* @since 1.5.0
* @uses $wp_query
* @return bool True if blog view homepage.
function is_home () {
global $wp_query;
return $wp_query->is_home;

Ok, for custom query maximum time I use this function get_posts. But to get more control I used query_posts. They are same and share some common arguments but query_posts gives more controls and more arguments to pass to get the exact query. Now Let’s check the code for query_posts() function

* Setup the Loop based on the query variables.
* @uses WP::$query_vars
* @since 2.0.0
function query_posts() {
global $wp_the_query;

and code for get_posts

* Retrieve list of latest posts or posts matching criteria.
* The defaults are as follows:
*     'numberposts' - Default is 5. Total number of posts to retrieve.
*     'offset' - Default is 0. See {@link WP_Query::query()} for more.
*     'category' - What category to pull the posts from.
*     'orderby' - Default is 'post_date'. How to order the posts.
*     'order' - Default is 'DESC'. The order to retrieve the posts.
*     'include' - See {@link WP_Query::query()} for more.
*     'exclude' - See {@link WP_Query::query()} for more.
*     'meta_key' - See {@link WP_Query::query()} for more.
*     'meta_value' - See {@link WP_Query::query()} for more.
*     'post_type' - Default is 'post'. Can be 'page', or 'attachment' to name a few.
*     'post_parent' - The parent of the post or post type.
*     'post_status' - Default is 'published'. Post status to retrieve.
* @since 1.2.0
* @uses $wpdb
* @uses WP_Query::query() See for more default arguments and information.
* @link
* @param array $args Optional. Override defaults.
* @return array List of posts.
function get_posts($args = null) {
$defaults = array(
'numberposts' => 5, 'offset' => 0,
'category' => 0, 'orderby' => 'post_date',
'order' => 'DESC', 'include' => '',
'exclude' => '', 'meta_key' => '',
'meta_value' =>'', 'post_type' => 'post',
'suppress_filters' => true

$r = wp_parse_args( $args, $defaults );
if ( empty( $r['post_status'] ) )
$r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';
if ( ! empty($r['numberposts']) )
$r['posts_per_page'] = $r['numberposts'];
if ( ! empty($r['category']) )
$r['cat'] = $r['category'];
if ( ! empty($r['include']) ) {
$incposts = preg_split('/[\s,]+/',$r['include']);
$r['posts_per_page'] = count($incposts);  // only the number of posts included
$r['post__in'] = $incposts;
} elseif ( ! empty($r['exclude']) )
$r['post__not_in'] = preg_split('/[\s,]+/',$r['exclude']);

$r['caller_get_posts'] = true;

$get_posts = new WP_Query;
return $get_posts->query($r);


get_posts will not make any problem for is_single(), is_home(), is_category() etc functions.

Solution: To avoid this problem you can use this trick:

$query_backup = clone($GLOBALS['wp_query']); //keep backup
$GLOBALS['wp_query'] = $query_backup; //restore from backup

Further info: Please keep in mind that the php function clone() will not work in php4, it’s just for php5 becuase Php5 handles objects in different way. Like in php5 you can copy a object in this way
$new_object = clone ($old_object);
here $new_object will not copy the object actually though it will just point to $old_object but in php4 the thing is just copy like bellow.
$new_object = $old_object;

You can check this link for better explanation.

Sometimes pain gives us a way to think 😛