Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SOLVED: Link in Read More button not working. Help!
#1
Hi, so i'm working with the News Manager plugin, and I guess it's no longer supported, which is fine, but I'm having a problem with getting the URL to work for a 'Read More' button I've added. Currently, in the News Manager plugin, if you have an excerpt, it just adds '[...]' to the end of the post. It's not a link or anything. I know you can access the full post by clicking on the title, but not everyone will think that way. I've tried incorporating PHP in a number of different ways to get the URL working to bring the button to the full post, but none of them are working. On other pages, I would use
PHP Code:
<?php echo $url?>
to get the URL. It does not work in this instance. Here is what I have:

PHP Code:
/*******************************************************
 * @function nm_create_excerpt
 * @param $content the post content
 * @return a truncated version of the post content
 */
function nm_create_excerpt($content) {
  global 
$NMEXCERPTLENGTH;
  
$len intval($NMEXCERPTLENGTH);
  
$content strip_tags($content);
  if (
strlen($content) > $len) {
    if (
function_exists('mb_substr'))
      
$content trim(mb_substr($content0$len'UTF-8')) . '...<p><a href="<?php echo $url; ?>"><button type="button" class="btn btn-readmore">Read More</button></a></p>';
    else
      
$content trim(substr($content0$len)) . '...<p><a href="<?php echo $url; ?>"><button type="button" class="btn btn-readmore">Read More</button></a></p>';
  }
  return 
"<p>$content</p>";


It's on the 'functions.php' file inside the root folder for the plugin.

Any help would be most appreciated! Thank you! Smile[/quote]
Reply


Messages In This Thread
SOLVED: Link in Read More button not working. Help! - by ccrouleau - 2015-03-17, 01:56:26



Users browsing this thread: 1 Guest(s)