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!
Related Posts:
- How do I force wp_enqueue_scripts to load at the END of ?
- How do I make my plugin load before the headers are output so I can redirect wordpress?
- Add code into on a per page/post basis
- How to remove/hide action links cluttering under specific plugins’ names
- Change My Basket text in the header of WooCommerce Artificer theme
- How to send “Location” header on plugin form submit event?
- Meteor Slides as header only for homepage and Use featured image of each page as header for respective pages
- Strip HTML comments from plugins in header/footer
- send_headers don’t work on wordpress multisite
- adding meta data using plugin to top of head
- WordPress Redirect Not Working – AJAX Callback Response Not Picked Up
- Headers already sent when I try to add headers via a shortcode
- WordPress repository forbids me call wp-load.php in non-WordPress file
- Show an image in my header.php
- Headers Content-Security-Policy CSP Major Issue
- How to debug error message: Cannot modify header information
- Object method calling for global $wpdb in header.php
- What does making sure “that your theme is WordPress header and footer tag enabled” mean?
- Know which plugin is calling JS in wp_head()?
- My single.php page does not show the related data to the post which is clicked
- Enqueue stylesheet in plugin for wp-login.php
- Get ‘Headers already sent’ error for the plugin I am creating when I try to login
- Custom Login Page — wp_signon Headers Already Sent?
- Adding Plugin Assets to Header
- Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection
- echo get_option in header template
- Cannot access WP admin because plugin returns 204
- force jQuery to load in the head
- Edit page header on a custom plugin
- How do i ‘deactivate’ a plugin only on a certain page template?
- How do I fill the Home Description?
- Hook for plugin to insert into entry-meta
- sliding/fading header plugin or approach suggestion
- How to make a slider hearder?
- Prevent WordPress from sending set-cookie http header
- How to change the width of certain paragraph or header blocks?
- Modifying server’s response to API endpoint
- How to fix shifting header after installing speed / cache plugins?
- Cannot modify header information – headers already sent during plugin activation
- Debug in WP backend
- How to overlay a webcomic plugin on top of a header image?
- Set Content-Type header in do_parse_request filter
- Primary Menu doesn’t show because of w3 cache
- Insert Plugin on a custom page
- Problems with installing and deleting plugins
- Change text “My Basket” in woocommerce artificer theme
- WordPress repository forbids me call wp-load.php in non-WordPress file
- How to laod wp_enqueue_style to another header i created my self
- Cannot modify header information – headers already sent by
- Footer option is missing in Customiser
- How do I show data from gravity forms in my template? [closed]
- Show a different number of posts per page depending on context (e.g., homepage, search, archive)
- How can I add a featured image to a page?
- How to customize a plugin whilst maintaining ability to upgrade
- What does a security risk in a plugin look like?
- How to generate/update a XML sitemap without plugins?
- How to assign user a role if none is present when logging in
- Registration Form Validation in wordpress
- Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint
- Access wordpress functions inside a plugin class
- How to implement Sentry on WordPress? [closed]
- How to prevent users to download videos from lms website?
- How to bypass the Easy Digital Downloads checkout process?
- Assign post format to categories
- custom payment gateway in woocommerce failed to connect to remote api server
- Parse error: syntax error, unexpected ‘new’ (T_NEW) in /misc/41/000/204/381/9/user/web/ragami.net/wp-settings.php on line 219
- Ajax call returning 0
- How to create restrict content to users (by user, not by role)
- Some code in shortcode function being ignored
- do_shortcode is outputting a string
- What is @Action in WordPress?
- Plugin Options not being output
- How to have sample page for each new register users in a membership website
- Add Shortcode tag in Widget/Sidebar
- How to edit a published post?
- Get all the URLs of the pages that uses a specific shortcode
- Pagination shows Same posts
- Plugin generating unexpected output – on WP mysql dump import
- WordPress plugin: Getting posts where checkbox selected
- How to auto strip hyperlinks & images in wordpress post
- How can I temporarily remove content from all pages, but leave up URL?
- WP_Table_List and ob_start() memory limit
- Best practice when modifying plugins CSS [duplicate]
- override plugin function in a class not working
- JOIN and SUM different statement results (Mailster Database)
- need click to clipboard button on my site
- Classes registration in WordPress useing woocommers
- Performing CRUD operations on front end in wordpress
- issue concerning ob_end_flush functions.php
- Create a link that calls our custom function in WordPress
- Shortcode function not showing up on mobile browser
- plugin: rewrite rules are lost when WP updates
- Woocommerce list variations that are added already to cart in Single Product
- {status}_{post_type} does not run correctly?
- Upload profil picture to every member
- Should I Save widget HTML to a file cache?
- set cookies for my whole site is not working
- How do I access cPanel features within WordPress?
- Please Check this ‘.htaccess’ File
- Request initiator chain contains old CDN