Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have rules that only work on paginated pages (is_paged). However, they don't work on page number one (/page/1). This one is behaving exactly like the homepage (!is_paged), but unlike pages 2,3,4 etc. I want to prevent page 1 from behaving like the homepage and have it behave just like any other page.

if (strpos($url,'/page/1') || is_paged()) {include 'paged.php'; } // this is to load a different template for paged results
if (is_home() && !is_paged() && !$paged = 1) echo 'good'; else echo 'bad'; // this is what i want to do inside the page and cannot. It returns 'good' on both homepage and page 1
if (is_home() && !is_paged() && !strpos($url,'/page/1')) echo 'good'; else echo 'bad'; // this returns 'bad' on both
if (is_home() && !is_paged()) echo 'good'; else echo 'bad'; //this returns 'bad' on both
share|improve this question
    
Have you taken a look at this example that allows you to drill down to page number 1 of pagination? codex.wordpress.org/… –  MartinJJ Dec 19 '12 at 15:57
    
It would be helpful to see your code. –  s_ha_dum Dec 19 '12 at 16:21
    
I updated the question –  Lucian Davidescu Dec 19 '12 at 17:06
add comment

2 Answers 2

up vote 0 down vote accepted

EDIT - SOLVED: OK, so for whoever else looks for this, I found a workaround that is actually quite straightforward: on the paged.php template, set a variable such as $paged = true, than instead of !(is_paged()) use !($paged).

share|improve this answer
add comment

do you mean you want a conditional for page 1 of all home queries which have more than one page as result?

try to use $wp_query->max_num_pages;

example:

if (is_home() && $wp_query->max_num_pages > 1 && !is_paged()) echo '/page/1'; else echo '/';
share|improve this answer
    
I'm not sure, I think not, because I tried the code and it doesn't do what I want. I have two different pages: one is index.php, heavily customized, cms style. the other is "page/1", which shows the latest posts in order, blog style. While I manage to load the correct template with the strpos thing, wordpress still doesn't seem to know where it is. It says both are is_home and !is_page. OTOH, conditionals that identify $paged = 1 also trigger on the homepage and do things I don't need there. What I want is to have them separated: what triggers on home doesn't trigger on page 1 and viceversa. –  Lucian Davidescu Dec 19 '12 at 17:41
    
with the new explanation, I doubt as well that my suggestion will work. possibly consider using a page template instead of the 'heavily customized' index.php; and use index.php for the latest posts. –  Michael Dec 19 '12 at 18:58
    
That would be fine, but is there a way to load the page template with the base url and yet not redirect when on index/page 1? –  Lucian Davidescu Dec 19 '12 at 20:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.