weixin_33712881 2016-03-06 06:38 采纳率: 0%
浏览 51

在Wordpress中使用wp_enqueue

I turn to this awesome community , after days of trying to fix this bug, my problem is really simple, but it has got to me. I am trying to enqueue a Java script to my Theme my login Plugin while using the evolve theme.

here is the code snippet that does that, and i used the global function to check if the function is being loaded , and it is not being loaded. 'a' does not change to true.

For some reason it looks like 'wp_enqueue_scripts is not working. I have tried to also add wp_head() with no luck.

  <?php
$GLOBALS['a'] = 'false';
add_action( 'wp_enqueue_scripts', 'load_location' );

function load_location() {
$GLOBALS['a'] = 'true';
    wp_register_script('load_location_test',get_template_directory_uri().'/load_location.js', array('jquery'),'1.1',true);
    wp_enqueue_script('load_location_test');
}

?>
<?php echo $GLOBALS['a'] ?>;

Thanks in advice

The link is http://www.meetntrain.com/register

</div>
  • 写回答

2条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 Android URL如何转成视频/音频,可行吗?
      • ¥20 SQL数据查询,子查询
      • ¥15 c++字符串分割问题
      • ¥15 关于#sql#的问题:没有用命令关闭cdc,手动把系统表开启的cdc右键删除了
      • ¥15 vue+uniapp
      • ¥15 android freedom
      • ¥15 使用自定义的类型代替内置类型可行吗
      • ¥15 关于STM32的SPI和ENDAT接口编码器通信的问题
      • ¥15 关于#pdfbox#生成的PDF文件正常,转图片中文乱码的问题,如何解决?
      • ¥15 ADS中有关DAC控件的使用问题