• I tried several plugins and finally code for breadcrumbs, but all have the same mistake at my theme.

    When I put the breadcrumbs in header.php works fine. When I put in single, it shows wrong post title, seems like it picks just any title from the current category.

    How to cure that? Now I am using this https://dimox.net/wordpress-breadcrumbs-without-a-plugin/

    code but it’s all the same with any plugin.

    PLS, HELP

    <?php if (function_exists(‘dimox_breadcrumbs’)) dimox_breadcrumbs(); ?>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Viewing 1 replies (of 1 total)
  • Thread Starter ponch

    (@ponch)

    Here is what I have in left sidebar before single.php

    <div id="sidebar2" style="padding-top:12px;">
    <?php if(is_single()){ ?>
    <?php
    $category = get_the_category();
    $cat_id = $category[0]->term_id;
    if($cat_id){
    ?>
    <?php //echo "cat=".$cat_id."&showposts=3&post__not_in=".get_the_ID(); ?>
    <?php //$recent = new WP_Query("cat=".$cat_id."&showposts=3&p=-".get_the_ID()); ?>
    <?php $recent = new WP_Query(array('cat' => $cat_id, 'showposts' => 3, 'post__not_in' => array(get_the_ID()))); ?>
    <?php if ($recent->have_posts()): ?>
    <div class="blogs123">
    
    <span>Последние посты в этой рубрике:</span> <br>
    <div class="also3" style="padding-top:6px;">
    <?php while($recent->have_posts()) : $recent->the_post();?>
    <li class="clear" style="padding-top:5px;">
    <?php if(function_exists('get_avatar') && 0){ ?>
    <div class="leftrandom"><?=get_avatar($post->post_author, '60','60');?></div>
    <?php } ?>
    <span style="color:#999999;font-size:14px;"><?php the_author(); ?></span><br><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
    </li>
    <?php endwhile; ?>
    </div>
    </div>
    <?php endif; ?>
    <?php } ?>
    <?php } ?>
Viewing 1 replies (of 1 total)
  • The topic ‘When I put breadcrumb code in single, shows wrong post title’ is closed to new replies.