[resolved] Add Permalink anywhere in post (3 posts)

  1. staggsxi
    Posted 7 years 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.

  2. staggsxi
    Posted 7 years ago #

    No one has a solution?

  3. staggsxi
    Posted 7 years 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>';
    		$dolink = '';
    	return $dolink; //return the output.
    add_shortcode('morelink', 'do_more_link');

Topic Closed

This topic has been closed to new replies.

About this Topic