How to hide Facebook Comments count if post has no comments yet - comments

I have configured my web application to display Facebook comments and comment count in the post details template... It is displaying perfectly when there is a comment, but I would like to hide the "x Comments" part when there is no comment posted.
< fb:comments-count href="[ARTICLELINK]"/>< /fb:comments-count> Comments
This is my template to display the comment count...
In my application's own comments feature, I could use the [hascomments][commentcount]Comments[/hascomments] template...
However, I couldn't find which token to use for Facebook comments.

The span is given the class 'fb_comments_count_zero' if there are no comments, so you can set that class to be display:none in your styleshet

Put the above code you have into a div with an id="hideMeIfZero". After Facebook has had time to parse the fb:comments-count tag, then use JavaScript to parse the innerText of the div "hideMeIfZero" for the count.
If the count is 0, then hide the div using CSS.

Related

Setting Mailchimp campaign content html not working

I tried to update my campaign html content using mailchimp api:
/campaigns/{campaign_id}/content
You can find more information about this api here: https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/content/#
Before sending a campaign, I tried to get campaign content html, modified it and then set campaign content html using above api. I just simply use BeautifulSoup to append a new tag to content body:
content.body.append(BeautifulSoup('<p>Mailchimp is freaking shittttt</p>'))
Then, some interesting things happen, the first campaign I created, it works fine, the tag added appears in my email. But, then the sub-sequence campaigns not working anymore, the tag added not appearing.
I observed something strange on my mailchimp campaign site, even though I set campaign html content, only Plain-Text Email gets changed (HTML Source still the old version) for both working and not working campaign.
Anyone got this issue before?
I had a similar issue and I had to take a slightly different approach to solve it. According to this answer by Joel H., "MailChimp doesn't allow updating the campaign's HTML content because the campaign type is based on a template. In order to update the HTML content, the campaign has to be set to custom HTML instead of a template."
That solution didn't suit me but it led me to another solution: creating a template, creating editable content areas within that template, and then using the API to retrieve and edit the text in those content areas.
Here is an attempt at adapting my code to solve your problem. I'm using Python 3 and the mailchimp3 client.
default_footer_content = client.templates.default_content.all(template_id=TEMPLATE_ID)['sections']['SECTION_NAME']
new_footer_content = default_footer_content.replace(PLACEHOLDER, 'Mailchimp is freaking shittttt')
client.campaigns.content.update(campaign_id=CAMPAIGN_ID, data={'template': {'id': TEMPLATE_ID, 'sections': {'SECTION_NAME': new_footer_contennt}}})
Some pointers on the above code:
You can find TEMPLATE_ID with the API or simply by copying the numbers at the end of the URL when editing the template in the web interface
You define SECTION_NAME by placing 'mc:edit="SECTION NAME"' in the appropriate place in the template
I've used .replace() rather than .append() so you will need to put PLACEHOLDER or similar at the appropriate place in the template
I hope that helps, happy to modify my answer if it needs more clarification. This is my first answer on Stack Overflow so constructive criticism appreciated :)

Magento Anchor Tags

I have a list of FAQ links on my home page in a static block in the footer. Each link however just opens up the FAQ page.
My code sample
What is Individually Quick Frozen?</li>
What I want is that when a user clicks a particular link in the list on the homepage footer under FAQs (as above), the user should be directly be taken to the answer of that question on the FAQ page i.e. the page should scroll down to where the questions is answered.
My Code sample
<p><strong><a id="1">What is Individually Quick Frozen?</a></strong></p>
But no joy! what am I doing wrong?
Make your link look like this:
What is Individually Quick Frozen?</li>
or better yet
What is Individually Quick Frozen?</li>
Note: For Cms pages urls use direct_url as a parameter for the {{store}} directive. It avoids having a / at the end of the URL. Useful if your pages end with .html. It's not your case but it may be useful in the future.
Now your code in the cms page should looks like this:
<p><strong><a id="_1">What is Individually Quick Frozen?</a></strong></p>
Avoid using numerical ids for elements. It's not standard
Worked perfectly, be sure to update
<a href="{{store url="faqs"}}#_1">
"faqs" to what ever page you want your tag to land on though.

How do you display the Disqus comment count in two places on the same page/post?

I placed the Disqus comment count in two separate places on my post pages. One comment count is below my post title and the other is in a floating div off to the left of my post body. The comment count only appears one time (only in the floating div to the left of my post body).
I never realized one, for lack of a better term, cancels the other one out. I know there are some scripts that can only be "placed" once on a page. Could Disqus be that kind of script??!!
Or, am I doing something wrong? If so, what should I do to get BOTH comment counts to be displayed on the same post page?
Can't post the link to my site -- work in progress.
Please let me know. Thanks in advance! :-)
As long as you have the count.js script on your page, it will find and replace all links that either:
a. End with #disqus_thread in the href tag
b. Have a valid data-disqus-identifier attribute value (this corresponds with the disqus_identifier if you set one)
If that's the case, you may want to check out the placement on the page itself and make sure count.js loads after those links have been rendered.
These concepts are explained in some more detail here: http://help.disqus.com/customer/portal/articles/565624

Tumblr: how do I remove the description/sidebar box on the submit page in the default Peter Vidani theme?

I have a tumblr account that has submission enabled, and I have a short description with a form in the "description" area that appears on the sidebar. However, this description also appears on myblog.tumblr.com/submit. I'd like to remove it.
I looked at the documentation on http://www.tumblr.com/docs/en/custom_themes#navigation, but haven't been able to figure out how to prevent the sidebar description from showing at the top of the submit page.
Can anyone help?
I'm not sure if I understood your question correctly. But if I did, a work around would be using jQuery to check if the current url contains the string /submit and simply disable the sidebar, or the element that contains the description.
I don't know jQuery but I know it's possible. I'd suggest you to look into this post:
How to check if the URL contains a given string?
and combine it with this line (replace the "alert part")
$("#sidebardescription).hide();
Another solution would be if Tumblr provided you with a way to only render for specific pages. They usually do that. I'd look into this part {block:SubmissionsEnabled} {/block:SubmissionsEnabled} before I go with the workaround.

How to put divs for text field and button in one line for mailchimp signup form that is in a table?

I've been trying to amend the code provided by Mailchimp which is included on a site I'm developing for the mailing list form.
Basically the code is included within a table and the Mailchimp code is in one cell of the table. The content is title, box to enter email address and "Submit" button. I would like to amend the code so that the contents of the cell are all on one line rather than under each other as is the current case.
The code and CSS can be found here http://jsfiddle.net/surfersteve1970/x9QLP/
Hopefully I've just done something stupid, as is often the case, but after hitting my head on my desk for the last hour I thought it best to try and ask for some help rather than cause further brain damage.
Thanks in anticipation of any help.
Steve
http://jsfiddle.net/iphipps/CLFBj/1/
Both the email and button inputs were being displayed as block and not floated or displayed inline. The code below worked for me.
#mc_embed_signup input.email{
display:inline-block;
}
#mc_embed_signup input.button {
display:inline-block;
}
Note: in the attached jsfiddle, I changed the display on both selectors, then added the code below after a comment. For some reason jsfiddle doesn't seem to like css cascaded overrides.

Resources