B
B
BadassRolf2016-01-13 11:49:16
WordPress
BadassRolf, 2016-01-13 11:49:16

Why doesn't hiding is_home files work?

There is a site, you need to display the text on the main page, but not on other pages.
Wrote the code

<?php
if( is_home() && !is_paged() )
echo "This is the home page of a blog post";
else
echo "This is not the main blog post page";
?>

But it only works when I insert it before have_post.
If after it, it doesn't work. Who's to say how to fix it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Usov, 2016-01-13
@BadassRolf

You need to write after the loop,
wp_reset_query();
here is an example https://codex.wordpress.org/Function_Reference/wp_...

A
Alex, 2016-01-13
@mr_ko

Try is_home() instead
is_front_page()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question