ThemeShaper Forums » Thematic

[closed]

Read more image

(17 posts)
  • Started 9 years ago by boerenooi
  • Latest reply from Manuel
  • This topic is resolved

Tags:

  1. boerenooi
    Member

    I have been playing around with the .more-link tag, and I want my "read more" to be an image, and not text. Should I change this in the main Thematic theme or just in the css?

    Thanks :)

    Posted 9 years ago #
  2. You change nothing in the main Thematic theme. Never.

    You set yourself up a childtheme and do your changes in there. Always.

    How to set up a Thematic childtheme? Read more.

    Posted 9 years ago #
  3. boerenooi
    Member

    Hi Manuel

    I've made a childtheme, and I have been working with that so far, ONLY! My theme is almost complete, I am going to make it available for a free download (for anyone who is interested). This "read more" issue is just boggling my mind. Is there any advice that you could give me on this matter?

    Posted 9 years ago #
  4. boerenooi
    Member

    Is there no one that can help me on this subject?

    Posted 9 years ago #
  5. Hi,

    try this one in your child theme's functions.php:

    function my_more_text($content) {
    	$content = '<img src="http://www.google.de/intl/de_de/images/logo.gif" alt="Read More" /> ';
    	return $content;
    }
    add_filter('more_text', 'my_more_text');

    You should change the URL to your needs :)

    Chris

    Posted 9 years ago #
  6. boerenooi
    Member

    Thank you Chris!!! You guys are superheros!! Just one last question... If I were to change the image URL to /image/readmore.jpg what is the trick to that?

    Posted 9 years ago #
  7. boerenooi
    Member

    ...aparently for a WP theme, I cant just use the simplest directory, but I need to add extra php?

    Posted 9 years ago #
  8. Sorry, it sounded like you were doing the changes in the original Thematic theme, and not in your childtheme. :)

    To your last question:

    If you speak of the “image” directory inside of your childtheme directory then you would just replace http://www.google.de/intl/de_de/images/logo.gif with image/readmore.jpg in the code Chris has posted for you, but if your image directory sits in your root directory (which is not recommended — but works for now anyhow) then you would change it to /image/readmore.jpg (note the leading slash).

    Or did I not get it again? :D

    Posted 9 years ago #
  9. boerenooi
    Member

    YAAAAARRRRRRRRRRR :D :D :D

    I was just about to say that I found it!

    function my_more_text($content) {
    $content = '<img src="' . get_bloginfo('stylesheet_directory') . '/images/readmore.jpg" alt="Whatever" />';
    return $content;
    }
    add_filter('more_text', 'my_more_text');

    Thanks guys!! Im getting SO much closer to showing you my first Thematic child theme!! IM SO EXCITED!!

    :D

    Posted 9 years ago #
  10. Heh :)

    But if you want to make it available as a download (like you said), then you should really create an image directory inside of your childtheme directory and change the code we just talked about accordingly.

    As you might have noticed: the leading slash makes your browser look at the root directory of your webspace. If you remove the leading slash the browser will start looking in the directory where the “command” came from, which is your stylesheet inside of your childtheme directory.

    Posted 9 years ago #
  11. Whoops, you already did that. What is it with me today? :D

    Posted 9 years ago #
  12. boerenooi
    Member

    ... dial up? :P

    Posted 9 years ago #
  13. Telegraph. :P

    Posted 9 years ago #
  14. Smoke signals! :)

    Posted 9 years ago #
  15. lqunta
    Member

    :) The smoke signals work too...

    Just a rather 'open' question, what of if one wants to replace the 'read more' text with something more custom?
    - I.e, have the text 'view details' for Posts, and 'open page' for pages.

    [ trying with the above code ]

    Posted 9 years ago #
  16. Try this example: NOOB ? - Customize "Read More" Quicktag...How? / 2.1 more_text()

    Chris

    Posted 9 years ago #
  17. When I look at Chris’ code I think you have to replace the stuff after $content = with something like this

    <?php if (is_post()) : ?>
        <span class="readmore_post">View details</span>
    <?php endif; ?> <!--endif post-->
    
    <?php if (is_page()) : ?>
        <span class="readmore_page">Open page</span>
    <?php endif; ?> <!--endif page-->

    But I have no idea about how to put the PHP inside of PHP and the dots and spaces and parentheses and all that. :D


    ---------------------------------------------------------
    And Chris, if you read this, can’t you give code some background:#FFFF99; goodness or something like that in here? Sometimes code is hard to spot when it’s inside a sentence.
    ---------------------------------------------------------

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.