Hi sulazix_1,
You can use the following code to insert the gradebook plugin into the frontend of your wordpress site. This code should go at the bottom of the GradeBook.php file just before the ?>
symbol. It’s a hack, but it should work. Let me know how this works out for you.
add_action('wp_head','an_gradebook_ajaxurl');
function an_gradebook_ajaxurl() {
?>
<script type="text/javascript">
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
</script>
<?php
}
function an_gradebook_shortcode (){
init_an_gradebook();
$an_gradebook_develop = false;
$app_base = plugins_url('js',__FILE__);
wp_register_style( 'jquery_ui_css', $app_base.'/lib/jquery-ui/jquery-ui.css', array(), null, false );
wp_register_style( 'GradeBook_css', plugins_url('GradeBook.css',__File__), array('bootstrap_css','jquery_ui_css'), null, false );
wp_register_style( 'bootstrap_css', $app_base.'/lib/bootstrap/css/bootstrap2.css', array(), null, false);
wp_register_script( 'requirejs', $app_base.'/require.js', array(), null, true);
if( 1==1 ){
wp_enqueue_style('GradeBook_css');
wp_enqueue_script('requirejs');
if(gradebook_check_user_role('administrator')){
wp_localize_script( 'requirejs', 'require', array(
'baseUrl' => $app_base,
'deps' => array( $app_base . ($an_gradebook_develop ? '/app_instructor.js' : '/app-instructor-min.js')
)
));
} else {
wp_localize_script( 'requirejs', 'require', array(
'baseUrl' => $app_base,
'deps' => array( $app_base . ($an_gradebook_develop ? '/app_student.js' : '/app-student-min.js')
)
));
}
} else {
return;
};
return '<div id="wpbody-content"></div>';
}
add_shortcode('an_gradebook', 'an_gradebook_shortcode');
Regards,
Aori Nevo