Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there any way to make my plugin work based on a URL instead of creating a page and attaching a shortcode? IE http://mysite.com/myplugin and that would bring up the starting page of the plugin

share|improve this question
    
As far as i know the user would have to create a page and choose the page template for that page or integrate a shortcode into the pages / posts in order to retrive info but thats an intresting question.. waiting to see opinions on the subject –  Sagive SEO Nov 12 '11 at 19:16
    
What exactly do you mean by "making the plugin work"? If a plugin is activated it always "works" (i.e. will be loaded). Do you mean enabling/disabling the display of its output dependent on URL? Please elaborate by editing your question. The more precise you are, the more likely will a correct answer be given. –  Johannes Pille Nov 12 '11 at 21:09

1 Answer 1

up vote 0 down vote accepted

You can do this by using the actions generate_rewrite_rules & template_redirect

more info can be found at http://wp-fun.co.uk/2007/12/24/creating-custom-urls/#axzz1dXkrd62P

share|improve this answer
    
Thanks this is more or less what I was looking for. Its enough for me to adapt for what I'm hoping to do. My only real concern with this example is that its meant more if you were passing a option (Query Variable) into your plugin but worse case scenario I can just make it equal to 1. –  Rocco Valotta Nov 13 '11 at 14:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.