Make wordpress jump to first subpage, if subcategory blank (4 posts)

  1. mtonumaa
    Posted 6 years ago #

    I've been looking for a conditional statement for this for some time today, no luck, not even mention in the Codex..

    I am using a multi-level navigation on my page:

    -- Subcategory 1
    ---- Subpage 1
    ---- Subpage 2
    ---- Subpage 3
    -- Subcategory 2
    -- Subcategory 3

    "Subcategory 1" is blank.

    Is it possible, if user clicks "Subcategory 1", WordPress jumps to first subpage ("Subpage 1")? There is no need to display an empty buffer page IMO..

    smth like: if subcategory=empty, jump to it's subpage 1?

  2. MichaelH
    Posted 6 years ago #

    This might point you in the right direction:

  3. mtonumaa
    Posted 6 years ago #

    Thanks MichaelH, but unfort. this didn't work out for me.

    I found the following code from this topic: http://wordpress.org/support/topic/345814?replies=8

    	if(have_posts()) :
    		while (have_posts()) : the_post();

    but i don't understand how to use it :(
    i saved this as categories.php, but no redirect happens :(

  4. MichaelH
    Posted 6 years ago #

    Well that example I gave was wrong as it is meant to use a different template. Of course that's not what you want ;)

    I see you've commented on that other thread so maybe you'll get a better answer there.

Topic Closed

This topic has been closed to new replies.

About this Topic