0

I need to know how to take the output of a custom built Wordpress plugin and output it onto a specific page.

I know that I need to use the add_action() / add_filter() functions to call the function which outputs the plugins output when a wordpress hook function runs.

Currently I am using the 'the_content' hook. This outputs my plugins output to all pages in my theme which call the the_content() function.

Which hook can I use to make the output only appear on a specific page. Also It would be useful to know how to create a page using my plugin.

2 Answers 2

0

Checkout is_page()

if (is_page(123)) {
  // put your hooks here
}
Sign up to request clarification or add additional context in comments.

Comments

0

put your code in a file inside plugin directory then use this

   function page_directory()
{
    if(is_page('123')){   
        $dir = plugin_dir_path( __FILE__ );
        include($dir."custom/page.php");
        die();
    }
}

add_action( 'wp', 'page_directory' );

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.