0

When I include some div into a plugin I am creating I get an error when activating the plugin. "The plugin generated 33 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin."

Though the plugin works on the site but I get an error when activating it. here is the plugin code. I want it to display the text on top of the page. I understand I need to use some hooks, but which one? hre is a link showing what I want. http://wsoplugins.com/wp-content/uploads/2012/04/Captur.png

<?php
/*
Plugin Name: test
Plugin URI:
Description: test
Author: Ronny Kibet
Author URI: 
version: 1.0
*/

?>
<div id="bar">hello there</div>
5

1 Answer 1

1

The answer...

add_action('init', 'text_on_top');

function text_on_top(){
    ?>
        <div id="bar">hello there</div>
    <?
}

Never output anything outside of a function, use a suitable action/filter to do so!

0

Your Answer

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

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