2013-10-14 3 views
0

Я создаю пользовательскую тему, затем настраиваемый тип, и когда я пытаюсь поместить ссылку() на сообщение, якорь не работает. Это мой код:Якорь не работает в wordpress,

<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

Очень сложно определить без ссылки, чтобы увидеть фактический код (живой или dev-сайт), но, скорее всего, у вас есть конфликт/ошибка 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

Смежные вопросы