Title: Problem with more link
Last modified: September 1, 2016

---

# Problem with more link

 *  [17Mark](https://wordpress.org/support/users/17mark/)
 * (@17mark)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/problem-with-more-link/)
 * Hi, I don’t know why it is not working. I have function where I change class 
   according to category. And this function I need insert into more link of post
   in category. But class in link isn’t display. There is code:
 *     ```
       function custom_color(){
       	if (in_category('exterier'))
       		{echo 'green';}
       	elseif (in_category('interier'))
       		{ echo 'cyan';}
       	else echo 'default';
   
       }
   
       function modify_read_more_link() {
           return '<a class="more-link' . custom_color() . '" href="' . get_permalink() . '">Čítať viac</a>';
       }
       add_filter( 'the_content_more_link', 'modify_read_more_link' );
       ```
   
 * Thanks for help.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [girlieworks](https://wordpress.org/support/users/girlieworks/)
 * (@girlieworks)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/problem-with-more-link/#post-7634093)
 * Hi, [@17mark](https://wordpress.org/support/users/17mark/). Change each `echo`
   in your `custom_color` function to `return` instead.
 * Also, you’re probably going to want to add a space just after `more-link` in 
   the `modify_read_more_link` function, like so:
 * `'<a class="more-link '`
 * (unless you actually _want_ to end up with single class names like `more-linkgreen`
   instead of two separate class names like `more-link green`)
 *  Thread Starter [17Mark](https://wordpress.org/support/users/17mark/)
 * (@17mark)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/problem-with-more-link/#post-7634223)
 * Thanks it is working but I have little problem. `function modify_read_more_link(){
   
   return ‘<a href=”‘ . get_permalink() . ‘”><div class=”more-link ‘ . custom_color().‘”
   >Čítať viac</div></a>’; } add_filter( ‘the_content_more_link’, ‘modify_read_more_link’);`
   When I have this code, link is duplicated. There is picture[](https://s31.postimg.org/a329pnmxn/duplicated.png)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem with more link’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [17Mark](https://wordpress.org/support/users/17mark/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/problem-with-more-link/#post-7634223)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
