doudi2431 2017-07-09 01:31
浏览 51
已采纳

解析错误:语法错误,searchform.php中的意外'}'期待文件结束(Wordpress,XAMPP)[关闭]

Apologies for yet another duplicate, but I have tried solutions in other questions but had no luck.

Wordpress is giving me this error on my custom made child theme (of another custom made theme) Thank you for your help!

"Parse error: syntax error, unexpected '}', expecting end of file in C:\xampp\htdocs\wp\wp-content\themes\site-child\searchform.php on line 11"

This is my searchform.php code (I know I must be missing a simple thing, put me out of my misery!)

Thanks for your help! :)

<?php
/**
 *The template for displaying Search forms.
 *
 *@package Site
 *@since Site 1.0
 */



} else {
//the original contents of search.php should follow
//make sure to close the php tag as appropriate
?>
    <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" role="search">
        <label for="s" class="assistive-text"><?php _e( 'Search', 's' ); ?></label>
        <input type="text" class="field" name="s" value="<?php echo esc_attr( get_search_query() ); ?>" id="s" placeholder="<?php esc_attr_e( 'Search &hellip;', 'site' ); ?>" />
        <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'site' ); ?>" />
    </form>
  • 写回答

1条回答 默认 最新

  • duanjiao3754 2017-07-09 01:38
    关注

    I cannot found any keyword if in your code.

    } else {
    

    Correct:

    if (condition) {
         // 
    } else {
         // 
    }
    

    Or:

    <?php if (condition) : ?>
        html code
    <?php else:?>
        html code
    <?php endif; ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)