2011-07-29, 00:44:30
polyfragmented Wrote:I am currently trying to hack the page excerpt function to modify the [...] at the end of excerpts. I'd like the [...] string to be a link pointing to the full post version as the headline already does.
This should be easy to accomplish for someone with more PHP experience. Maybe you guys can give me a hint.
I looked around in other news manager related files and found the code which builds the URL for the headline (/plugins/news_manager/inc/site.php), but I'm unable to recreate the functionality in the excerpt code.
/plugins/news_manager/inc/functions.php, around line 150:
Code:$content = trim(mb_substr($content, 0, $len, 'UTF-8')) . ' [...]';
I modified it like this so far:
Code:$content = trim(mb_substr($content, 0, $len, 'UTF-8')) . ' <a href="" title="">[weiterlesen …]</a>';
I tried inserting <?php echo $url; ?> (from site.php) which gets printed as-is, tried separating it by way of . <?php echo $url; ?> ., to no avail.
Help?
I just tested this out and accomplished it with 2 small edits to "news_manager/inc/functions.php" and "news_manager/inc/site.php". Below are my edits and the edited files are attatched to this post (ver: 2.2.4).
File: news_manager/inc/site.php : Around Line 99
Change
Code:
if ($excerpt) $content = nm_create_excerpt($content);
Code:
if ($excerpt) $content = nm_create_excerpt($content, $url);
File: news_manager/inc/functions.php : Around Line 151-153
Change
Code:
$content = trim(mb_substr($content, 0, $len, 'UTF-8')) . ' [...]';
else
$content = trim(substr($content, 0, $len)) . ' [...]';
Code:
$content = trim(mb_substr($content, 0, $len, 'UTF-8')) . '.. <a href="'.$url.'">Read More</a>';
else
$content = trim(substr($content, 0, $len)) . '.. <a href="'.$url.'">Read More</a>';