Single Image Voting- Non coders READ THIS
-
For all you non coders out there, I want to share how I got voting to work for a single image. Still have to work through a couple of issues, but thought this would help some people…
First you need to enable the voting by inserting the tag, stated in the faq, into the php file you are going to use. As I was going through the support forum, I felt bad for the author due to ignorance of all of us non-coders. So I am going to help explain. Lets start with getting the voting to work with basic thumbnail gallery. This will help you understand how everything works. In order to get to the php file, you need to go through the backend of the domain. If wordpress is your supporting domain, I don’t know how to access that. I am using bluehost, so I am going to tell you how I did it. I logged into my bluehost account and chose the hosting tab which brings up all different services they provide. Under File Management, I clicked on File Manager. From there, I clicked on public_html. Then click wp-content, plugins, nextgen-gallery, products, photocrati_nextgen, modules. Then scroll down until you see nextgen_basic_gallery, click and then choose templates, thumbnails. When you click thumbnails you will see an index.php file on the right. Click once so its highlighted and at the top of the page you will should see a code editor button. Click that and it will open the page on a separate tab. I had a hard time editing the code initially, so I clicked the button at the top which said text editor. From there I looked for the code that was stated in the fact. Here is what the code should look like:
<div class=”ngg-gallery-thumbnail”>
get_image_url($image, ‘full’, TRUE))?>”
title=”<?php echo esc_attr($image->description)?>”
data-src=”<?php echo esc_attr($storage->get_image_url($image)); ?>”
data-thumbnail=”<?php echo esc_attr($storage->get_image_url($image, ‘thumb’)); ?>”
data-image-id=”<?php echo esc_attr($image->{$image->id_field}); ?>”
data-title=”<?php echo esc_attr($image->alttext); ?>”
data-description=”<?php echo esc_attr(stripslashes($image->description)); ?>”
<?php echo $effect_code ?>>
<img
title=”<?php echo esc_attr($image->alttext)?>”
alt=”<?php echo esc_attr($image->alttext)?>”
src=”<?php echo esc_attr($storage->get_image_url($image, $thumbnail_size_name, TRUE))?>”
width=”<?php echo esc_attr($thumb_size[‘width’])?>”
height=”<?php echo esc_attr($thumb_size[‘height’])?>”
style=”max-width:none;”
/>
</div>
<?php echo nggv_imageVoteForm($image->pid); ?>
<?php$this->end_element();
?>
</div>Make sure you save the changes. Now, voting should work for the basic thumbnail gallery. I just played around with this in the different form templates until it worked for me. If you are nervous about changing the code, just save the file to your computer so you can look at it later or change it back.
Now how I did it for a single image, still in the file manager nextgen plugin folder, I scrolled down to the ngglegacy folder clicked the +, and choose the view folder. From here I clicked on the singlepic.php file on the right and went into the code editor… This is what your code should look like…
?>
<?php if (!defined (‘ABSPATH’)) die (‘No direct access allowed’); ?><?php if (!empty ($image)) : ?>
imageURL); ?>”
title=”<?php echo esc_attr($image->linktitle); ?>”
<?php if(!empty($target)) { ?>target=”<?php echo esc_attr($target); ?>”<?php } ?>
<?php echo $image->thumbcode; ?>>
<img class=”<?php echo $image->classname; ?>”
src=”<?php echo nextgen_esc_url($image->thumbnailURL); ?>”
alt=”<?php echo esc_attr($image->alttext); ?>”
title=”<?php echo esc_attr($image->alttext); ?>”/>
<?php echo nggv_imageVoteForm($image->pid); ?>
<?php if (!empty ($image->caption)) : ?><span><?php echo $image->caption ?></span><?php endif; ?>
<?php endif; ?>Once I got the php file updated, I went to my page and I tried a couple of different options. I used the wordpress media uploader and choose a pic from nextgen gallery and then I used a shortcode like this,
[ngg_images image_ids=”10″ display_type=”photocrati-nextgen_basic_singlepic”]
Both of them seemed to work!
I would have inserted screen shots in this post, but I don’t see an option to add images.
Now I got the single image voting to work, I have to figure out how to tweak the formatting. I would like to add a description of the pic and figure out where I want the voting, thumb up and thumb down to be in relation to the pic.
Anyways, hope this helps some people.
The topic ‘Single Image Voting- Non coders READ THIS’ is closed to new replies.