Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in ...解析错误逃生PHP
这是我得到
<?php
function my_custom_js() {
echo " <script>" ;
echo " jQuery(document).ready(function(){
jQuery('#secondary-front .first h3').addClass('
<?php $options = get_option('mytheme_theme_options');
if(!empty($options['first_widget_icon'])) echo $options['first_widget_icon']?> ');
jQuery('#secondary-front .second h3').addClass('<?php $options = get_option('mytheme_theme_options');
if (!empty($options['second_widget_icon'])) echo $options['second_widget_icon'];?>');
jQuery('#secondary-front .third h3').addClass('<?php $options = get_option('mytheme_theme_options');
if (!empty($options['third_widget_icon'])) echo $options['third_widget_icon'];?>');
});
";
echo "</script> ";
}
add_action('wp_head', 'my_custom_js');
?>
我不能得到这个代码正确逃避错误,我有PHP>的jQuery> PHP
这一切都搞砸了,为什么你在'<?php'标签里有更多'<?php'。重写它的时间 – 2013-03-13 07:18:26
你宁愿开心使用/学习AJAX。 – hjpotter92 2013-03-13 07:19:15
请了解['wp_localize_script'](http://codex.wordpress.org/Function_Reference/wp_localize_script)(和'wp_enqueue_script')。 – hakre 2013-03-13 07:21:02