开发者

WP WordPress theme issue

开发者 https://www.devze.com 2023-03-21 02:11 出处:网络
I am building a free WP theme but know next to nothing about PHP. I don\'t know what to put around this code and would greatly appreciate if somebody could put the correct PHP tags around it, as telli

I am building a free WP theme but know next to nothing about PHP. I don't know what to put around this code and would greatly appreciate if somebody could put the correct PHP tags around it, as telling me what to put is a bit like speaking Latin to me. I tried putting <?php at the beginning and ?> at the end but it didn't work:

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')) {
   开发者_StackOverflow中文版// 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
}


Put <?php in front of every line that does not hold any code (thus starts with if or }), and end those lines with ?>.


Also, this first line is wrongs.

if ( has_post_format( 'aside' ) {

should be

if ( has_post_format( 'aside' ) ) {
0

精彩评论

暂无评论...
验证码 换一张
取 消