WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: NextGEN Gallery] permalink (6 posts)

  1. gordon34
    Member
    Posted 4 years ago #

    Hi there!
    I've got a question, pretty simple or for someone maybe not.
    in the plugin settings are the field with the permalink stuff.
    when i activate this my galeries have some awful adress ie. album-1/gallery-88/page-1

    how and where paste some code to make my links like that /albumName/galleryName/

    Give a hint
    thanks in advance,
    Greetz!
    Kamil

  2. jennybeaumont
    Member
    Posted 4 years ago #

    are your permalinks set in general wp settings options?
    not sure that hads anything to do with, but my nextgen links are fine...

  3. grezvany13
    Member
    Posted 4 years ago #

    Hi Gordon,

    it's a known 'problem' that the url's don't look as nice as it should. And at this time no solution is available. The biggest problem is that NextGen uses it's own router class (/lib/rewrite.php), which is required to show multiple pages within a plugin. This means that (no matter what) the base URL of the plugin is /nggallery/ and then a bunch of ugly stuff (from "/page-X/" to "/post/X/album-X/gallery-X/page-X/slideshow/").

    At this moment I'm working on a new router class which fixes most problems (eg use the page/category/post name as base url) and let it use the same (permalink) settings as the WordPress installation itself, though it's more complex as it looks.

    When as working version is ready I'll contact the NextGen developer(s) and post the fixes at these forums and maybe it will be included in one of the next versions.

    Though, if you're a skilled PHP programmer and find a solution yourself, I'll be happy to use the fix ;)

  4. grezvany13
    Member
    Posted 4 years ago #

    Here's one of the scripts I build for the new router:

    $id = get_the_ID();
    if(is_page($id)) {
    	$post = &get_page($id);
    } else {
    	$post = &get_post($id);
    }
    if($post->post_parent){
    	$ancestors = get_post_ancestors($post->ID);
    	foreach($ancestors as $ancestor) {
    		if($ancestor->ID == $id) continue;
    		$ancestor = &get_post($ancestor->ID);
    		$slug .= $ancestor->post_name.'/';
    	}
    }
    $slug .= $post->post_name . '/';
    $url = get_option('home') . '/' . $slug;

    What does it do?
    It fixes the problem where the gallery on a page ALWAYS uses the page_id, while in a post it can use page_name.

    Please note: you can't use this snippet yet, since it requires more code to be altered (like the rewrite rules). Although it will give you an idea of some 'new features' I'm building ;)

  5. grtwordpress
    Member
    Posted 4 years ago #

    Using the built-in paging convention works for my needs. I just changed the pagination code to add /X. See if this is to your taste and I can share how I did it.

    http://photoblog.torralba.us/photo-gallery/2009_kite-festival

    I've ajax'd the pagination too so although the above url will work with a /X for a specific page, paging through the gallery won't change the URL in the browser's address bar.

  6. anngel
    Member
    Posted 4 years ago #

    hi grtwordpress,
    will be glad to find out how you did it.
    thanks a bunch.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags