php - 联系表格 7 不在我的 wordpress 网站中?但在空白页上工作我的代码有一些问题
问题描述
联系表格 7 不在我的 wordpress 网站中?但在空白页上工作我的代码有一些问题。当我将短代码粘贴到我的联系人页面时,它不会出现。我已经完成了我的 html 和 css 代码构建我还使用了 bootstrap 4.5 代码 联系页面代码
<?php
get_header();
$thumbnail_url = wp_get_attachment_url(get_post_thumbnail_id($post -> ID));
?>
<?php
if(has_post_thumbnail()){ ?>
<section class="about" style="background: url('<?php echo $thumbnail_url; ?>') no-repeat; background-size: cover;">
<div class="hero-text w-100 text-white px-2 px-sm-0">
<h1 class="display-3 brand"><?php echo the_title(); ?></h1>
<p class="lead"><?php echo the_excerpt(); ?></p>
</div>
</section>
<?php } else{ ?>
<section class="about">
<div class="hero-text w-100 text-white px-2 px-sm-0">
<h1 class="display-3 brand"><?php echo the_title(); ?></h1>
<p class="lead"><?php echo the_excerpt(); ?></p>
</div>
</section>
<?php } ?>
<?php
get_footer();
?>
解决方案
看起来您应该使用the_content
而不是the_excerpt
- 在这种情况下将执行短代码。
<h1 class="display-3 brand"><?php the_title(); ?></h1>
<p class="lead"><?php the_content(); ?></p>
但是,如果您需要带有简码的摘录,请使用
apply_shortcodes(get_the_excerpt());
在这种情况下,由于摘录长度限制,您的短代码可能会被切片
推荐阅读
- php - 共享主机上的 Websockets:由于共享主机本身或非 php 集成而无法实现?
- python - Python:如何断言闭包的起源?
- oracle - 如何在 Oracle AR 查询中将 ChargeBacks 与原始交易发票加入?
- php - 在 WooCommerce 注册中将标签“用户名”更改为“帐号”
- ios - 键盘将整个内容推送到黑色背景(cordova+framework7+vue)
- ios - Xcode 无法在真实设备上启动应用程序
- java - 如何在方法中返回参数化类?
- javascript - 使用 React 和 react-slick,我只是很难理解如何使用它
- python - 如何在 python pandas 数据框中应用通配符?
- ios - 使用 UIImagePickerController 为 Dashcam 应用程序保存视频