• I know this has been asked before so I thought I would share how I do it.

    I added a tag cloud to my side bar and added a POST called ‘Custom Gallery’. Each time I add a new gallery and tag the pictures, I go to my ‘Custom Gallery’ post and add new tags there. Most the time the tag’s are already there anyhow, but I check. This way, my Tag Cloud will pick up my new tags.

    Then for the body of the post (I am using the exec-php plug-in) I put in:

    <?php
    if ($_REQUEST[“tag”] <> “”) echo “[tags=”.$_REQUEST[“tag”].”]”;
    ?>

    Works great. I am probably going to use the album tag if multiple tags are being searched. Makes more sense. I’ll have to replace the ‘+”s with ‘,”s when I do this in php.

    I would also like to figure out how to search tags like tag1+tag2 so the return is only the pictures that include both tags. Does anyone no how to do this?

    Thanks. Hopefully someone has the answer to multi taged custom galleries. Hope my code helps someone out there.

Viewing 15 replies - 1 through 15 (of 35 total)
  • Thread Starter realsol

    (@realsol)

    OK. I like this one better:

    <?php
    if ($_REQUEST[“tag”] <> “”)
    {
    $tags = str_replace(” “,”,”,$_REQUEST[“tag”]);
    echo ‘[albumtags=’.$tags.’]’;
    } else echo “NO PHOTO’s FOUND that match the TAG you clicked on.”;

    ?>

    But I still would like to be able to search for all tag’s combined instead of having two albums display. See me earlier post.

    Hi Realsol,

    Very Clever! Is it possible that you could show us an example of how it actually works from the front end?

    I have been looking for something like tag cloud for NextGen image tags too.

    Cheers,

    Eric

    Thread Starter realsol

    (@realsol)

    I am running a plugin call EXEC-PHP which allows you to input PHP scripts within the HTML portion of the page. You also have to run a plug-in that disables the Visual tab for that particular post or page (mentioned in the doc of EXEC-PHP). I just pasted the above code into the HTML portion and added a tag cloud widget.

    I guess it could be written as a plug-in so you could just add something like [nextgen-tagcloud]. Hey, that would be pretty slick for those that I know can’t turn on php scipts for their blog (like many WordPressMU users). Maybe I can put something together.

    Thanks mate,

    Hope you don’t mind me being a pain, but could you walk me through the setup?

    1. I have exec-php setup. It’s nice and working.
    2. I insert your php tag onto a post (here)
    3. how do I actually go from here?

    Any assistance will help,

    Cheers,

    Eric

    Mate, Not sure if you could give me a hand with this, but I am working on extracting all my tags from the database

    <?php
    
    	global $wpdb;
    	$sql = 'SELECT COUNT(*) FROM wp_ngg_tags ';
    	$count= $wpdb->get_var($sql);
    echo $count;
    echo "<hr>";
    
    for ( $counter = 1; $counter <= $count; ) {
    
    $row = 'SELECT name FROM wp_ngg_tags where id='.$counter;
    
    $name= $wpdb->get_var($row);
    
    echo $name;
    
    $counter=$counter+1;
    
    }
    ?>

    do you know why it doesn’t display all the tag names?

    Cheers,

    Eric

    Thread Starter realsol

    (@realsol)

    Yeah, I could probably mess things up…

    Since my nextGEN galleries are small right now, adding the individual tags is no problem for me. It would be nice though if you could pull all the tags. I just don’t have time to do it. I just manually added my tags to the post I created. Only about 10 galleries setup, so it was easy.

    I am hoping that someone will see this post and somehow add an option into the gallery that will basically do what I am doing with a ‘real’ shortcode built into nextGEN that won’t require me to update tags.

    I am still pretty much in the dark as to how yo got it to work! Seems real simple but just couldn’t figure it out.

    Do you have a post (titled Customer Gallery), which list all the tags, and create another post which includes your php.

    How come it doesn’t seem to connect the dots for me.

    Perhaps I am missing something from your method.

    E

    I’ve worked out to generate a list of tag for NGG and to link them to create post for tag when you do a ?tag=blad on URL.

    Will update in a few hours

    I have come up with

    • auto generate all tags from ngg database
    • auto generate images by tags

    First, you need to create 2 posts. One for generating all the tags, and one for displaying the images.

    Let’s begin.

    Below code loops through NGG’s tag database table to extract all tags onto a post. It creates a link for each of the tags generated. Obviously you need to change the address to make it yours. “image” is a category in my WP.

    <?
    global $wpdb;
    $results = $wpdb->get_results('SELECT name, slug FROM wp_ngg_tags');
    foreach ($results as $row) {
    
    echo "<a href=https://www.canberrapictorial.com.au/image?tags=";
    echo $row->slug;
    echo ">";
    echo $row->name;
    echo "</a> | ";
    }
    
    ?>

    Second, create another post with below PHP

    <?php
    if ($_REQUEST["tags"] <> "")
    {
    
    echo $_REQUEST["tags"];
    
    echo "[tags=";
    echo $_REQUEST["tags"];
    echo "]";
    
    } else echo "no images found via this tag";
    
    ?>

    Then you are good to go!.

    Have fun.

    updated the php in 1st post, to make it more “tag cloud”-like..

    <?php
    global $wpdb;
    $results  =$wpdb->get_results(
    		  ' SELECT tagid as tagID , count( tagid ) as tagCount , taggs.name as tagName, taggs.slug as tagSlug '
            . ' FROM wp_ngg_pic2tags picstags , wp_ngg_tags taggs '
            . ' where taggs.id = picstags.tagid '
            . ' group BY tagid ');
    foreach ($results as $row) {
    
    echo "<span style=\"font-size:". (1.6*(log((20000*($row->tagCount)))))."px;\"><a href=\"https://www.canberrapictorial.com.au/image?tags=".$row->tagSlug."\">".$row->tagName."</a></span>";
    echo " | ";
    }
    
    ?>

    it’s dumb, but any thoughts as to how it make the cloud not blown up of proportion if it gets too big in numbers?

    Tutorial

    Put together something to assist perhaps someone wanted to use tag cloud for NGG.

    Thread Starter realsol

    (@realsol)

    Looks good. You could use the tag plugin I am using, SensitiveTagCloud Widget which lets you ‘drill down’ your tags. Search the plug-in’s for a better description.

    You would need to use your php to update the ‘tags’ portion of the page that you want to display your pictures using the codex. But all the tags would be the same size.

    You idea is good, but I would probably make it only one page instead of 2 pages and have it call itself. With a little code changes you could actually create your own ‘drill-down’ method.

    Very interesting addon !!! I will see to get tag clouds working after release of v1.00, because then the tags are sync with the WordPress Taxonomy

    Thread Starter realsol

    (@realsol)

    That would be GREAT! One thing I can’t figure out to do, although I haven’t tried querying the database like yyeric, I would like to be able to drill down my tags.

    I am using SenisitiveTagCloud which allows my to drill down WordPress tags, basically showing it the url ‘tag=joey+birthday+family’ and display’s only posts related to all the tags. Right now, nextGEN tags using ‘[tags=item1, item2, item3 …]‘ display individual galleries, on for each tag, or ‘[albumtags=item1, item2, item3 …]‘ in album format. it would be great if a user is using a plugin like SensitiveTagCloud to be able to drill down their nextGEN gallery.

    Right now, I have tagged all of my pic’s by year, event, person …. I get 3 different galleries. Still makes it easier to find what I am looking for, but the drill-down would be great! Basically a built-in keyword search of all your pictures.

    And since WordTube also supports tags, this might also work for it (although I put each individual video on its own post with tags, using the tag cloud to drill down those).

    OK. Someone stop me. I’m on a roll.

    If tags were available for each album and each gallery + the individual pictures (already there), you could have a new shortcode called [nextgen=item1, item2, item3 ….]. Here is the logic.

    Still using a SensitiveCloudWidget,

    • 1st tag: Search for albums with matching tag. If no matches, search the galleries for the tags. If no gallery matches searches the pictures for the tags.
    • 2nd tag: Search for all galleries within that album with matching tags. If no matches, searches individual pics.
    • 3rd tag, 4th tag, 5th tag….: Search for all pictures with matching tags within the matching gallery + only displays the pictures that included all of the tags for picture drill down.

    I organize all of my albums by year and my galleries by event. But this would be great also for people selling pictures.

    Whew… Sorry for all of the text. I love nextGEN so much. I am running WordPressMU for my business and my family and won’t let them install any other plug-in. The only thing I found that it lacks is any sort of dynamic searching capabilities, but has all the tags in place to do it.

    Alexrabe, please let me know what you think.

    Thanks for your time and hard work.

Viewing 15 replies - 1 through 15 (of 35 total)
  • The topic ‘[Plugin: NextGEN Gallery] I now am displaying pic’s from a tag cloud!’ is closed to new replies.