提前感谢您的帮助。
我在WordPress主题中遇到以下错误:
注意:使用未定义的常量-假定为“”/主题/主题/主页。php第10行
以下是它提到的文件内容:
<?php
//Template Name: Home
get_header();
?>
<div class="container">
<header>
<h1><?php echo get_option(\'tiny_head_title\'); ?></h1>
<p><?php echo get_option(\'tiny_head_description\'); ?></p>
</header>
<?php
$paged = get_query_var(\'page\');
$home = new WP_Query(array(
\'post_type\' => \'post\',
\'posts_per_page\' => 6,
\'paged\' => $paged
));
if ($home->have_posts()):
?>
<div class="posts">
<?php
while ($home->have_posts()): $home->the_post();
if (is_sticky()):
?>
<article id=\'<?php the_ID();?>\' <?php post_class(\'sticky\');?>>
<?php else: ?>
<article id=\'<?php the_ID(); ?>\' <?php post_class();?>>
<?php endif; ?>
<h2>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h2>
<?php the_excerpt(); ?>
</article>
<?php endwhile; ?>
</div>
<div class="pagination">
<?php
global $home;
$total = $home->max_num_pages;
if ($total > 1) {
if (!$current_page = get_query_var(\'page\'))
$current_page = 1;
$format = get_option(\'permalink_structure\') ? \'page/%#%/\' : \'&page=%#%\';
echo paginate_links(array(
\'base\' => get_pagenum_link(1) . \'%_%\',
\'format\' => $format,
\'current\' => $current_page,
\'total\' => $total,
\'mid_size\' => 4,
\'type\' => \'plain\'
));}
?>
</div>
<?php endif; ?>
</div>
<?php get_footer(); ?>