我一直在试图把博客标题放在我的自定义夸克主题的博客文章下面。然而,每次我这样做,我得到一个空白博客文章页面(除了头)试图把下面的博客标题放在夸克上的精选图片
的代码是:
<header class="entry-header">
<?php if (is_single()) { ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php }
else { ?>
<h1 class="entry-title">
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr(sprintf(esc_html__('Permalink to ', 'quark') . '%s', the_title_attribute('echo=0'))); ?>" rel="bookmark"><?php the_title(); ?></a>
</h1>
<?php } // is_single() ?>
<?php quark_posted_on(); ?>
<?php if (has_post_thumbnail() && !is_search()) { ?>
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr(sprintf(esc_html__('Permalink to ', 'quark') . '%s', the_title_attribute('echo=0'))); ?>">
<?php the_post_thumbnail('post_feature_full_width'); ?>
</a>
<?php } ?>
我将其更改为:
<header class="entry-header">
<?php } // is_single() ?>
<?php quark_posted_on(); ?>
<?php if (has_post_thumbnail() && !is_search()) { ?>
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr(sprintf(esc_html__('Permalink to ', 'quark') . '%s', the_title_attribute('echo=0'))); ?>">
<?php the_post_thumbnail('post_feature_full_width'); ?>
</a>
<?php if (is_single()) { ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php }
else { ?>
<h1 class="entry-title">
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr(sprintf(esc_html__('Permalink to ', 'quark') . '%s', the_title_attribute('echo=0'))); ?>" rel="bookmark"><?php the_title(); ?></a>
</h1>
<?php } ?>
我也尝试过多种变体这很少成功。我确信我很愚蠢,但任何帮助都会很棒。
谢谢!
这工作完美,谢谢你的人!大量地让我感到沮丧。 – Max
太棒了,很高兴得到了帮助!正如我在下面的其他答案中所提到的,问题是由于在某些地方没有相应的标签(即关闭或打开标签丢失)。快速识别这种情况的一种潜在方法是取出所有非PHP代码,并查看代码中是否都可以。 – asugrue15
今后调试时我会记住这一点,欢呼! – Max