Dave Loodts
Forum Replies Created
-
Hello Scriptonite,
I was wondering if the new plugin that you mentioned in the previous message is ready ?
I could use such a plugin that shares files between specific users of usergroups.Thanks,
DaveForum: Plugins
In reply to: [WooCommerce] [Plugin: WooCommerce] Woocommerce usable as a print store ?Thanks ferrucio, i will check it out !
Forum: Plugins
In reply to: Searching images on ALT-text.Nope, i didn’t found my solution as wanted on the ALT-thing. But i made it to search for the description of the image. Also neat for me.
So, if you place the same text in the ALT and Description box; that’s solved it.here is the code i wanted to share:
Functions.php
function ngg_get_search_pictures ($keywords, $numberPicRow = NULL) { global $wpdb; $count=1; if (!$numberPicRow) { $numberPicRow = "4"; } $nngquery = " SELECT post_content, post_mime_type, ID, guid FROM wp_posts WHERE post_mime_type = 'image/jpeg' "; $pictures = $wpdb->get_results("SELECT * FROM wp_posts WHERE post_mime_type = 'image/jpeg' AND post_content LIKE '$keywords'", ARRAY_A); if ($pictures) foreach ($pictures as $pic) { $out .= '<a href="'.$pic['guid'].'" >'; $out .= '<img src="'.$pic['guid'].'" alt="'.$pic['post_content'].'" title="'.$pic['post_content'].'" height="80px" />'; $out .= "</a>\n"; if ($count == 0) { $out .= "<p> </p><br /><br /><br /><br />"; } ++$count; $count%=$numberPicRow; } return $out; };
And this in the search.php
<?php if(is_search()) { $search = $wp_query->get('s'); $keywords = preg_replace('/\+/',' ',$search); if (function_exists ('ngg_get_search_pictures')) { // function from functions.php $nggpictures = ngg_get_search_pictures($keywords, '4'); // put the number of pictures by row you want, if you don't want "4" if ($nggpictures) { echo "<h2>Search for pictures</h2>"; echo $nggpictures; echo "<p> </p><p> </p><p> </p>"; } } }
The result is the display of the images with the searched keywords in the description. If you don’t have a ‘screen-filled gallery’ plugin yet; you you can try Easy Fancybox.