[wp-hackers] Get URL of page with shortcode

Michael Van Winkle mike at mikevanwinkle.com
Wed Feb 2 14:31:01 UTC 2011


I'm not sure why you couldn't just capture the post ID of the post
running the shortcode and save it in the options table? Have you tried
this? just use

update_option('my_shortcode_page', $post->ID);

Mike

On Wed, Feb 2, 2011 at 12:59 AM, Eddie O'Leary <eddie at teamcolab.com> wrote:
> It seems that you could put the following code inside the shortcode
> function:
>
> global $post;
> $url = get_permalink($post->ID);
>
> $url will equal the permalink of the post that is parsing the shortcode.
>
> Thanks,
>
> Eddie
>
> On Tue, Feb 1, 2011 at 10:41 PM, Ryan Bilesky <rbilesky at gmail.com> wrote:
>
>> I am looking for a way in my plugin the get the URL for the page which
>> contains a specific shortcode for my plugin, is there an easy way to do
>> this, or do I need to do a query with wpdb against the page content?
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> Eddie O'Leary
> President
> CO+LAB Multimedia
>
> 201 W 7th St.
> Richmond, VA 23224
> www.teamcolab.com
>
> 804-433-3582 office
> 804-475-4502 cellular
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Mike Van Winkle
708-289-3136
mike at mikevanwinkle.com
http://www.mikevanwinkle.com
http://www.twitter.com/mpvanwinkle
http://www.facebook.com/mpvanwinkle


"All excellent things are as difficult as they are rare." -Spinoza


More information about the wp-hackers mailing list