ThemeShaper Forums » Thematic

[closed]

Adding post thumbnails to excerpts, for beginners

(22 posts)
  • Started 2 years ago by MTPrower
  • Latest reply from MTPrower
  • This topic is resolved
  1. MTPrower
    Member

    I'm using Thematic 0.9.7.7 and am building my own child theme from scratch for the first time.

    I've been all over Google and on a bunch of articles in this and WordPress' forums. I'm having trouble adding post thumbnails to the excerpts. I want them to be defined by "featured image" in the post-creator in the backend, and have them be compatible with FPW Category Thumbnails (which should work without any tweaks, I think). I want to add them to the home page and to category pages.

    Also, I want to create a CSS class (I think that's what you call it) so I can style them and make them work well in my fluid layout.

    This is all beginner stuff, but I can't seem to find a tutorial anywhere? Can someone help me out?

    Posted 2 years ago #
  2. developing.thematic4you.com/thematic-development-release/

    get thematic 0.9.8. i think thumbs are automatically in all excerpts. and google the site a little more... b/c thumbnails have been covered a lot.

    a tip i use is to go to google and type

    site:themeshaper.com/forums what i am looking for

    b/c the site search is admittedly not that great

    Posted 2 years ago #
  3. MTPrower
    Member

    Do I even want to use a beta? I'm trying to develop a theme here.

    Posted 2 years ago #
  4. it isn't beta it is the "latest STABLE development release". it contains lots of fixes and features that just haven't gone through the WP theme review process to be in the WP repository.

    you are obviously developing a theme (give me a little credit). all of my production sites that are using thematic child themes are using thematic 0.9.8. it will be a lot easier to help you if you are using the current version.

    Posted 2 years ago #
  5. MTPrower
    Member

    Fine. I'll try it out.

    Posted 2 years ago #
  6. MTPrower
    Member

    Alright, so now that I installed the beta that you keep flaunting to everyone, how do I get these post thumbnails to work? Because I'm no closer to getting thumbnails working. >_>

    Posted 2 years ago #
  7. MTPrower
    Member

    I don't see any rules anywhere, so *bump*

    Posted 2 years ago #
  8. middlesister
    Member

    Ok so what have you tried so far?

    The latest STABLE version - 0.9.8 - includes thumbnails with the excerpts by default. You add your image as the featured image of your post and it will be part of the excerpts. It already has a css class, namely "entry-thumb". You don't really need to do anything.

    As for FPW Category Thumbnails, I haven't used it but as long as the post gets its featured image assigned properly then it should work. Thematic only shows the thumbnail if "has_post_thumbnail()" is true.

    Posted 2 years ago #
  9. MTPrower
    Member

    Alright, where can I find "has_post_thumbnail()" so I can check to make sure it's working? I added a featured image before and it didn't show up at the time.

    Posted 2 years ago #
  10. Great attitude there sir.

    Posted 2 years ago #
  11. middlesister
    Member

    Check the wordpress codex for any functions you want to know more about. (Or search the thematic files if it is a thematic function, but thumbnails is a wordpress feature)
    Activate debug mode to see if your code has any errors.
    You could even check the database to see if the image is assigned (it is in the postmeta table).

    Google is your friend. Like helga said, thumbnails have been covered a lot.

    What do you expect from the forums? Coming in here and demanding answers will hardly make people inclined to help you. And "it doesn't work" doesn't give us a single clue to go on if someone actually would want offer help. A little courtesy goes a long way.

    Posted 2 years ago #
  12. MTPrower
    Member

    Alright, I wrote a giant speech about how I don't owe anyone any buttery formal courtesy, but I think it would just be wiser to remove that...

    Alright, the way I'm gonna say this is blunt, but I assure you I am *not* being rude or impatient here. I'm just a blunt person. I don't judge people for the way they communicate, so please don't judge me.

    I explicitly stated in the first post that I read a bunch of the WordPress Codex and I used Google extensively. I always do that. I added a featured image to one of my posts, but it does not show up in the post excerpt. At least, not automatically. How would I find out if it's there and if I just need to style it?

    I appreciate support here, and no matter HOW blunt I am, please don't assume that I am demanding and unappreciative. I'm autistic, and being social has never been my strong suite. I've had to learn socialities through trial and error and like an academic subject, because I don't have social emotions. I don't get offended at "rudeness" and I have to try very deliberately to not be rude myself-- and I still have a lot of trouble.

    Posted 2 years ago #
  13. middlesister
    Member

    No worries. You maybe don't owe anyone anything, but as with most unpaid support forums the way you ask will set the tone on the way you get answered. And the drawback with the written word is that it easily can get misinterpreted. :)

    So, with the latest version (0.9.8) thumbnails are included by default. Thematic checks whether a post has a thumbnail and if it does, adds the image with the css class of "entry-thumb". This is the way it is supposed to work, automatically. Obviously this is not happening for you.

    You could double check that the featured image get assigned properly. If you have easy access to your wordpress database via something like phpadmin you can check it there. Find the ID number of the post you want to check, and look in the postmeta table for that post ID and a meta_key of "_thumbnail_id". You can also use php to check this. Put this code somewhere inside the loop.

    $featured_image = get_post_meta($post->ID, '_thumbnail_id');
    if($featured_image == '') {
        echo 'There was no image attached';
    } else (
        echo 'The attached image ID is ' . $featured_image ;
    }

    Other than that, I don't know how to help you without some more info. What have you tried so far? Have you tried disabling the plugin to see if it is interfering somehow? Also, the thumbnail is only added to post excerpts. If you are using the wordpress <!--more--> button in the post editor to create a teaser, then you are not really using excerpts and would in that case need to add the thumbnails yourself through functions.php.

    Posted 2 years ago #
  14. Alright, I wrote a giant speech about how I don't owe anyone any buttery formal courtesy, but I think it would just be wiser to remove that...

    good choice. as middlesister also implied: simple courtesy will get you a lot further than discourtesy ever will. when you use FREE software and ask for FREE support from VOLUNTEERS you can be assured that you will find people a lot more interested in helping you if you are courteous.

    Alright, the way I'm gonna say this is blunt, but I assure you I am *not* being rude or impatient here. I'm just a blunt person. I don't judge people for the way they communicate, so please don't judge me.

    on the internet you only have the written word as context. so what you write is ALL that we have to go on. english as a second language is usually obvious, but i have no way of knowing that your apparent rudeness rudeness is rooted in your autism and isn't intentional.

    i wasn't grievously offended, i mean it is the internet so I don't really care, but i wasn't really interested in bothering to help you either.

    but since that is cleared up, we can get back on topic:

    if you take a look at:
    http://theplagueround.com/dev/category/entertainment/

    this is running the latest stable release of thematic from the link provided in my earlier post. not a child theme, so no adjustments. you'll see the first post "A Video Post" is showing a thumbnail. all i had to do for this to happen was set a featured image when creating my post. this works automatically anywhere thematic is using excerpts (which is on every archive) unless you make a change... such as setting thumbnails to false in your child theme, or filtering thematic_post.

    but if you go here:
    http://theplagueround.com/dev/

    you'll see that the same post is not showing a thumbnail. the home/blog page is set to show full posts by default. you can change this w/ function

    function childtheme_content($content){
      if(is_home()){
       $content = "excerpt";
       }
       return $content;
    }
    add_filter('thematic_content','childtheme_content');

    middlesister also mentioned the <!--more--> tag. so you are on the home/blog page and use a more tag, you are still showing the full content, just clipped and NOT the excerpt.

    if this isn't working, then my debug process... is to disable all plugins and remove all the functions from your functions.php. then you slowly add the pieces back until you discover which one was the culprit.

    lastly, another tip to get better help is to provide a link. i know i work on a local install usually, but it helps us help you to see what is happening. a picture is worth a thousand words and all that. plus markup is worth more when debugging.

    Posted 2 years ago #
  15. MTPrower
    Member

    Alright, I'll take a look and see if I can't deliberately mess around with my entry-thumb CSS "class" or whatever it's called and make it show up. I appreciate the info.

    Posted 2 years ago #
  16. MTPrower
    Member

    Alright, I looked, and like usual, it was a really simple solution. I think Thematic doesn't show excerpts on the home page by default.

    I have bad luck with functions. So I must ask: can I just paste your "function childtheme_content" thingy in my child's functions.php? Because sometimes my functions end up not working; so I would like to know, for the future, if these child functions override the default template's functions.

    Ya know, I try to find this kinda information in the Codex, but I dun think any amount of pre-planning an extensive writing of "Codex for Dummies who Can't Do Anything but CSS" could prepare for the questions I could ask... :D

    Thanks for the help.

    Posted 2 years ago #
  17. before you spend too much time on that look in your source code:either View Source or use firebug or chrome's developer tools to see whether the thumbnail is even in the markup. if you've got a link i can take a look.

    Posted 2 years ago #
  18. MTPrower
    Member

    I got it working! Alright, now to try to edit excerpt length and turn that [...] into something less ugly. Thanks!

    Posted 2 years ago #
  19. congrats! what was the problem?

    and both your next efforts are answered here:
    http://codex.wordpress.org/Function_Reference/the_excerpt

    Posted 2 years ago #
  20. MTPrower
    Member

    ...I'm embarrassed to say this, but I hadn't noticed the fact that my home page was showing full posts rather than excerpts. It's always something REALLY simple like that... And thanks for the link.

    Posted 2 years ago #
  21. sure. and to answer your above question (i didn't see it) you should be able to paste my childtheme_content function directly into your child's functions.php. sometimes (ummm often) i type code like that from memory so there is always the possibility of a typo, but it looks clean to me.

    thematic has some functions called overrides, but that is not one of them. it was just my naming convention. the override functions always looks like

    childtheme_override_functionname() and you do not need to remove_action, or add_action like you used to do to. but as far as i am aware there are no overrides for filters.

    Posted 2 years ago #
  22. MTPrower
    Member

    Alright, since we're on the topic of overriding functions, I think I'm trying to do one now, but I keep breaking my site.

    I'm trying to make my excerpts be limited by a character count rather than a word count, and output a full readable-word at the end. I found this, which is apparently a full answer:

    http://wordpress.org/support/topic/limit-excerpt-length-by-characters

    But I can't figure out how to get it working. I keep breaking my site trying to throw it into my functions.php.

    And thanks for the help. I appreciate it.

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.