• Hello you all.

    I have changed my Child theme to display some text under each circle.

    However, now it is displaying the title of the post twice when there is no image.

    I have added this code in content-home.php

    <article id="post-<?php the_ID(); ?>" <?php post_class( $postclass ); ?>>
    	<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
                  <?php echo $thumb; ?>
                  <span class="hometitle">
                        <?php the_title(); ?>
                  </span>
             </a>
    </article><!-- #post-<?php the_ID(); ?> -->

    and this CSS:

    .blog .hentry span.hometitle {
     position: absolute;
     top: 73px;
     width: 100%;
     text-align: center;
    }
    
    .blog .hentry {
     position: relative;
    }

    Does anyone knows how to fix that?
    Many thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Let’s see your site

    Thread Starter lleo

    (@lleo)

    Hello Andrew, thanks for the reply.

    Here it is my site: https://snag.gy/OKp83.jpg

    I hope you can notice that the first post is being replied as there’s no Featured image in the circle, and the others are okay.

    Many thanks

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I’ll have to guess but maybe you don’t need this bit of code anymore:

    <span class="hometitle">
                        <?php the_title(); ?>
                  </span

    Thread Starter lleo

    (@lleo)

    Hi Andrew,

    This is what happens when I remove the span:

    https://snag.gy/IdsTH.jpg

    The title posts of all the other posts with images also disappear. =(
    I wish there was a way to remove the title only from the ones that doesn’t have any images..

    Any help will be very much appreciated.

    Thanks

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I think you may have to hide the duplicated title using CSS for now. Do you know how to use Firebug?

    Thread Starter lleo

    (@lleo)

    Hello Andrew! It looks like a good solution for what I need!
    I’m new at everything (php, css,and this firebug), that’s my first webpage.

    The closest thing I did to fix it was altering the no-thumbail display from ‘block’ to ‘none’ in the css.style:

    .hentry.no-thumbnail .thumbnail-title {
    	display: block;
    	text-shadow: none;

    But what I want is to hide what is being written in php, and I’m lost in that matter..But if you give me some directions I think I can do it!!
    Cheers

    Thread Starter lleo

    (@lleo)

    Hello,

    I’ve managed to fix my problem by adjusting the line-height in style.css
    By adjusting this parameter it was possible to hide the duplicated text as @andrew suggested.
    I’m sure that are better solutions but it worked for me.

    .blog .hentry span.hometitle {
         line-height: 20.5;
    Thread Starter lleo

    (@lleo)

    Better solution:

    .blog .hentry span.hometitle {
     position: absolute;
     top: 73px;
     width: 100%;
     text-align: center;
    }
    
    .blog .hentry {
     position: relative;
    }
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Post titles Duplicated’ is closed to new replies.