How can I add a piece of html code to run on every WordPress page

admin

Administrator
Staff member
I have an interesting challenge that I'm coming up short on (I'm not a WordPress plugin developer). I am using a site that has <em>OptimizePress</em> as a theme. <em>Optimizepress</em> calls
Code:
the_content
many times in building a page.

I want to include a little code snippet in the body of every page.

Code:
if ( function_exists( "transposh_widget" ) ) {
    transposh_widget(array(), array(
        'title'       =&gt; 'Translation',
        'widget_file' =&gt; 'flags/tpw_flags_css.php',
    ) );
}

That shows a couple of flags and lets you switch languages on the site. So I need a div set to fixed position / 0,0 (I can adjust later for looks) that has that in it.

Other than outputting something in
Code:
the_content
, which seems to be the popular way to do this, what is the best way to achieve getting this on every page of a wordpress site?

<strong>Update</strong>

The code below started - here was my final code that output flags only in the top right corner of the site on every page.

Code:
&lt;?php
/*
Plugin Name: Transposh Flags in Header
Description: Embed Transposh Header Code (in Footer of Page)
*/

function insert_my_footer() {
    echo '&lt;div style="display:block; top:30px; right: 50px; position: fixed; color:white;"&gt;';
  if (function_exists("transposh_widget")) {
    transposh_widget(array(),
                     array('title'=&gt;'',
                           'widget_file' =&gt; 'flags/tpw_flags.php') );
    }
    echo '&lt;/div&gt;';
}

add_action('wp_footer', 'insert_my_footer');
?&gt;