SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Modification of WordPress Theme

    This may not be the correct forum for this so please move, if so.

    I am running into a bit of trouble when it comes to modifying this theme (http://www.woothemes.com/2007/11/premiumnews/).

    I would like to add an image between the category and post title, an image that I can specify when making a new post. How can I do this? I know how to add the image in the theme but I am just not sure how to make it specifiable when creating a post, weather uploading or choosing own that is in the media library. Anyone care to help me out or guide me on how I can complete this?

    Here is an image of what it looks like now.
    Screen Shot 2012-01-04 at 12.01.43 PM.png

    This is the snippet of code:
    PHP Code:
    <div class="post <?php if ($counter == 1) { echo 'fl'; } else { echo 'fr'$counter 0; } ?>">
            
                <?php woo_image('height=57&width=100&class=th'); ?>
            
                <h2><?php the_category(', '?></h2>
                <h3><a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
                <p class="posted"><?php _e('Posted on',woothemes); ?> <?php the_time('d F Y'); ?></p>
                <p><?php echo strip_tags(get_the_excerpt(), '<a><strong>'); ?> <span class="continue"><a title="<?php _e('Permanent Link to',woothemes); ?> <?php the_title(); ?>" href="<?php the_permalink() ?>"><?php _e('Continue Reading',woothemes); ?></a></span></p>
                <p class="comments"><?php comments_popup_link(__('Comments (0)',woothemes), __('Comments (1)',woothemes), __('Comments (%)',woothemes)); ?></p>
                
            </div>

  2. #2
    Quality not quantity. bo5ton's Avatar
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    654
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    You're in the right place!
    You can use the Featured Image option from Wordpress if the theme has it supported. To find out if it is supported, navigate to the post-edit screen in admin and look for a "Set Featured Image' option on the right hand side. Here you can set a featured image for the post and have it display wherever you would like by inserting the wordpress tag for it.

    The wordpress tag for getting the featured image is usually

    PHP Code:
    <?php echo get_the_post_thumbnail($page->ID'thumbnail'); ?>
    To get the post's featured image to display you can put this code into your theme, under your categories but above your title, like so:

    PHP Code:
    <div class="post <?php if ($counter == 1) { echo 'fl'; } else { echo 'fr'$counter 0; } ?>">  
              
            <?php woo_image('height=57&width=100&class=th'); ?>  
              
            <h2><?php the_category(', '?></h2> 
            <?php echo get_the_post_thumbnail$post_id$size$attr ); ?>  
            <h3><a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>  
            <p class="posted"><?php _e('Posted on',woothemes); ?> <?php the_time('d F Y'); ?></p>  
            <p><?php echo strip_tags(get_the_excerpt(), '<a><strong>'); ?> <span class="continue"><a title="<?php _e('Permanent Link to',woothemes); ?> <?php the_title(); ?>" href="<?php the_permalink() ?>"><?php _e('Continue Reading',woothemes); ?></a></span></p>  
            <p class="comments"><?php comments_popup_link(__('Comments (0)',woothemes), __('Comments (1)',woothemes), __('Comments (%)',woothemes)); ?></p>  
                  
    </div>
    You can change the code to suit your needs (size and attributes)

    Your theme however may not yet support the post thumbnail option, in which case you need to implement that first. To implement it you only need put this line of code into your functions.php file:

    PHP Code:
    add_theme_support'post-thumbnails' ); 
    You can refer to the wordpress reference for getting post thumbnails here

  3. #3
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bo5ton View Post
    You're in the right place!
    You can use the Featured Image option from Wordpress if the theme has it supported. To find out if it is supported, navigate to the post-edit screen in admin and look for a "Set Featured Image' option on the right hand side. Here you can set a featured image for the post and have it display wherever you would like by inserting the wordpress tag for it.

    The wordpress tag for getting the featured image is usually

    PHP Code:
    <?php echo get_the_post_thumbnail($page->ID'thumbnail'); ?>
    To get the post's featured image to display you can put this code into your theme, under your categories but above your title, like so:

    PHP Code:
    <div class="post <?php if ($counter == 1) { echo 'fl'; } else { echo 'fr'$counter 0; } ?>">  
              
            <?php woo_image('height=57&width=100&class=th'); ?>  
              
            <h2><?php the_category(', '?></h2> 
            <?php echo get_the_post_thumbnail$post_id$size$attr ); ?>  
            <h3><a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>  
            <p class="posted"><?php _e('Posted on',woothemes); ?> <?php the_time('d F Y'); ?></p>  
            <p><?php echo strip_tags(get_the_excerpt(), '<a><strong>'); ?> <span class="continue"><a title="<?php _e('Permanent Link to',woothemes); ?> <?php the_title(); ?>" href="<?php the_permalink() ?>"><?php _e('Continue Reading',woothemes); ?></a></span></p>  
            <p class="comments"><?php comments_popup_link(__('Comments (0)',woothemes), __('Comments (1)',woothemes), __('Comments (%)',woothemes)); ?></p>  
                  
    </div>
    You can change the code to suit your needs (size and attributes)

    Your theme however may not yet support the post thumbnail option, in which case you need to implement that first. To implement it you only need put this line of code into your functions.php file:

    PHP Code:
    add_theme_support'post-thumbnails' ); 
    You can refer to the wordpress reference for getting post thumbnails here
    Thanks for the help! Your method did work. I have noticed that the theme I have, has a built-in thumbnail function although I can't seem to find it anyway in the CSS so I can alter it's positioning which is a bummer but I guess I'll use this method for now.

  4. #4
    Quality not quantity. bo5ton's Avatar
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    654
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I'm glad that worked for you. Happy to be of some help.

    In terms of the built-in thumbnail function, what you could do is apply and image, then use any of the development addons or extensions in your browser and basically "inspect" the image - it should tell you where it lies and the css it's using. You can then go in and edit that css. If you have a link to your site we could inspect this further.

    But if you are happy with this method for now, then you probably don't need to worry about this so much.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •