gpt4 book ai didi

php - 分别针对帖子中的图像和内容

转载 作者:行者123 更新时间:2023-11-28 03:11:59 25 4
gpt4 key购买 nike

在我的 WP 主题中,我希望能够定位(将 css 卡在我的 style.css 中)我的 single.php 中的图像和内容。

在 single.php 上,它通过循环放入内容

  <?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'content', 'single' ); ?>
<?php bnNav_content_nav( 'nav-below' ); ?>

<?php endwhile; // end of the loop. ?>

和content-single.php

<div class="container"
<?php the_content(); ?>
</div>

帖子内容有图片和文字,但都是在

标签中输出。我可以将图像定位为能够添加 -margins(杂乱但我可以为文本设置不同的边距)但我想为每个添加更多独特的样式

最佳答案

您的图像不必包含在段落中。您可以在文本模式下使用 WordPress 编辑器将图像包装在 DIV 中。

enter image description here

这样您就可以分别为包含图像和段落的 DIV 定义样式。如果您经常需要此功能,您可以自己准备一个 quicktag,它将为您快速插入一个带有图像的 div,即使在编辑器的可视模式下也是如此。

AddQuicktag-Plugin是一个很好用的工具。

关于php - 分别针对帖子中的图像和内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30144591/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com