ThemeShaper Forums » Thematic

[closed]

add image as read more link

(8 posts)
  • Started 2 years ago by simonafilote
  • Latest reply from simonafilote
  • This topic is not resolved

Tags:

  1. Hi there

    I'd like to add an image as a 'read more' marker instead of the text link in my Thematic child theme. I read on a different forum I would need to add the following code in my index.php file, however since I'm very new to php I don't know exactly where in the file I should insert this.

    <?php the_excerpt (); ?>
    " class="more-button"> 

    My index.php looks like this:

    <?php

    // calling the header.php
    get_header();

    // action hook for placing content above #container
    thematic_abovecontainer();

    ?>

    <div id="container">

    <?php thematic_abovecontent(); ?>

    <div id="content">

    <?php

    // create the navigation above the content
    thematic_navigation_above();

    // calling the widget area 'index-top'
    get_sidebar('index-top');

    // action hook for placing content above the index loop
    thematic_above_indexloop();

    // action hook creating the index loop
    thematic_indexloop();

    // action hook for placing content below the index loop
    thematic_below_indexloop();

    // calling the widget area 'index-bottom'
    get_sidebar('index-bottom');

    // create the navigation below the content
    thematic_navigation_below();

    ?>

    </div><!-- #content -->

    <?php thematic_belowcontent(); ?>

    </div><!-- #container -->

    <?php

    // action hook for placing content below #container
    thematic_belowcontainer();

    // calling the standard sidebar
    thematic_sidebar();

    // calling footer.php
    get_footer();

    ?>
    --------

    After inserting the php I guess I could manage styling the css:

    .more-button {
    background: url(images/more-button.gif) no-repeat 0 0;
    cursor: pointer;
    width: 77px;
    height: 22px;
    font-size: 0;
    line-height: 0;
    text-indent: -9999px;
    display: block;
    }

    Thanks
    Simona

    Posted 2 years ago #
  2. The code to be inserted in the index.php didn't come right for some reason?

    <?php the_excerpt (); ?>
    " class="more-button"> 

    Posted 2 years ago #
  3. <?php the_excerpt (); ?>
    <a href="<?php the_permalink(); ?>" class="more-button">&nbsp;</a></a>

    I figured I need to put the code between backticks...

    Posted 2 years ago #
  4. Thanks, I read it, but still confused...does that mean that I need to add the following in my functions.php?

    function new_excerpt_more($more) {
    	return '[.....]';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    
    function new_excerpt_more($more) {
           global $post;
    	return '<a href="'. get_permalink($post->ID) . '">Read the Rest...</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    That didn't work out...

    Posted 2 years ago #
  5. you don't need the new_excerpt_more() function twice, that's 2 different examples for the same thing. and didn't work out how? what happened instead? if you want an image then you need to return some kind of image code instead of [....] or the a link in the other example..

    Posted 2 years ago #
  6. I was expecting to see the [...] characters showing automatically on my blog posts on the homepage after inserting the code of the first example, but I'm guessing I misplaced the code.

    This is my functions.php content:

    <?php
    function childtheme_override_postmeta_entrydate() {
    	$entrydate = '<span class="meta-prep meta-prep-entry-date">' . __('', 'thematic') . '</span>';
    	$entrydate .= '<span class="entry-date"><abbr class="published" title="' . get_the_time(thematic_time_title()) . '">';
    	$entrydate .= '<span class="month">' . get_the_time('M ') . '</span>';
    	$entrydate .= '<span class="day">' . get_the_time('d') . '<span class="sep">, </span></span>';
    	$entrydate .= '<span class="year">' . get_the_time('Y') . '</span>';
    	$entrydate .= '</abbr></span>';
    
    	return apply_filters('thematic_post_meta_entrydate', $entrydate);
    }
    
    function new_excerpt_more($more) {
    	return '[.....]';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    ?>
    Posted 2 years ago #
  7. Maybe it's worth mentioning that even before I added the code above, my blog wouldn't automatically add a read more link to posts, thus I had to add it manually in each post.

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.