1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How To Make Read More as an Image????

Discussion in 'WordPress' started by mdvasanth86, Oct 16, 2009.

  1. #1
    Hello,


    How do i make the Read More thing in Wordpress blogs an Image..??

    I dont want the read more or read the full entry text..

    I want an image there..

    Is it possible ???


    I tried, failed.
     
    mdvasanth86, Oct 16, 2009 IP
  2. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It's possible with a self-hosted WordPress installation. In your Theme's index.php look for something like this (note: I wrote my Theme from scratch using actual semantics, not the crap that passes for semantics in WordPress) --

    
    <a href="<?php the_permalink() ?>#more">Read the rest of <cite><?php the_title(); ?></cite>...</a>
    
    PHP:
    or

    
    echo '<a href="',the_permalink(),'#more">Read the rest of <cite>', the_title(),'</cite>...</a>';
    
    PHP:
    Just replace the text between the <a> and </a> tags with an image.
     
    Dan Schulz, Oct 16, 2009 IP
  3. mdvasanth86

    mdvasanth86 Notable Member

    Messages:
    3,869
    Likes Received:
    285
    Best Answers:
    0
    Trophy Points:
    230
    #3


    Thanks for the reply.

    I didn't get you.

    This is the code i have in my index.php file.


    
    
    <?php get_header(); ?>
    
    <div id="content">
    
        <div id="contentleft">
        
            <div class="postarea">
        
                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                
                <div <?php post_class(); ?>>
                
                    <h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
                    
                    <div class="postauthor">
                        
                    </div>
                    
                    <?php the_content(__("Read More", 'studiopress'));?><div class="clear"></div>
                    
                    <div class="postmeta">
                        
                    </div>
                        
                </div>
                
                <?php endwhile; else: ?>
                        
                <p><?php _e('Sorry, no posts matched your criteria.', 'studiopress'); ?></p><?php endif; ?>
                <p><?php posts_nav_link(' &#8212; ', __('&laquo; Previous Page'), __('Next Page &raquo;')); ?></p>
            
            </div>
        
        </div>
                
        <?php include(TEMPLATEPATH."/sidebar.php");?>
    
    </div>
    
    <?php get_footer(); ?>
    
    
    
    
    
    PHP:
     
    mdvasanth86, Oct 16, 2009 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Oh, you're using one of Brian Gardner's Themes. Don't get me wrong, I have a lot of respect for him, but his Themes all have on thing in common -- they're too complicated for their own good.

    In this line,

    <?php the_content(__("Read More", 'studiopress'));?><div class="clear"></div>
    PHP:
    replace the text "Read More" with your image code and see what happens (I doubt it'll let you though which is pure BS -- again, his Theme code is far too complex and complicated for its own good)
     
    Dan Schulz, Oct 16, 2009 IP
    mdvasanth86 likes this.
  5. mdvasanth86

    mdvasanth86 Notable Member

    Messages:
    3,869
    Likes Received:
    285
    Best Answers:
    0
    Trophy Points:
    230
    #5


    Thats the first thing I tried, failed...

    Its throwing some error. :(:confused:


    EDIT:

    Hey! It worked with a strange modification.

    I used the traditional <img src= "image url"> -> ERROR

    I used <img src='image url'> -> It worked.


    Does anyone have an explanation for that ???
     
    Last edited: Oct 16, 2009
    mdvasanth86, Oct 16, 2009 IP
  6. Spawny

    Spawny Well-Known Member

    Messages:
    252
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #6
    try this, on your index.php

    <?php the_content('<span class="read-more">read more</span'); ?>
    Code (markup):

    then style that span on your css ie

    .post .read-more
    {
       width:93px;
       height:26px;
       float:right;
       display:block;
       text-indent:-2000px;
       margin-top:20px;
       background:url('images/readmore.png') 0 0 no-repeat;
    }
    Code (markup):
     
    Spawny, Oct 16, 2009 IP
    mdvasanth86 likes this.
  7. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #7
    It's the PHP parser. If you escape the double quotes, it'll work. Here's an example:

    <img src=\"image url\">

    Note the backslashes BEFORE the quotation marks. They're "escaping" the quote marks so they don't get picked up by the PHP parser.
     
    Dan Schulz, Oct 16, 2009 IP
  8. mdvasanth86

    mdvasanth86 Notable Member

    Messages:
    3,869
    Likes Received:
    285
    Best Answers:
    0
    Trophy Points:
    230
    #8
    Hey, Thanks for that.
    It already worked.:)



    Oh! Okay. Now I understand. Thanks Dan.. Repped ya.! :D
     
    mdvasanth86, Oct 16, 2009 IP