Hello Wordpress People,
我想问一下如何在<div class="entry"><?php the_content(); ?></div>
部分下面的代码中更改搜索结果的输出?
我只想显示页面,帖子或类别标题和文本。但Text也只有500个Charaters才能显示,然后链接“阅读更多”。
有没有办法完成这项工作?谢谢你的帮助。
这是我的search.php代码:
<div id="main">
<?php if (have_posts()) : ?>
<p class="info">Ihre Suchergebnisse für: <strong><?php echo $s ?></strong></p>
<?php while (have_posts()) : the_post(); ?>
<h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
<div class="entry">
<?php the_content(); ?>
</div>
<?php endwhile; ?>
<p align="center"><?php next_posts_link('« Ältere Einträge') ?> | <?php previous_posts_link('Neuere Einträge »') ?></p>
<?php else : ?>
<div class="no-found">
<h3>Ups?! Wir konnten unter dem Begriff <span>"<?php echo $s ?>"</span> leider nichts finden.</h3>
<p>Kehren Sie bitte <a href="<?php bloginfo( 'url' ); ?>">zur Startseite</a> zurück.</p>
</div>
<?php endif; ?>
</div><!-- main -->
<div id="sidebar">
<?php get_sidebar(); ?>
</div><!-- sidebar -->
答案 0 :(得分:0)
我可能只是将the_content()
更改为the_excerpt()
。这将使您非常接近您想要的。
答案 1 :(得分:0)