V
V
Vladimir Novitsky2015-10-13 15:55:41
PHP
Vladimir Novitsky, 2015-10-13 15:55:41

Is it possible to use different page templates for different posts in WordPress?

Hello.
Interested in this question. Is it possible in WordPress to use one template (HTML markup) for a normal post, and another template if a thumbnail is set for a post? So that it is somehow tracked and different page templates are used.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MetaDone, 2015-10-13
@MetaDone

wp-kama.ru/function/has_post_thumbnail
wp-kama.ru/function/get_template_part

if( has_post_thumbnail() ) {
  get_template_part("with_thumb");
} else {
  get_template_part("not_thumb");
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question