Lucas
Lucas

Reputation: 23

WP WordPress theme issue

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')) {
   // 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
}

Upvotes: 2

Views: 263

Answers (2)

dqhendricks
dqhendricks

Reputation: 19251

Also, this first line is wrongs.

if ( has_post_format( 'aside' ) {

should be

if ( has_post_format( 'aside' ) ) {

Upvotes: 0

marc
marc

Reputation: 6223

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

Upvotes: 3

Related Questions