Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Styling the 'Read More' of the: the_excerpt(__('Read more')); WordPress

  • SOLVED

What is the proper way to add style to the Read more in the style.css and then have the new style show up when using: the_excerpt(__('Read more'))

Answers (5)

2011-12-21

Julius J. answers:


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


You can try this code :) paste it to your functions.php file :)


Julius J. comments:

Woops, sorry. I don't know how I forgot to put " there.


69developer comments:

This worked..Thanks!

2011-12-21

Charles Klycinski answers:

Julius J, you did a typo in the code

return '<a class="excerpt href=

should be :

return '<a class="excerpt" href=

2011-12-21

RNWest answers:

Try,

.more-link {my: styling;}

if you use the function above

try

.excerpt a {my:styling;}

Thanks

2011-12-21

Navjot Singh answers:

the_excerpt() does not accept any arguments now. To add a read more link the proper way is to add the following code to functions.php

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


Check the class="more-link" in above code. Now you can add a .more-link class in your css file and style it as the way you want.


69developer comments:

This worked, same as the first post.

2011-12-22

Albert Shala answers:

Using the above snippet to add a class to your more link and just style it, something simple to start you off:
.more-tag {
color: #FF9900;
font-size: 12px;
line-height: 16px;
}