staggsxi
Member
Posted 1 year ago #
I was wondering if there was a way to add a permalink inside of a post. Say I have content like:
Some content, check out [permalink]more content here[/permalink].
A another time I might want to say...
Some content, [permalink]some more content here[/permalink]
Is there a way to do this? I figure it's a better solution than using <--more--> for some people.
staggsxi
Member
Posted 1 year ago #
staggsxi
Member
Posted 1 year ago #
Made my own solution. Works like [morelink title="Continue on for screenshots!"] and posts a permalink with the title as the sentence.
<?
/*
Plugin Name: Custom Shortcodes
Description: Contains code to create custom shortcodes
Author: Stephen Agnic
Version: 1.0
*/
function do_more_link($attr)
{
extract(shortcode_atts(array( //extract the attributes from the array and replace
'title' => '', //the defaults with the ones defined in the tag if any
), $attr));
$link = get_permalink();
if (!is_single())
$dolink = '<a href="'.$link.'" title="'.$title.'">'.$title.'</a>';
else
$dolink = '';
return $dolink; //return the output.
}
add_shortcode('morelink', 'do_more_link');
?>