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.


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' );
  • 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
  • 1
    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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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