On nextgen gallery, we use [nggallery id=x] short tag on post/page to display our desired gallery. To display desired gallery on any place in a theme, we can use the following custom code:

             $newnggShortcodes = new NextGEN_Shortcodes;
             echo $newnggShortcodes->show_gallery( array("id"=>$key,"images"=>x,"template"=>"popular") );

Where $key is gallery id
x is number of gallery image to be displayed on that page
Popular is the template to display gallery (generally it will be inside nextgen-gallery\view\gallery.php), But you can create your own. For that creat copy of that gallery.php and rename it as gallery-{template name}.php. Here we are using template name as popular so the template file will be gallery-popular.php

Similarly for album we can use on theme file as

	$newnggShortcodes = new NextGEN_Shortcodes;
        echo $newnggShortcodes->show_album( array("id"=>$albums_id, "template"=>"extend") );

Here, $albums_id is id of album.
Template is same as above ie it uses nextgen-gallery\view\album-extend.php
or on post/page we can use [album id=x template=extend] or [album id=x template=compact] on content section

Similarly for single picture thumbnail we can use

	$newnggShortcodes = new NextGEN_Shortcodes;
         echo $newnggShortcodes->show_thumbs( array("id"=>$picture_id, "template"=>"") );

Here, $ picture _id is picture id.
Template is same as above ie it uses nextgen-gallery\view\imagebrowser.php by default. We can create own template same as above.
And for single picture we can use

	$newnggShortcodes = new NextGEN_Shortcodes;
echo $newnggShortcodes->show_singlepic( array("id"=>$picture_id,"w" =>'',"h"=>"","mode"=>"","float"=>"","link"=>"","template"=>"") ); 

or on post/page we can use [singlepic id=x w=width h=height mode=web20|watermark float=left|right]on content section

Did you like this? Share it:

How to redirect a page on joomla 1.6

by vinay on July 8, 2011

in Joomla

We can use the following example to redirect a page if user is logged in or not. The following code can be put on the corresponding components or on module.

$redirect_url = JURI::getInstance()->toString(); //this JURI::getInstance()->toString() gives site url. You can replace it with any of your required url like registration page.
	$user  = & JFactory::getUser();
	If ( $user->id ) {  //if user is logged in
		//do something
	}  else  {
		$redirect_url  =  str_replace('&','&', $redirect_url); // get rid of any ampersands
		$redirect_url  =  JRoute::_($redirect_url);
		$redirect_url  =  str_replace('&','&', $redirect_url); // get rid of any ampersands again
		$app  = & JFactory::getApplication();
		$app->redirect($redirect_url); //redirect
	}
Did you like this? Share it:

How to get category name and id on product page on Magento

June 9, 2011

On product page, generally its location is app/design/frontend/{designPackageName}/{themeName}/template/catalog/product/view, put the following code on addtocart.phtml file: Did you like this? Share it:Tweet

Read the full article →

How to show blank search on wordpress

June 8, 2011

By default, wordpress do not search for blank. It redirects to the home page for blank search. To prevent this we can use pre_get_posts hook. We can use pre_get_posts action to manipulate the query variables for specific pages. We can modify $wp_query object before any results are returned. In this example, we are using pre_get_posts [...]

Read the full article →

Add tinymce editor to wordpress form’s textarea field

June 7, 2011

Just make sure to use the id of the textarea you want to select in the elements: “elm1,elem2″ variable. Assuming you have a textarea with the id of ‘elm1′ and ‘elem2’: Put the following code into your functions.php of your theme file or you can use it on your plugin And the form should look [...]

Read the full article →

How to get total active members and total number of members in buddypress

May 8, 2011

The following example will count the total members: To get total active users, we can use following code: Did you like this? Share it:Tweet

Read the full article →

Some fun with regular expression

May 7, 2011

Show only numbers in a string Show only letters in a string Show only letters and numbers in a string Did you like this? Share it:Tweet

Read the full article →

How To Flush Permalink Structure in WordPress When Using custom Taxonomies …or what to do when WordPress custom Taxonomies show A 404 Page

May 5, 2011

I have faced many times that permalink for custom taxonomy wont work, rather it shows a 404 error page. Suppose you have custom taxonomy named as video and want to display a link as http://www.yoursite.com/videos but it shows page not found. I have listed some of the ideas to make that workable: We can create [...]

Read the full article →

Redirect subscribe user to home page

April 30, 2011

Using wordpress hook, we can redirect subscribed user after login to the desired page or home page: example: Did you like this? Share it:Tweet

Read the full article →

avoid user validation on buddypress

April 28, 2011

In buddypress, by default user becomes non active during registration. We can avoid the validation using hook as below in functions.php inside theme file: Did you like this? Share it:Tweet

Read the full article →