【发布时间】:2013-10-14 21:51:02
【问题描述】:
我正在创建一个自定义主题,然后是一个自定义类型,当我尝试将(阅读更多)链接放入帖子时,锚点不起作用。这是我的代码:
<main id="main" class="site-main" role="main">
<?php $temp_query = $wp_query;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args=array(
'caller_get_posts'=>1,
'post_type' => 'enfant',
'paged'=>$paged
);
$wp_query = new WP_Query($args);
?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post();
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID));
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="top-cont">
<h1 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<!-- first one --> <a href="<?php the_permalink();?>"><img src="<?php echo $src[0];?>" /></a>
<?php
$terms = get_the_terms($post->ID, 'maladies', '', ', ','');
if ( !empty( $terms ) ){
$numTerm = 0;
echo "<h3>Maladie : </h3>";
echo "<p>";
foreach( $terms as $term ) {
$numTerm++;
if ($numTerm == 1){
echo " ".$term->name;
}
else{
echo ", ".$term->name;
}
}
echo "</p><br/>";
}
?>
<!-- second one --> <a href="<?php the_permalink() ?>" >Lire plus ...</a>
<p><?php the_excerpt(); ?></p>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'adelia' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<div class="foot"></div>
<!--<?php edit_post_link( __( 'Edit', 'adelia' ), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>' ); ?>-->
</article><!-- #post-## -->
<?php
// If comments are open or we have at least one comment, load up the comment template
/*if ( comments_open() || '0' != get_comments_number() )
comments_template();*/
?>
<?php endwhile; // end of the loop. ?>
注释的两行都不起作用。
【问题讨论】:
-
如果没有链接来查看实际代码(实时或开发站点)很难确定,但很可能您有一些 JS 冲突/错误。检查您的控制台并报告..
-
我已经检查过了,但没有找到有关链接或类似内容的内容。
-
错误不会是“链接”特定的。但很可能与 jQUery 或 JS 相关。如果在链接本身之前发生 js 错误,它可以破坏(停止)之后出现的所有脚本..
-
我刚刚发现了一些警告和一个 caroufredSel 错误,表明 #caroufredsel 没有元素
-
我尝试了另一件事,我创建了一个过滤器挂钩,添加了阅读更多按钮,但同样的问题,它不起作用,链接不可点击,我需要更多帮助pleaaaaaase
标签: wordpress permalinks custom-type