0

theme: functions.php

function one_admin_menu() {
    add_menu_page( 
        'One Dashboard',
        'One',
        'manage_options',
        'one_menu',
        'one_menu_url',
        'dashicons-admin-site',
        1
    ); 
} 
add_action( 'admin_menu', 'one_admin_menu' );

function one_menu_url() {
    include( get_template_directory() . '/includes/admin/main_one/main.php' );
}

main.php

<?php  
function one_admin_website() {
    $web = get_template_directory_uri() . '/includes/admin/main_one/website.php';
    echo $web;
}
?>

<script>
    function import_admin_menu(when, where, what) {
        jQuery(document).ready(function() {
            jQuery(when).click(function() {
                jQuery(where).load(what);
            });
        });
    }
</script>
<ul>
    <li id='website'><a href="#about">Website</a></li>
</u>
<script>
    import_admin_menu('#website', '#one_main_admin', '<?php one_admin_website() ?>' ) 
</script>
<div id='one_main_admin'> </div>

website.php

my problem is here, just trying to echo template directory and i having Fatal error: Uncaught Error: Call to undefined function get_template_directory_uri()

<?php echo get_template_directory_uri(); ?>

what i made wrong? i have try to search in google in stackoverlow, but didin't found anything. thank you for your time

  • Are you loading website.php directly? – Tom J Nowell Jan 5 '17 at 14:51
-2

get_template_directory_url

no

get_template_directory_uri

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.