WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] photo galleria exclude (3 posts)

  1. lassepappa
    Member
    Posted 2 years ago #

    Hi i just added exclude to photo galleria incase anyone can use this here is how its done.
    1. In the function : photo_galleria_shortcode in photo-galleria.php in wp-content>plugins>photogalleria add

    'exclude' => $exclude, around line 453. This handles the call exclude from your shortcode.

    2. Then add &exclude => $exclude on line 457 like so:
    $attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby={$orderby}&exclude => $exclude");

    3. Then i simply wrapped the html output in a if statement like so:

    if($exclude != $id){
    		$output .= "\n\t\t<div>";
    		$output .= "\n\t\t\t<a href='".$img."'>";
    		$output .= "\n\t\t\t\t<img src='".$thumb."' longdesc='".$permalink."' alt='".$description."' title='".$description."' />";
    		$output .= "\n\t\t</a>";
    		$output .= "\n\t\t<strong>".$title."</strong>";
    		$output .= "\n\t\t<span>".$description."</span>";
    		$output .= "\n\t\t</div>";
    	}

    Maybe not the cleanest hack but it does the trick.
    I based it on this thread:
    http://dojo.codegreene.com/2009/filter-images-from-wordpress-gallery/

    Hope this helps someone.

    [sig moderated as per the Forum Rules]

  2. Fred Rocha
    Member
    Posted 2 years ago #

    Thanks a lot for sharing this tweak, lassepappa! Very useful, indeed.

    Just a minor correction. Because you are already excluding posts from the exclude list, the last part of the code:

    if($exclude != $id){
    
    [...]
    
    }

    is redundant.

    Otherwise, great job!

    I also added the possibility of having the galleria show on pages and custom types, besides showing on posts.

  3. wycks
    Member
    Posted 2 years ago #

    Just wanted to add that it should be &exclude={$exclude} not &exclude => $exclude on line 458 for the get_children. At least that is what worked for me.

Topic Closed

This topic has been closed to new replies.

About this Topic