0

I was wondering what is the php code to go directly to a div on single post on a wordpress page (comments)

For example. The link to go to the comments section of a particular post would be http://badsentinel.com/2013/05/06/afternoon-awesomeness-41-photos-2/#idc-container (I am using Intense Debate comment plugin) But I dont want to manually type the a href on every single post.

I would like to know if someone can help me out with the below code. Im sure it is something similar..

<a href="<?php echo get_permalink($post->#idc-container); ?> Jump to Comments </a>

Thanks in advance Paul

4

1 回答 1

0

由于评论 div 锚点有一个常量标识符,因此您不需要任何 PHP 来引用它。只需在动态帖子链接之后添加它:

<a href="<?php echo get_permalink({{id}}); ?>/#idc-container" /> Jump to Comments </a>

替换{{id}}为帖子 ID

话虽如此,如果您使用的是内部锚标记,您甚至不需要永久链接:

<a href="#idc-container" /> Jump to Comments </a> 

将锚点添加到现有 URL

于 2013-05-07T01:03:29.893 回答