• Resolved rajesh0228

    (@rajesh0228)


    t31os, if you’re reading this post let me remind you about a old thread – http://wordpress.org/support/topic/250685
    related to inserting an image alongside the post/page title.

    I am using the default theme in my site. I tried implementing your technique(which uses a custom-field) but it didn’t work.

Viewing 15 replies - 16 through 30 (of 50 total)
  • Thread Starter rajesh0228

    (@rajesh0228)

    RVoodoo, I can’t see the Post Thumbnail UI for both Post and Page after adding this in functions.php:

    add_theme_support( ‘post-thumbnails’, array( ‘post’ ) ); // Add it for posts
    add_theme_support( ‘post-thumbnails’, array( ‘page’ ) ); // Add it for pages
    set_post_thumbnail_size( 50, 50 );

    I did refresh my admin login page. I am using the default theme in WP 2.9.2.
    Did I miss a step?

    Click screen options and see if it’s listed there and unchecked (of course it shouldn’t be, but worth checking)..

    Also recheck the functions file, make sure the changes you made did stick and are present in the file.

    Thread Starter rajesh0228

    (@rajesh0228)

    Mark, sadly it’s not listed in Screen Options. And of course, the changes are still their in functions.php.

    What next?!!!

    Just went to test my 2.9.2 installation just to confirm, i placed the following at the top of the functions file..

    add_theme_support( 'post-thumbnails' );

    Perhaps the issue is with how you’re registering the support, what you have above, should be for when you want to use one or the other (posts OR pages), i don’t think they’re intended to be used together like that.

    Try what i’ve used above, assuming you want it for both pages and posts..

    Thread Starter rajesh0228

    (@rajesh0228)

    Ok Mark, I did what you wanted me to. The difference is that I can now see Post Thumbnail in Screen Options. But where’s the UI?

    Do you see a “Post Thumbnail” box down the righthand side?

    You should see a box with titled “Post Thumbnail” containing the text.. “Set thumbnail”..

    Thread Starter rajesh0228

    (@rajesh0228)

    Yes Mark, I can see it. I selected an image from my Media library & clicked Use as thumbnail.

    What next? Do I use these codes as stated in your site:

    1 <?php
    2 if ( has_post_thumbnail() ) {
    3 // the current post has a thumbnail
    4 } else {
    5 // the current post lacks a thumbnail
    6 }
    7 ?>

    the_post_thumbnail() outputs the Post Thumbnail, if it exists (in the loop):
    1 <?php the_post_thumbnail(); ?>

    But how 2 use them?

    <?php the_post_thumbnail(); ?>

    added to your index.php near the code that calls up the title should display your thumbnail (this is the simplest code….we can work on adding more once your thumbnail is showing)

    Thread Starter rajesh0228

    (@rajesh0228)

    RVoodoo, I added this –

    <?php the_post_thumbnail(‘title-image’, array(‘class’ => ‘titleImage’, ‘alt’ => ‘Title Icon’));?>

    in index.php before the code that calls up the title. I can see my thumbnail. But I want 2 reduce the dimension, therefore I modified this code in functions.php:

    set_post_thumbnail_size( 30, 30);

    But this is not working! The dimension is as it was.

    Thread Starter rajesh0228

    (@rajesh0228)

    Ok RVoodoo, i made this alteration-

    From

    <?php the_post_thumbnail(‘title-image’, array(‘class’ => ‘titleImage’, ‘alt’ => ‘Title Icon’));?>

    [The image was very big]
    To

    <?php the_post_thumbnail(); ?>

    After this I can control the image size thru:

    set_post_thumbnail_size( 30, 30);

    But if you look at my site, the image is far away from my title. I want it 2 be just 2 the left of my post-title. How 2 do it?

    that’s where you’ll need to play with css a bit…..

    I’m just guessing here….it may take a bit more, but you are using the default theme….so your title stuff looks like: <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

    so I’d bet if you just added like this(the thumbnail stuff, wrapped ina class)

    <div class="titleThumb"><?php the_post_thumbnail(); ?></div><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

    then add to your style.css

    .titleThumb {
        float: left;
        margin-right: 5px;
        }

    it should help align things…again, I have no way of testing this on the default theme right now….so I’m kind of guessing. You may need to play with things a bit

    Move the code next to the title..

    Take this code.

    <?php the_post_thumbnail(); ?>

    And place it before..

    <h2><a href="<?php the_permalink() ?>">  etc..

    Right now it’s sat outside the post element ..

    Had a feeling you’d reply mate … 🙂 I nearly didn’t …. lol, i should of waited a few more minutes..

    Had a feeling you’d reply mate

    as you are well aware….I’m getting rather familiar with the thumbnails!! 😉

    Thread Starter rajesh0228

    (@rajesh0228)

    Ok guys…here’s the latest update:
    I deleted

    <?php the_post_thumbnail();?>

    from Index.php.
    I then implemented RVoodoo suggestion.
    I got what I wanted. Thanks RVoodoo !
    But the problem is the post-title is moving along with the left-margin setting of the image. Why?

    And also the date. I want that 2 be at it’s original location – & not consider the thumbnail 2 be it’s friend & follow it.

    Check my site.

Viewing 15 replies - 16 through 30 (of 50 total)
  • The topic ‘Help on Image for each post title’ is closed to new replies.