Support » Plugins » Hacks » Use plugin on specific page

  • Hello,

    First off all, i’m new to wordpress plugins, but my client requested it.

    I’m making an plugin for wordpress where an user can insert some data and blahblahblah…

    The problem is, the plugin must be only visible on 1 page.

    So how can i acief this. That the plugin will be actif on only one page? And how do i insert the content there then, Do i have to call an global function of my script that returns some HTML? Or do i have to do something diffrent?

    Thanks in advantage

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator bcworkz


    Depends on what that one page is. Front end, back end? Can it be identified in code somehow? Similar to the is_home() tag? Then just wrap any function calls to your plugin that generate output in an if() block on the page template.

    Another possibility. If any users that have page publish capabilities can be trusted to not use a particular template, you could call your plugin functions from that one template, create the one page based on it, and then simply create no more pages from that template.

    it’s an front-end plugin.

    and how do you mean this part:

    Can it be identified in code somehow?

    And how would that second option look then? because i can’t find an option where you can select wich template to use… mayby i’m overlooking to it, but i’m just compleet new to wordpress

    Moderator bcworkz


    To identify in code. Hard to say specifically as there are many possibilities, but only some, or maybe none may apply to your unique situation. It may be as simple as “if the current post ID equals a number, show the plugin content”.

    Page template. I’m referring to the WP definition of page, a special static post type, not a generic web page. When creating a new page (different than new post) there’s a pull down field for which template to use in the page attributes block. To have your template show up here, the file needs to be in your theme folder and have a particularly formated first few lines identifying it as a template.

    @ak75963, i will take a look at that

    @bcworkz, where can you select an difrnt template then? because i don’t see an option like that when i create an new page…

    Moderator bcworkz


    Pull down the screen options tab and check mark Page Attributes under Show on Screen.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Use plugin on specific page’ is closed to new replies.