不同的图像出现在不同的页面上(Wordpress / PHP)

问题描述 投票:3回答:2

我是Wordpress / PHP的新手。请问你能告诉我通过Wordpress在页面中显示图像的最佳方式吗?它们不必在管理员中进行编辑,但如果更容易编辑则可以。

目前我这样做;

<?php if (is_page(43)) { ?>
<img src="/images/notting-hill-4.jpg">
<img src="/images/notting-hill-5.jpg">

<?php } elseif (is_page(162)) {  ?>

<img src="/images/notting-hill-7.jpg">
<img src="/images/notting-hill-8.jpg">
<img src="/images/notting-hill-9.jpg">


<?php } else { ?>

<img src="/images/notting-hill-1.jpg">
<img src="/images/notting-hill-2.jpg">
<img src="/images/notting-hill-3.jpg">

<?php } ?>  
php wordpress
2个回答
0
投票

例如,您可以使用NextGen图库插件。在这里找到它:http://wordpress.org/extend/plugins/nextgen-gallery/

为每个页面创建一个库。然后使用短代码或其他方式显示您想要的图像。不要被画廊功能所迷惑,它还可以让你显示单个图像(我很确定,虽然我用了它已经有一段时间了。)


0
投票

您可以使用不同的模板并在编辑器中设置模板,然后每个页面都有不同类型的模板

阅读更多:https://codex.wordpress.org/Stepping_into_Templates

如果页面具有相同的模板,您可能只需要将图像直接添加到帖子或页面编辑器中

© www.soinside.com 2019 - 2024. All rights reserved.