Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Avada theme, a portfolio feature modification help WordPress

  • SOLVED

The famous Avada theme portfolio images with a Facebook like counter, but they all are counted in the same counter, it means all the Facebook likes in a portfolio page will be counted in 2 counters which is zero or all-likes on the page.

Here is what I meant:

1)
Before you give a like:
http://i.gyazo.com/e63d7fb18f3594ab1b3ea9abb2032311_1.png

2)
After you gave a like:
http://i.gyazo.com/8618f098160383e756a6f4f31b8429e9_1.png

3)
And you reload it:
http://i.gyazo.com/fc7f9f50fa535037eefe793d09f38a10_1.png
The 5 likes is all the likes on the page.

You may check the issue here:
http://theme-fusion.com/avada/3-column-grid/

This is just not what I thought about,
<strong>I am looking for someone help me to make the like counter of portfolio images counts individually in every image.</strong>

I like to pay for this job for $50 if someone can do this immediately.(I will add another $45 if it fix)

Answers (1)

2014-11-18

Dbranes answers:

For the first gallery item, it looks like the Facebook iframe url is:

http://theme-fusion.com/avada/3-column-grid/#prettyPhoto[gallery]/0/


but I think this is just the same as:

http://theme-fusion.com/avada/3-column-grid/


so all the counting goes to this page and not the gallery item.

So instead you should use:

http://theme-fusion.com/avada/portfolio-items/mauris-ultricies-ipsums/?portfolioID=10879


for the Facebook iframe url.

So it looks like this could be the problem.

<strong>Update:
</strong>

This is the part of prettyPhoto setup in the theme (here's the [[LINK href="http://theme-fusion.com/avada/wp-content/themes/Avada/js/main.js?ver=3.6.2"]]file[[/LINK]])

if(jQuery().prettyPhoto) {
var ppArgs = {
overlay_gallery: Boolean(Number(js_local_vars.lightbox_gallery)),
autoplay_slideshow: Boolean(Number(js_local_vars.lightbox_autoplay)),
show_title: Boolean(Number(js_local_vars.lightbox_title)),
show_desc: Boolean(Number(js_local_vars.lightbox_desc)),
deeplinking: Boolean(Number(js_local_vars.lightbox_deeplinking)),
};
if(js_local_vars.lightbox_animation_speed) {
ppArgs.animation_speed = js_local_vars.lightbox_animation_speed.toLowerCase();
}
if(js_local_vars.lightbox_slideshow_speed) {
ppArgs.slideshow = js_local_vars.lightbox_slideshow_speed;
}
if(js_local_vars.lightbox_opacity) {
ppArgs.opacity = js_local_vars.lightbox_opacity;
}
if(!Boolean(Number(js_local_vars.lightbox_social))) {
ppArgs.social_tools = '';
}

jQuery("a[rel^='prettyPhoto']").prettyPhoto(ppArgs);


<strong>Update #4:</strong>

So just to wrap it up, we only needed to add this line:

changepicturecallback: wpq_picture_callback,

to the prettyPhoto arguments (ppArgs) and where the corresponding <em>wpq_picture_callback()</em> function callback is defined:


function wpq_picture_callback() {
var src = jQuery("#fullResImage").attr( 'src' );
if( src != undefined ) {
var link = jQuery("a.gallery-icon[href='"+src+"']").prev("a.link-icon").attr("href");
if( link != undefined ) {
jQuery(".pp_social .facebook iframe").attr( 'src', 'http://www.facebook.com/plugins/like.php?locale=en_US&href='+link+'&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23' );
}
}

// Debug:
console.log( 'src: ' + src );
console.log( 'link: ' + link );
}



<strong>Update #5.</strong>

ps: Here's the replacement code:


function wpq_picture_callback() {
var src = jQuery("#fullResImage").attr( 'src' );
if( src != undefined ) {
var link = jQuery("a.gallery-icon[href='"+src+"']").first().prev("a.link-icon").attr("href");
if( link != undefined ) {
jQuery(".pp_social .facebook iframe").attr( 'src', 'http://www.facebook.com/plugins/like.php?locale=en_US&href='+link+'&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23' );
}
}

// Debug:
console.log( 'src: ' + src );
console.log( 'link: ' + link );
}

if(jQuery().prettyPhoto) {
var ppArgs = {
overlay_gallery: Boolean(Number(js_local_vars.lightbox_gallery)),
autoplay_slideshow: Boolean(Number(js_local_vars.lightbox_autoplay)),
show_title: Boolean(Number(js_local_vars.lightbox_title)),
show_desc: Boolean(Number(js_local_vars.lightbox_desc)),
deeplinking: Boolean(Number(js_local_vars.lightbox_deeplinking)),
changepicturecallback: wpq_picture_callback,
};
if(js_local_vars.lightbox_animation_speed) {
ppArgs.animation_speed = js_local_vars.lightbox_animation_speed.toLowerCase();
}
if(js_local_vars.lightbox_slideshow_speed) {
ppArgs.slideshow = js_local_vars.lightbox_slideshow_speed;
}
if(js_local_vars.lightbox_opacity) {
ppArgs.opacity = js_local_vars.lightbox_opacity;
}
if(!Boolean(Number(js_local_vars.lightbox_social))) {
ppArgs.social_tools = '';
}

jQuery("a[rel^='prettyPhoto']").prettyPhoto(ppArgs);



Bard comments:

Yeah, the author team told me that this is not a bug, it just works as they expected.
But I want it counts in every image.


Dbranes comments:

Did you get any info where this was defined?

It looks like there's some prettyPhoto setup in this file:

http://theme-fusion.com/avada/wp-content/themes/Avada/js/main.js?ver=3.6.2

with

jQuery("a[rel^='prettyPhoto']").prettyPhoto(ppArgs);


Dbranes comments:

In prettyPhoto there's an option like this one:

social_tools: '<div class="pp_social"><div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&href='+location.href+'&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div></div>' /* html or false to disable */


that seems to control this part. Notice the default <em>href </em>part is<em> location.href</em>.


Dbranes comments:

You could also try for example the prettyPhoto argument::

deeplinking: true


as mentioned [[LINK href="http://stackoverflow.com/questions/17190154/prettyphoto-social-tools-do-not-share-lightbox-deep-link"]]here[[/LINK]].


Bard comments:

Can you tell me something replace and see if it works?


Dbranes comments:

ok, see update #2 for an example to try.


Dbranes comments:

ok, I think I found a way to link to the attachment url instead of the image source as in update #2.

check out update #3 - this should work for images.


Bard comments:

Not working by the update#2,
It than display like this:
http://i.gyazo.com/fcef3853c0e66532317025ce0018ef9c.png


Bard comments:

Didn't see update#3


Dbranes comments:

just added it ;-)

ps: the test in update#2 was to display the full image src in text. I can see that worked on your screenshot ;-)


Bard comments:

Hey, it works!
Let me do more test the mean time.


Bard comments:

Hi Dbranes, in no more than 3 days see if it works normally, then I will add $45 as I promised.


Dbranes comments:

ok great ;-)


Bard comments:

Hi, where to add this line in the update#4?


Dbranes comments:

ps: just add it to this part:

var ppArgs = {
overlay_gallery: Boolean(Number(js_local_vars.lightbox_gallery)),
autoplay_slideshow: Boolean(Number(js_local_vars.lightbox_autoplay)),
show_title: Boolean(Number(js_local_vars.lightbox_title)),
show_desc: Boolean(Number(js_local_vars.lightbox_desc)),
deeplinking: Boolean(Number(js_local_vars.lightbox_deeplinking)),
};


Bard comments:

oooops, I am not a js engineer, could you please update it for #5 with whole code for me?
I dont know if I should add it before it or after it:|


Dbranes comments:

sure, I just updated the answer.


Bard comments:

Thank you, it seems to work normally, I have added extra $45 as promise:)


Bard comments:

Hi Dbranes,

In the mobile view, the portfolio item will not work in lightbox, so the like button with counter will not display.

Can you make it work in the mobile view? make the lightbox work in any screen size but must keep all the counting number stay it's number.
I will add another $15.

<strong>Please tell me if it is possible before start it.</strong>