我尝试使用的插件中的一个短代码在我的静态首页上不起作用,它只显示为简单的短代码文本,但在我的所有其他页面上都很有效。
我正在使用Illdy主题,我已经在他们的论坛上问过这个问题,但我觉得这个问题在我的front-page.php
文件我的房间里有什么遗漏或额外的东西吗front-page.php
阻止短代码工作的文件?
UPDATE: 在头版。php,我将get\\u the\\u content()更改为\\u content(),并修复了我的问题。这是个好办法吗?我能在做出这种改变时感到舒适吗?
这是我的头版。php:
<?php
/**
* The template for displaying the front page.
*
* @package WordPress
* @subpackage illdy
*/
get_header();
if( get_option( \'show_on_front\' ) == \'posts\' ): ?>
<div class="container">
<div class="row">
<div class="col-sm-7">
<section id="blog">
<?php do_action( \'illdy_above_content_after_header\' ); ?>
<?php
if( have_posts() ):
while( have_posts() ):
the_post();
get_template_part( \'template-parts/content\', get_post_format() );
endwhile;
else:
get_template_part( \'template-parts/content\', \'none\' );
endif;
?>
<?php do_action( \'illdy_after_content_above_footer\' ); ?>
</section><!--/#blog-->
</div><!--/.col-sm-7-->
<?php get_sidebar(); ?>
</div><!--/.row-->
</div><!--/.container-->
<?php
else:
$sections_order_first_section = get_theme_mod( \'illdy_general_sections_order_first_section\', 1 );
$sections_order_second_section = get_theme_mod( \'illdy_general_sections_order_second_section\', 2 );
$sections_order_third_section = get_theme_mod( \'illdy_general_sections_order_third_section\', 3 );
$sections_order_fourth_section = get_theme_mod( \'illdy_general_sections_order_fourth_section\', 4 );
$sections_order_fifth_section = get_theme_mod( \'illdy_general_sections_order_fifth_section\', 5 );
$sections_order_sixth_section = get_theme_mod( \'illdy_general_sections_order_sixth_section\', 6 );
$sections_order_seventh_section = get_theme_mod( \'illdy_general_sections_order_seventh_section\', 7 );
$sections_order_eighth_section = get_theme_mod( \'illdy_general_sections_order_eighth_section\', 8 );
if( have_posts() ):
while( have_posts() ): the_post();
$static_page_content = get_the_content();
if ( $static_page_content != \'\' ) : ?>
<section class="front-page-section" id="static-page-content">
<div class="section-header">
<div class="container">
<div class="row">
<div class="col-sm-12">
<h3><?php the_title(); ?></h3>
</div><!--/.col-sm-12-->
</div><!--/.row-->
</div><!--/.container-->
</div><!--/.section-header-->
<div class="section-content">
<div class="container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<?php echo $static_page_content; ?>
</div>
</div>
</div>
</div>
</section>
<?php endif;
endwhile;
endif;
if( $sections_order_first_section ):
illdy_sections_order( $sections_order_first_section );
endif;
if( $sections_order_second_section ):
illdy_sections_order( $sections_order_second_section );
endif;
if( $sections_order_third_section ):
illdy_sections_order( $sections_order_third_section );
endif;
if( $sections_order_fourth_section ):
illdy_sections_order( $sections_order_fourth_section );
endif;
if( $sections_order_fifth_section ):
illdy_sections_order( $sections_order_fifth_section );
endif;
if( $sections_order_sixth_section ):
illdy_sections_order( $sections_order_sixth_section );
endif;
if( $sections_order_seventh_section ):
illdy_sections_order( $sections_order_seventh_section );
endif;
if( $sections_order_eighth_section ):
illdy_sections_order( $sections_order_eighth_section );
endif;
endif;
get_footer(); ?>
最合适的回答,由SO网友:Dustin Snider 整理而成
看起来你需要更改头版。php页面,您使用了错误的变量。
$static_page_content = get_the_content();
至
$static_page_content = the_content();
编辑:我看到你刚刚更新了你的问题,是的,这会很好。不应该看到任何负面的副作用。