Changing excerpt on category archive
-
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
- The topic ‘Changing excerpt on category archive’ is closed to new replies.