Links on a new page
-
Can someone please help me? in my comments, the author’s (site link) opens up in my comments pop-up. how can i code it so it opens in a new page?
Any help would be appreciated.
Thanks
-
Uzma,
There should be something such as:
<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /> <label for="url"><small>Website</small></label></p>
located in your comments.php.
Changing it to:
<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" target="_blank" /> <label for="url"><small>Website</small></label></p>
Should fix it.
Hope this helps!
-Ryan
I tried that but it didn’t work.
https://suddenly-alone.net/wp/?comments_popup=3
if you click on the name, it doesn’t seem to work. it still opens in the pop-up.
Meh it looks like I chose the wrong place to insert that _blank.
This looks like it should work after referencing your site to comments.php. You have some custom things already in your php, but I’m sure you will be able to figure it out with this.
<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>"> <cite><a target="_blank" href="<?php comment_author_link() ?>"></cite> Says: <?php if ($comment->comment_approved == '0') : ?> <em>Your comment is awaiting moderation.</em> <?php endif; ?> <br />
where am i putting this code?
It’s in your comments.php file. You’ve already custom coded some of your comments.php so it’s going to look a little different. You want to find
<?php comment_author_link() ?>
and make it
<a target="_blank" href="<?php comment_author_link() ?>">
I’ve tested it on my local machine and it seemed to work.
-Ryan
I think i’m going nuts or something.
I have this code:
<p><input type="text" name="url" id="url" value="<a>" size="22" tabindex="3"/> <label for="url"><small>Website</small></label></p> <?php endif; ?>
is that right? because that doesn’t seem to work. you have:
<?php comment_author_link() ?>
and I have:
$comment_author_url
it should be same thing…
im sorry, it just doesn’t seem to be working.
I see the $comment_author_url as well. What I changed is a little earlier in the document. Near the top you should have something like :
<!-- You can start editing here. --> <?php if ($comments) : ?> <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3> <ol class="commentlist"> <?php foreach ($comments as $comment) : ?> <li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>"> <cite><a href="<?php comment_author_link() ?>" target="_blank"></cite> Says: <?php if ($comment->comment_approved == '0') : ?> <em>Your comment is awaiting moderation.</em> <?php endif; ?> <br />
that’s just weird cuz i did exactly what u said but it still isn’t working.
would you mind editing the file for me if i posted it here?
You can paste the comments.php file you have and I’ll look at it. Sure.
I put it back to original file before the changes i had made the ones you told me above.
<?php // Do not delete these lines if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) die ('Please do not load this page directly. Thanks!'); if (!empty($post->post_password)) { // if there's a password if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie ?> <p class="nocomments">This post is password protected. Enter the password to view comments.<p> <?php return; } } /* This variable is for alternating comment background */ $oddcomment = 'alt'; ?> <!-- You can start editing here. --> <?php if ($comments) : ?> <div class="post2"> <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3> <ol class="commentlist"> <?php foreach ($comments as $comment) : ?> <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>"> Comment by <?php comment_author_link() ?> <?php if ($comment->comment_approved == '0') : ?> <em>Your comment is awaiting moderation.</em> <?php endif; ?> on <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php comment_text() ?> </li> <?php /* Changes every other comment to a different class */ if ('alt' == $oddcomment) $oddcomment = ''; else $oddcomment = 'alt'; ?> <?php endforeach; /* end for each comment */ ?> </ol> <?php else : // this is displayed if there are no comments so far ?> <?php if ('open' == $post->comment_status) : ?> <!-- If comments are open, but there are no comments. --> <?php else : // comments are closed ?> <!-- If comments are closed. --> <p class="nocomments">Comments are closed.</p> <?php endif; ?> <?php endif; ?> <?php if ('open' == $post->comment_status) : ?> <h3 id="respond">Leave a Reply</h3> <?php if ( get_option('comment_registration') && !$user_ID ) : ?> <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p> <?php else : ?> <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <?php if ( $user_ID ) : ?> <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout »</a></p> <?php else : ?> <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /> <label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p> <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" /> <label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p> <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /> <label for="url"><small>Website</small></label></p> <?php endif; ?> <!--<p><small><strong>XHTML:</strong> You can use these tags: <?php echo allowed_tags(); ?></small></p>--> <p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p> <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /> <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> </p> <?php do_action('comment_form', $post->ID); ?> </form> </div> <?php endif; // If registration required and not logged in ?> <?php endif; // if you delete this the sky will fall on your head ?>
thank you so much for looking at it for me. I really appreciate it!
in my comments, the author’s (site link) opens up in my comments pop-up.
Does it mean you are using the popup window for your comments?
If yes, why on the aerth are you guys editing the comments.php template instead of the comments-popup.php template file?You’re completely right master moshu :). I wasn’t even paying attention that it was the comments-popup.php file that was linked.
<ol id="commentlist"> <?php foreach ($comments as $comment) { ?> <li id="comment-<?php comment_ID() ?>"> <?php comment_text() ?> <p><cite><?php comment_type('Comment', 'Trackback', 'Pingback'); ?> by <a target="_blank" href="<?php comment_author_link() ?>"> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p> </li>
should fix it. Feel free to correct me if I am wrong moshu.
thank you so much! its finally working.
just one more question. how come the name only shows for the ones i’ve got a link? does that mean its not going to show if there is no link there? https://suddenly-alone.net/wp/?comments_popup=3
anyone?
- The topic ‘Links on a new page’ is closed to new replies.