2013-10-14 4 views
0

사용자 정의 테마를 만든 다음 사용자 정의 유형을 만들고 게시물에 링크를 추가하려고하면 앵커가 작동하지 않습니다. 내 코드 :앵커가 워드 프레스에서 작동하지 않습니다.

<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. ?> 

두 줄의 댓글이 작동하지 않습니다.

+2

링크가 없으면 실제 코드 (라이브 또는 개발 사이트)를 볼 수 없지만 JS 충돌/오류가있을 수 있습니다. 귀하의 콘솔 및 보고서를 확인하십시오 .. –

+0

나는 확인했지만 링크 또는 뭔가 그런 것에 대해 찾지 못했습니다. – krachleur

+0

오류는 "링크"와 관련이 없습니다. jquery 또는 JS와 관련이있을 수 있습니다. js 오류가 링크 자체보다 먼저 발생하면 이후에 나타나는 모든 스크립트를 중단 (중지) 할 수 있습니다 .. –

답변

0

버그를 찾기가 어렵습니다. 나는 당신을 위해 무언가를 시도했습니다. 그것이 효과가 있기를 바랍니다.

 <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 wp_get_attachment_image_src(get_post_thumbnail_id($post->ID));?>" /></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. ?> 

감사합니다.

+0

첫 번째 명제로 도움을 주셔서 감사합니다. 오류가 있지만 상자 크기 조정과 같은 다른 오류를 찾을 수 있지만 우리의 경우에 관한 뭔가를 찾지 못했습니다 및 두 번째 대답, 수정 한 있지만 이미지가 표시되지 않습니다. tnx 많이, 나는 더 많은 답변을 기다리고 있어요 (가능한 경우) !!! – krachleur

관련 문제