我正在构建一个免费的 WP 主题,但对 PHP 几乎一无所知。我不知道要在这段代码周围放置什么,如果有人可以在它周围放置正确的 PHP 标签,我将非常感激,因为告诉我要放置什么有点像对我说拉丁语。我尝试输入 <?php
在开头和 ?>
最后但没有成功:
if ( has_post_format( 'aside' ) {
// aside format post content here
} else if (has_post_format('gallery')) {
// stuff to display the gallery format post here
} else if (has_post_format('link')) {
// link format post content here
} else if (has_post_format('video')) {
// video format post content here
} else if (has_post_format('audio')) {
// audio format post content here
} else if (has_post_format('status')) {
// status format post content here
} else if (has_post_format('chat')) {
// chat format post content here
} else if (has_post_format('quote')) {
// quote format post content here
} else if (has_post_format('image')) {
// image format post content here
}else {
// code to display the normal format post here
}
最佳答案
放置<?php
在每行不包含任何代码的前面(因此以 if 或 } 开头),
并以 ?>
结束这些行.
关于php - WP WordPress 主题问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6710729/