Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Comments, trackbacks & pings (http://forum.bytesforall.com/forumdisplay.php?f=19)
-   -   Problem with Comment Form Anchor Link (http://forum.bytesforall.com/showthread.php?t=5199)

adum Jan 7, 2010 11:31 PM

Problem with Comment Form Anchor Link
I am trying to insert this link into my post footer to jump to the comments form, but the link gets changed once I load it on my site...

<a href="#commentform">Skip to comments form</a>

essentially gets changed to:

<a href="\commentform">Skip to comments form</a>

In the link on the page, the # gets changed to a \. What can I do to fix this? Thanks.

juggledad Jan 8, 2010 02:19 PM

what version of Atahualpa and WP?
What is the URL?
Are you using any plugins for comments?

adum Feb 20, 2010 04:54 PM

I never figured out a solution to this problem and ended up just using a workaround, but now I can't get around the issue.

I realized the problem is that in the "Post/Page Info Items", "#" is used to escape certain letters, and thus gets converted to "\" in the URL.

I can use anchor links with # in the center column, and they are fine, it's just fact that I am trying to use them within the Post/Page Info Options of ATO. (I turned all plug-ins off btw, so this has got to be Atahualpa.)

Any way to get around this? I am extremely suprised that this was never caught before.

I am using 3.4.5 and WP 2.9.2. My site is http://www.adamcapriola.com
EDIT: I switched my Disqus plugin back on which alleviates the error to an extent.

You can see in the "Leave a Comment" link it looks like this: "http://www.adamcapriola.com/\dsq-new-post" when it should be "http://www.adamcapriola.com/#dsq-new-post"

Thanks in advance JD/Flynn!


adum Feb 20, 2010 06:04 PM

Alright well I tried looking into the problem a little more, seems like a pretty deep issue.

I tried using the HTML character entity for "#" which is "&#threefive;" (couldn't type 35 here because it got converted) in the URL, but all #'s are converted to \ so it doesn't work. # doesn't have a HTML name entity either like &nbsp; which would work.

Something in the functions has be changed I think.

EDIT: Guessing the change has to be made in bfa_ata_admin.php or functions.php. I am just not familiar enough with how to fix this thing myself.

juggledad Feb 21, 2010 12:34 PM

Ok, this is messy but fixable.

The problem here is that the '#' is used as the php DATE escape character in the Atahualpa options. Because the php DATE() function has so many options and each needs to be escaped, so when the footer (or kicker or title) is being displayed, all occurrences of '#' are changed to '\' leading to this problem. But take heart, there is a way to make it work.

change the last line of bfa_postinfo.php from
HTML Code:

HTML Code:

function getH() {
        global $bfa_ata, $post;

next change your post footer from
HTML Code:

<a href="#commentform">Skip to comments form</a>
HTML Code:

<?php echo '<a href="'.getH().'commentform">Skip to comments form</a>'; ?>
and you should be ok.

adum Feb 21, 2010 04:00 PM

You da man Juggledad, that fix looks great. I'll try it out in a bit, pretty sure it will work. :)

adum Feb 22, 2010 08:27 PM

errr didn't work. This is now my URL:


Would it be easier to turn off the # converting to \ for the date and just use a different convention for the date?

P.S. Tried this fix on my site that is using 3.4.4...that shouldn't make a difference though, should it?'

EDIT: What if I just delete this line:


$postinfo_string = str_replace("#", "\\", $postinfo_string);
from postinfo.php? And then insert \ instead of # wherever I use it in the date? Seems kinda weird to even replace \ with # in the first place.

EDIT 2: Ok well I deleted that line and my URLs are cool and my date still works...is there any backlash to making this change? Would it be better to just choose a different arbitrary character instead of # to replace?

juggledad Feb 23, 2010 06:01 AM

did you wrap the code I gave in the php echo? and make sure the single quotes and double quotes were in the correct places. This code worked for me.

If you fix works without any problems, use it.

litbea Mar 7, 2010 09:28 AM

Seems to be working for me...
Thanks a lot!

gungo Apr 2, 2010 08:53 AM

This solution worked perfectly for my site as well... Thanks!
Will make another donation for saving me lots of work!

c4duser Jul 5, 2010 09:59 AM


next change your post footer from
HTML Code:

<a href="#commentform">Skip to comments form</a>
HTML Code:

<?php echo '<a href="'.getH().'commentform">Skip to comments form</a>'; ?>
and you should be ok.
I had the same problem, but in the byline for single page posts. The above code does not work with disqus because the id of the form title is not 'commentform' but rather 'dsq-new-post'. However, changing the code as follows, seems to work:


<?php echo '<a href="'.getH().'dsq-new-post">Skip to comments</a>'; ?>
I still have a problem with the comment link on the front pages (excerpts) byline which does not go to the form, but to the top of the full article page. This is not so bad with the above correction, but it would be nicer to go directly to the form.

If you want to link to jump to the Disqus logo with the 'like' buttons, use 'dsq-community' instead of 'dsq-new-post'.

Thanks for the code, Juggledad!

scrollpost Dec 9, 2010 07:11 PM

I just used this fix. Thanks...

One suggestion: there is a partial explanation on the page but it's not clear. I would add to the page something like this -

To use named anchors from a Post/Page Info Items section please add the following:
For a named anchor like this


<a href="#name">Go to name</a>
use this syntax


<?php echo '<a href="'.getH().'name">Go to name</a>'; ?>

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

Powered by vBulletin® Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.