← WordPress

Comentarios no post errado

Lida 3599 vezes

Offline

Pedro Lopes 
Beta tester
Mensagens 3568 Gostos 18
Feedback +6

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Boa Tarde,

Tenho um blog wordpress que ao fazer um comentário num post ele redirecciona para o post errado, mas o comentário fica no post certo. E também na dashboard, nos últimos comentários, mostra o post errado.

Alguém já teve este problema? Sabem como resolver?

Posso instalar tudo de novo, só tenho três posts, mas mesmo assim, ia dar trabalho tar a criar tudo de novo. :/

Já está na ultima versão.
Offline

Diogo Pinto 
Administrador
Mensagens 4400 Gostos 371
Feedback +4

Troféus totais: 37
Trófeus: (Ver todos)
Avatar Search Level 6 Linux User Mobile User Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes

Eu sei o que isso é, em príncipio... Antes dos comentários estás a ir buscar algum tipo de posts? Tipo, artigos aleatórios, recentes, de uma categoria?
Offline

Nuno 
Administrador
Mensagens 7780 Gostos 216
Feedback +2

Troféus totais: 42
Trófeus: (Ver todos)
100 Poll Votes Level 7 Search Mobile User Level 6 Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes

Exacto, pode ser de teres na barra lateral os últimos artigos, ou até mesmo os posts relacionados no fim do artigo...
Offline

Diogo Pinto 
Administrador
Mensagens 4400 Gostos 371
Feedback +4

Troféus totais: 37
Trófeus: (Ver todos)
Avatar Search Level 6 Linux User Mobile User Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes

Faz assim no single.php...

Começa o loop. Antes de começares os ultimos artigos ou os aleatórios, acaba o loop. Depois vais buscar os recentes. Depois recomeças o loop e metes lá o comments_template();. Isso deve resolver-te. Isto porque no wordpress não podes ter vários loops a correr... ;)

Abraço
Offline

Pedro Lopes 
Beta tester
Mensagens 3568 Gostos 18
Feedback +6

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Hum...

Pois, deve ser os artigos relacionados, vou remover para ver se é disso, depois tento fazer o que o DiguiVirus disse. :)

Obrigado! ;)
Offline

Pedro Lopes 
Beta tester
Mensagens 3568 Gostos 18
Feedback +6

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Faz assim no single.php...

Começa o loop. Antes de começares os ultimos artigos ou os aleatórios, acaba o loop. Depois vais buscar os recentes. Depois recomeças o loop e metes lá o comments_template();. Isso deve resolver-te. Isto porque no wordpress não podes ter vários loops a correr... ;)

Abraço

Resolvido! ;)

Obrigado. :)
Offline

Casteloes 
Membro
Mensagens 935 Gostos 0
Feedback +14

Troféus totais: 31
Trófeus: (Ver todos)
Search Linux User Mobile User Windows User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4

Começa o loop. Antes de começares os ultimos artigos ou os aleatórios, acaba o loop. Depois vais buscar os recentes. Depois recomeças o loop e metes lá o comments_template();. Isso deve resolver-te. Isto porque no wordpress não podes ter vários loops a correr... ;)


Não estou a perceber o que devo fazer nesta parte.
Offline

Casteloes 
Membro
Mensagens 935 Gostos 0
Feedback +14

Troféus totais: 31
Trófeus: (Ver todos)
Search Linux User Mobile User Windows User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4

Faz assim no single.php...

Começa o loop. Antes de começares os ultimos artigos ou os aleatórios, acaba o loop. Depois vais buscar os recentes. Depois recomeças o loop e metes lá o comments_template();. Isso deve resolver-te. Isto porque no wordpress não podes ter vários loops a correr... ;)


Não consigo colocar isto a funcionar.
Já tentei fechar o loop e depois voltar a colocar o loop nos comentários mas não funciona.

Se alguém me puder ajudar agradeço


Código: [Seleccione]
<?php get_header(); ?>

<div id="content">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
   
    <div class="post singlepost" id="post-<?php the_ID(); ?>">

        <div class="title">
            <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
            <p>
                <span class="section section-1"><span class="nodisplay">Posted on </span><?php the_time('j F, Y'); ?><span class="nodisplay">by <?php the_author_posts_link(); ?></span></span>
                <span class="hidden"> &ndash; </span>
            </p>
            <?php
                $ad_468_60 
get_option('padd_ad_468_60');
                if (!empty(
$ad_468_60)) :
            
?>

            <div class="singlegoogle">
                <?php echo stripslashes($ad_468_60); ?>
            </div>
            <?php endif; ?>
        </div>
   
        <div class="entry">
            <?php the_content(); ?>
            <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ''after' => '</p>''next_or_number' => 'number')); ?>
            <div class="postmeta"></div>

<div id="pub">
<?php
   $tags 
wp_get_post_tags($post->ID);
   if (
$tags) {
      
$tag_ids = array();
      foreach(
$tags as $individual_tag$tag_ids[] = $individual_tag->term_id;
      
$args=array(
         
'tag__in' => $tag_ids,
         
'post__not_in' => array($post->ID),
         
'showposts'=> 4//Numero de artigos relacionados a mostrar.
         
'caller_get_posts'=> 1
      
);

      
$my_query = new wp_query($args);
      if( 
$my_query->have_posts() ) {
         echo 
'<h3>Textos Relacionados</h3><ul>';
         while (
$my_query->have_posts()) {
            
$my_query->the_post();
            
$miniatura2 preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i'$post->post_content$matches);
            
$first_img $matches [1] [0];
?>


<li>
   <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<?php
   
if (has_post_thumbnail()) {
      
the_post_thumbnail(array(120,120));
   }
   elseif (
has_post_thumbnail() == false && get_post_custom_values("paddimage") != '') {
      
$miniatura3 get_post_custom_values("paddimage");
      echo 
'<img src="'.$miniatura3[0].'" width="120" alt="" title="" />';
   }
   elseif (
get_post_custom_values("paddimage") == '' && has_post_thumbnail() == false && $first_img == true) {
      echo 
'<img src="'.$first_img.'" width="120" height="120" alt="" title="" />';
   }
   else {
      echo 
'<img src="http://www.dicasvivamelhor.com/" width="120" height="120" alt="" title="" />';
   }
?>

      <br />
      <?php the_title(); ?>
   </a>
</li>
<?php
}
echo 
'</ul>';
} }
?>

</div>


        </div>
    </div>

    <?php comments_template(); ?>
   
    <?php endwhile; else: ?>
   
    <div class="post singlepost">
        <div class="title">
            <h2>Página não encontrada</h2>
        </div>
        <div class="entry errorentry">
            <p>Sorry, but you are looking for a page that isn't here.</p>
        </div>
    </div>

    <?php endif; ?>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>
Offline

Nuno 
Administrador
Mensagens 7780 Gostos 216
Feedback +2

Troféus totais: 42
Trófeus: (Ver todos)
100 Poll Votes Level 7 Search Mobile User Level 6 Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes

Como já referi em cima. O problema está nos posts relacionados. Tens de fechar o loop.
Offline

Casteloes 
Membro
Mensagens 935 Gostos 0
Feedback +14

Troféus totais: 31
Trófeus: (Ver todos)
Search Linux User Mobile User Windows User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4

Como já referi em cima. O problema está nos posts relacionados. Tens de fechar o loop.

Fez-se luz com estas palavras.
Eu sei que já tinhas dito mas não estava a conseguir por a funcionar.
Ao ler isto e olhar para o código percebi o que estava a fazer de mal.