WordPress.org

Ready to get started?Download WordPress

Forums

BoldR Lite
[resolved] Excerpt title above featured image? (5 posts)

  1. Carl Donovan
    Member
    Posted 7 months ago #

    I'd like to have the post title and excerpt above the featured image, limited to a particular category. The rest of the posts excerpts to stay as they are. Is this possible?

    Thanks!

  2. Iceable Themes
    Member
    Theme Author

    Posted 7 months ago #

    Hello,

    Yes this is possible, but will require a bit of custom coding in index.php

    I think the idea would rather be moving the featured image below the title and excerpt (same result but different approach in the code), only for the desired category.

    The featured image is already wrapped in a conditional tag on line 89:
    <?php if ( '' != get_the_post_thumbnail() ):

    Here you can add the condition that the post is not in the target category:
    <?php if ( '' != get_the_post_thumbnail() && ! in_category( 'target-cat-slug' ) ):

    So the featured image won't be displayed above the content for posts in this category.

    Now you want to display it under the content, so copy the whole featured image code block (from the line mentioned above down to "endif; ?>" on line 95, and paste it after the content div. It should look like:

    [line 107]		</div>
    <?php [INSERT CODE HERE] ?>
    	</div>
    	<br class="clear" />
    
    </div><!-- end div post -->

    And in this code change the condition to:

    <?php if ( '' != get_the_post_thumbnail() && in_category( 'target-cat-slug' ) ):

    And this will do the trick.

  3. Carl Donovan
    Member
    Posted 7 months ago #

    Thanks so much for your quick and thorough response. The level of support you offer on a free theme is a rare beauty.

    I have another question, if I may... Is there an easy way to show post excerpts only on the home page while showing full content on category pages? I'm working with the Blog in Blog plugin at the moment but I'm afraid it might be too much for the client to handle on their own in the future.

    THANKS!

  4. Iceable Themes
    Member
    Theme Author

    Posted 7 months ago #

    Sure this is possible too; requires a small change in index.php as well but easier:

    There is already a conditional switch to display either the_excerpt() or the_content(); so if you set the theme to display the excerpt from Theme Options, you will then just need to add a condition to display the content instead on category pages:

    Original code:

    if ( get_post_format() || post_password_required() || "Full content" == boldr_get_option('blog_index_shows') ) the_content();
    else the_excerpt();

    Your customization:

    if ( get_post_format() || post_password_required() || "Full content" == boldr_get_option('blog_index_shows') || is_category() ) the_content();
    else the_excerpt();
  5. Carl Donovan
    Member
    Posted 7 months ago #

    Thanks again! You rock!

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.