联系表格 7 不在我的 wordpress 站点中?但在空白页上工作我的代码有一些问题
the contact form 7 is not in my wordpress site? but works on a blank page some issues with my code
联系表 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());
在这种情况下,由于摘录长度限制,您的 shortocde 可能会被切片
联系表 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());
在这种情况下,由于摘录长度限制,您的 shortocde 可能会被切片