• Resolved staggsxi

    (@staggsxi)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter staggsxi

    (@staggsxi)

    No one has a solution?

    Thread Starter staggsxi

    (@staggsxi)

    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');
    
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add Permalink anywhere in post’ is closed to new replies.