• Resolved jmckiernan86

    (@jmckiernan86)


    how can I get the post excerpt text to appear next to the thumbnail image rather than below it and also make the image clickable?

    https://supplementhelper.com/

    and

    why do some of the posts show an excerpt while some only show the title? I want them all to show an excerpt.

Viewing 10 replies - 1 through 10 (of 10 total)
  • get the post excerpt text to appear next to the thumbnail image

    you seem to be using the wrong css selector to target the thumbnail;
    try:
    .home .attachment-thumbnail-feature { ... }
    also check and reconsider where and when you add clear:none;

    why do some of the posts show an excerpt while some only show the title?

    what is the code used for the excerpts?
    are you using hand-written excerpts in some of the posts?

    Thread Starter jmckiernan86

    (@jmckiernan86)

    thank you! I changed the css selector to the correct one and took out the “clear:none; and now it looks the way I want.

    for the code for the excerpts I just made a small change on line 35 of the content.php in the twenty eleven child theme. Here’s the link to it:

    https://pastebin.com/uZ8T1sr2

    I’m not using hand written excerpts. Also now with the image next to the post I need the excerpt a bit longer…where would i make that change?

    I appreciate the help!

    I don’t have any idea why the excerpts would not show;
    the only thing is that the posted code does not seem to be exactly the code that is used right now (the location of the thumbnail code is different from what appears in the browser).

    for the excerpt length, add this to functions.php of your child theme:

    add_action( 'after_setup_theme', 'twentyeleven_child_theme_setup' );
    function twentyeleven_child_theme_setup() {
        // We are providing our own filter for excerpt_length (or using the unfiltered value)
        remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
        function twentyeleven_child_excerpt_length( $length ) {
            return 80; //new excerpt length
        }
        add_filter( 'excerpt_length', 'twentyeleven_child_excerpt_length', 20 );
    }
    Thread Starter jmckiernan86

    (@jmckiernan86)

    i pasted another copy of the content.php here. I don’t think there’s any difference but there might be somewhere:

    https://pastebin.com/77Hv5fY4

    The only other child theme files I’m using are

    header.php

    https://pastebin.com/UGuMdK72

    functions.php

    https://pastebin.com/uZ8T1sr2

    footer.php

    https://pastebin.com/TADxJU4Z

    The weird part is I have another blog using twenty eleven with the same child theme modifications but the post excerpts show on every post but I cant figure out what the difference is. The other blog is:

    https://myglutenfreequest.com/

    another copy of the content.php here

    that seems to be the right one; no big difference, as it is also using ‘the_excerpt();’

    standard troubleshooting:

    what happens if you deactivate all plugins?
    if this solves the problem, reactivate one plugin after the other to find the problematic one.

    what happens if you switch to the default Twenty Eleven (obviously, with that theme, you would only find excerpts in search results)?

    Thread Starter jmckiernan86

    (@jmckiernan86)

    the plugins didnt change anything but when I activated the parent theme and used the search function all the excerpt displayed correctly

    so the problem must be in one of the child theme files, but I can’t seem to locate it…

    I even copied the theme files over from the other site where its working correctly and that didnt work either. I’m stumped

    Thread Starter jmckiernan86

    (@jmckiernan86)

    Also I’m not sure what I did wrong but since I added that function you gave me I keep getting this error when I try to update posts:

    Warning: Cannot modify header information – headers already sent by (output started at /home/farmers6/public_html/myglutenfreequest.com/wp-content/themes/twentyeleven-child/functions.php:14) in /home/farmers6/public_html/myglutenfreequest.com/wp-includes/pluggable.php on line 881

    The functions.php file im using:

    https://pastebin.com/3qTf8QYX

    Thread Starter jmckiernan86

    (@jmckiernan86)

    ok its all working now. you were right it turned out to be a plugin after all. I went through a second time and deactivated them and it worked this time.

    One last question if you don’t mind..How would I get the thumbnail images to link to the post?

    Thanks for all your help. you’ve saved me lots of time and frustration.

    get the thumbnail images to link to the post?

    edit line 37 of content.php (in https://pastebin.com/77Hv5fY4 )

    <?php the_post_thumbnail('thumbnail-feature');?>

    to:

    <?php if( has_post_thumbnail() ) { ?>
    <a href="<?php the_permalink(); ?>" title="link to <?php the_title_attribute(); ?>"><?php the_post_thumbnail('thumbnail-feature'); ?></a>
    <?php } ?>

    the conditional check is, so you don’t end up with an empty link tag when there is no thumbnail.

    https://codex.www.ads-software.com/Function_Reference/has_post_thumbnail
    https://codex.www.ads-software.com/Function_Reference/the_permalink
    https://codex.www.ads-software.com/Function_Reference/the_title_attribute

    Thread Starter jmckiernan86

    (@jmckiernan86)

    Perfect! Thank you for you all your help! I really appreciate it!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘post excerpt next to the thumbnail’ is closed to new replies.