php - 文件意外结束,期待 elseif (T_ELSEIF) 或 else (T_ELSE) 或 endif (T_ENDIF)?
问题描述
我在使用 WordPress 标签时遇到问题。创建标签并将标签附加到帖子后,URL 给我以下错误:
解析错误:语法错误,文件意外结束,在 /var/www/html/example.com/wp-content/themes/example/index.php 中需要 elseif (T_ELSEIF) 或 else (T_ELSE) 或 endif (T_ENDIF)第 30 行
这是我的 index.php 的代码:
<?php
/*
Template Name: Blog Page
*/
get_header();
?>
<!-- PAGE LAYOUT //-->
<section id="page-title" style="background: url(<?php echo get_template_directory_uri().'/images/blog-title-bg.jpg'; ?>) no-repeat center top / cover;">
<div class="page-wrapper">
<h1>Our Blog</h1>
</div>
</section>
<div id="page" class="interior"<?php if(get_field('content_background')) : ?> style="background: url(<?php echo get_field('content_background'); ?>) no-repeat center top / 100% auto;"<? endif; ?>>
<div class="page-wrapper">
<main>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class="blog-post">
<h3 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="meta">Posted: <?php echo get_the_time('F j, Y'); ?> | By: <?php the_author(); ?></div>
<p><?php the_excerpt(); ?></p>
<p align="right"><a href="<?php the_permalink(); ?>">» Read More</a></p>
</div>
<?php endwhile; else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
</main>
</div>
<?php get_sidebar('testimonials'); ?>
</div>
<?php get_footer(); ?>
请任何指导将不胜感激。谢谢!
解决方案
推荐阅读
- python - 如何在 postgresql3 中将 NULL 插入具有时间戳类型的列中
- javascript - 我是否需要 react-redux 的数据库才能存储用户?
- laravel-5 - 从 isDirty Laravel 中排除属性
- python - Python如何在多个脚本中使用字符串
- node.js - 如果变量在标题中,则 Slack Dialog.open 不会打开
- spring-boot - 如何从包含多个 repo 的配置服务器中获取属性
- c# - 字符串表达式到 c# 函数委托
- java - 如何将图像合并到 SQLite 测验中?
- java - 为什么Android Studio在实施'constraintlayout:2.0.0-beta1'后会出错
- powershell - 是否可以强制一个模块中的函数尊重来自不同模块的变量的只读设置?