• rheajap

    (@rheajap)


    Hello,

    I want to show blog post excerpts on a category archive page. I have to make a few changes to give it a nicer look. First I wanted to make the featured image smaller and go to the left. So I used this css to do this without changing the blogpost featured image.

    .category .post-thumbnail  { 
     float: left; /*0 auto; */
        height: 200px;
    	width: 200px;
    	margin-right: 5px;
    	margin-left: 4px;
    	/*margin: 0 auto;*/
    }

    Image went to the left side and at the right site the exerpt tekst is showing. pls correct my css when its not good.

    Now I want to change some other things but I cannot figure out how it works..

    Question 1

    The title of the blog is showing above the excerpt text and the featured image. I want the title to show at the right side of the featured image and aligned with the top of that image. Below the title I want to show the excerpt text.

    I did find out how to put the content.php in the childtheme. There is the php to change.

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<header class="entry-header">
    		<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
    			<span class="sticky-post"><?php _e( 'Featured', 'twentysixteen' ); ?></span>
    		<?php endif; ?>
    <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?> 
    	</header><!-- .entry-header -->
    	
    		<?php twentysixteen_excerpt(); ?>
    
    	<?php twentysixteen_post_thumbnail(); ?>
    	
    	
    	<div class="entry-content">
    	
    			<?php 
    			/* translators: %s: Name of current post */
    			the_content( sprintf(
    				__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ),
    				get_the_title()
    			) );
    
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentysixteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    				'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>%',
    				'separator'   => '<span class="screen-reader-text">, </span>',
    			) );
    		?>
    	</div><!-- .entry-content -->

    The code above is what this is about. I tried to move <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?> to other places in the php. Below the twenty sixteen excerpt, below the twentysixteen post thumbnail, inside the <div class="entry-content">

    Visual the title was moving but whatever I tried It just does not want to show above the excerpt text. It shows left of the image, below the image, etc..

    I tried to do something with css like `.category .entry-title {

    float: left;
    }`

    But that is not working. Can someone please tell me how I get the title inline with the left aligned featured image?

    Question 2:

    How can I change the layout of the excerpt text? I want it to end when it reaches the end of the featured image or at least to have the text staying at the right side and not wrapping around the featured image.

    I Really hope someone can answer my questions.

    Sorry for any bad english

    • This topic was modified 8 years ago by rheajap.
Viewing 3 replies - 1 through 3 (of 3 total)
  • ThemeSumo

    (@themesumo)

    Can you provide a link to your site so we can see the changes you’ve already made?

    Thanks.

    Thread Starter rheajap

    (@rheajap)

    Hello,

    I have at this moment Easy Custom Auto Excerpt Options installed because I did hope it would do the thrick for me. But unfortunately not. It’s working the same as using CSS to make the excerpt.

    The only struggle I have is I cannot find any way to put the Title permalink at the right side of the featured image. Inline with the excerpt.

    To get it done with CSS the aligning of the featured image to the left, the text to the right I first used this css:

    .category .post-thumbnail  { 
     padding-top: 0px;
     padding-bottom: 0px;
     height: 200px;
     width: 200px;
     margin-right: 5px;
     margin-left: 4px;
     
    }

    To see the site please go to The website

    You can login with username Testuser and password: testuser.

    The site is not visible for public for now so thats why the login part.

    To see the excerpts about what I am talking please go to “Laatste Nieuws” in the right sidebar menu or visit the link https://www.ikstemniet.nu/category/laatste-nieuws/

    I have shortened the exceprt line with the plugin. I also did find a function for it but thats not necesary.

    I hope you can give me an advice how to put the title inline with the excerpt tekst. As you can see now the title is above the featured image!

    Regards,

    Jap

    ThemeSumo

    (@themesumo)

    Thanks for the link.

    That’s fairly heavily modified version of TwentySixteen, by default the file that controls this area for your archives is at /template-parts/content.php, I assume you have already modified this using your Child Theme.

    As it’s so different to the default code, it’s difficult to tell you what to change, but you simply need to relocate the post title that is within the post <header class="header-entry"> element so it is within the same <div> container as your text excerpts, as shown here.

    Done correctly it will look like this.

    You can control the excerpts’ length using a filter too!

    Hope this helps.

    • This reply was modified 8 years ago by ThemeSumo.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changing excerpt on category archive’ is closed to new replies.