Read More to image

Find help with FlatPress plugins, report a plugin bug, request or present new plugins.
Post Reply
dart
Posts: 58
Joined: Sun May 30, 2021 4:46 pm

Read More to image

Post by dart » Sat Nov 20, 2021 9:29 pm

I would like to change the [Read More...] output to an 'image png'.
Any advice before I make the attempt ?

I think this is where the change should go...

line 71 - readmore.php

Code: Select all

if (($q && $q->single) || isset($fp_params ['entry'])) {
		$string = str_replace('[more]', "<a id=\"readmore-{$fp_params['entry']}\"></a>", $string);

User avatar
Arvid
FlatPress Coder
Posts: 558
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Read More to image

Post by Arvid » Sun Nov 28, 2021 12:50 pm

Hi,

to change the output to an image gerenally, simply edit line 39 of fp-plugins/readmore/plugin.readmore.php to this:

Code: Select all

$readmoreString = '<img src="path/to/your/image.png" title="' . $lang ['plugin'] ['readmore'] ['readmore'] . '" alt="' . $lang ['plugin'] ['readmore'] ['readmore'] . '" />';

The alt and title attribute hold the "read more" phrase in your selected language, so it is shown on mouseover (title) and if the image cannot be loaded (alt).

Be sure to backup the file before changing anything, so you can go back anytime if something goes wrong.

All the best,
Arvid

dart
Posts: 58
Joined: Sun May 30, 2021 4:46 pm

Re: Read More to image

Post by dart » Sun Nov 28, 2021 3:00 pm

Thanks Arvid ! :D
It gives the posts a whole new look.

User avatar
Arvid
FlatPress Coder
Posts: 558
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Read More to image

Post by Arvid » Sat Dec 18, 2021 1:16 pm

Silly me, it's waaay more simple if you just put the image code directly into the plugin's language file :D

For example, fp-plugins/readmore/lang/lang.en-us.php:

Code: Select all

<?php
$lang ['plugin'] ['readmore'] = array(
	'readmore' => '<img src="path/to/your/image.png" title="Read more" alt="Read more" />'
);
This way, your plugin code stays standard and updateable ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests