• Resolved kwaifeh

    (@kwaifeh)


    Hey, great plugin! totally love it!
    I would like to add a “READ MORE” button on the bottom of each post in the widget on the sidebar. Is it possible?
    I saw in the plugin contextual-related-posts.php code there was $after_widget output and I thought perhaps I could use that to output a button with a link to the post like the thumbnail. But I am not sure where this is declared.
    Can you point me in the right direction please?
    I would really appreciate it!
    Thanks!

    https://wordpress.org/plugins/contextual-related-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter kwaifeh

    (@kwaifeh)

    Hey, I was able to do it by adding the following line in line 270 of contextual-related-posts.php :

    $output .= ‘<div class=”crp_readmore_div”>ID ) . ‘” ‘ . $rel_attribute . ‘ ‘ . $target_attribute . ‘>’ . ‘Read more’ . ‘</div>’;

    and in the CSS stylesheet:.crp_readmore_div {
    width:100px;
    margin:auto;
    margin-bottom:10px;
    background-color:#f6f0e9;
    border:1px solid #7A5236;
    font-size:14px;
    display:block;
    }

    If someone wants an explanation:
    I copied the title output and put read more instead of the $title.
    then I added a div so as to contain this read more inside an element which I can customize with css to be a button. and that is the css below the thing. Anyway if you want to use this – just copy the CSS to your stylesheet with the colors you want, and copy the php code to line 270 of contextual-related-posts.php which you can find in the plugin directory.

    Plugin Author WebberZone

    (@webberzone)

    Thanks for the code and the update. Future versions should have a better way to do this.

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

The topic ‘Help with adding READ MORE button to the widget’ is closed to new replies.