Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 9th Sep 2010, 04:09 PM   #1
Watching you...
War Room Member
 
Istvan Horvath's Avatar
 
Join Date: 2008
Location: Waterdown, Ontario, Canada
Posts: 8,208
Thanks: 2,059
Thanked 3,699 Times in 2,243 Posts
Blog Entries: 2
Default
Quick JS help/job
Share on: 
fb share twitter share gplus share more share

I suck at JS...

Here is what I need:

Setup - WP blog, comments are allowed, not moderated.

When a visitor submits a comment (i.e. clicks the Submit button) and the comment goes through - I need a one-line code to appear above the comment form. It will be an anchor tag displaying a link.

The idea is the blog post will about a discount sale but they need to comment to get the link

PM me if you can help!

Thanks

Istvan Horvath is offline  
Unread 9th Sep 2010, 07:32 PM   #2
Web Developer
 
Join Date: 2010
Location: Wisconsin
Posts: 322
Thanks: 2
Thanked 80 Times in 74 Posts
Default
Re: Quick JS help/job
Share on: 
fb share twitter share gplus share more share

Will it be one link for all posts comments or different for each.

Example,
If I post a comment on the post Test Post one
and a comment on Test Post two

Will I get the same link?

If not and it is a specialized link for each post then it gets more complicated.

phpbbxpert is offline  
Unread 10th Sep 2010, 10:26 PM   #3
Watching you...
War Room Member
 
Istvan Horvath's Avatar
 
Join Date: 2008
Location: Waterdown, Ontario, Canada
Posts: 8,208
Thanks: 2,059
Thanked 3,699 Times in 2,243 Posts
Blog Entries: 2
Default
Re: Quick JS help/job
Share on: 
fb share twitter share gplus share more share

One link for all. It is a temporary thing, e.g. leave a comment and you will get the discount coupon (or something like that).

I can do it on a simple html page but cannot make it work on a WordPress comment.

Istvan Horvath is offline  
Unread 10th Sep 2010, 11:03 PM   #4
Web Developer
 
Join Date: 2010
Location: Wisconsin
Posts: 322
Thanks: 2
Thanked 80 Times in 74 Posts
Default
Re: Quick JS help/job
Share on: 
fb share twitter share gplus share more share

I have worked this out in PHP, if it will work for you

Add this code to the end of your active themes functions.php
PHP | function comment_extras ($loca - Content on Comment Submit - dgUuq7wJ - Pastebin.com


Then add this to your templates that you have comments open on
eg, page.php single.php

I put it after the container div for the previous and next links
PHP | <?php if (isset($_GET['thanky - Content on Comment Submit - w9GED2x3 - Pastebin.com

Then in the same templates (outside the loop, before the <?php if(have_posts()) add this jQuery code
Note: if you don't have jQuery in your theme you will need this line
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/JavaScript"></script>

Here is the complete jQuery
JavaScript | <!-- If you don't have jQuery - Content on Comment Submit - Df9KF4W9 - Pastebin.com

What it does is animate the box to hidden after about 8 seconds

Good Luck

phpbbxpert is offline  
Closed Thread


Bookmarks

Tags
help or job, javascript, quick


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 02:52 PM.