I have recently finished a WordPress project using NextGEN gallery plugin. With this great gallery managment plugin, you can quickly create highly customizable picture galleries for blogs. Only one thing is confusing for me: on the gallery/album pages this plugin transforms the page title to “Album 1″,”Gallery 1 ” etc. altough my gallery names is different.
I have found a solution for this case:
Edit “lib/rewrite.php” in the plugins directory at line about 198. This is the function generating the title.
The end of the funtion must like this. This will display the gallery name in the title:
//$title = $new_title . $title;
global $wpdb;
$nggalleryinfo = $wpdb->get_row("SELECT * FROM $wpdb->nggallery WHERE gid = '$gallery' ");
if(!empty($nggalleryinfo->title)) {
$new_title = $nggalleryinfo->title.' > ';
$title = $new_title . $title;
}
return $title;
If need the album name too, then use this code:
//$title = $new_title.$title;
global $wpdb;
$ngalbuminfo = $wpdb->get_row("SELECT * FROM $wpdb->nggalbum WHERE id = '$album' ");
$nggalleryinfo = $wpdb->get_row("SELECT * FROM $wpdb->nggallery WHERE gid = '$gallery' ");
if(!empty($ngalbuminfo->name)) {
$new_title = $ngalbuminfo->name.' > ';
$title = $new_title . $title;
}
if(!empty($nggalleryinfo->title)) {
$new_title = $nggalleryinfo->title.' > ';
$title = $new_title.$title;
}
return $title;
Tags: hack, nextgen gallery, plugin, title, wordpress