WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use get_template_part() function to get theme options page content like this:

function setup_theme_admin_menus() {
    add_theme_page( "Theme Options", "Theme Options", "read", "theme_options", "theme_options" );
function theme_options() {

And it seems to work perfect when I use it on my localhost but when I relocated it online it stopped rendering desired HTML. When I use something like:

function theme_options() {
    echo "Hello World!";

It works as expected both online and locally. No idea why it is happening.

share|improve this question

The get_template_part() function is intended to include a template-part file in the template - i.e. on the front end.

Use include() instead, along with get_template_directory():

function theme_options() {
    include( get_template_directory() . '/content-options.php' );
share|improve this answer
I'm not sure now what my problem is. Your structure doesn't work either. I tried even putting something like include("fullurl.com/wp-content/themes/theme/content-options.php"); and it doesn't work too. But when I echo something it generates content as expected ... WTF!?!? – LoomyBear Aug 22 '13 at 12:20
It seems like I have a corrupted content-options.php file! Sorry for bothering ... how to erase my question form the history? The amount of shame on me right now is unbearable!! – LoomyBear Aug 22 '13 at 12:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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