• I need to know how to use the meta refresh tag in a conditional sense. I only want the homepage to auto refresh every 5 minutes, but none of the other pages.

    I can get it to refresh everything by using the meta tag as it stands, but I am having trouble making it work on only the homepage.

    <meta http-equiv="refresh" content="<?php if ( is_home() ) {
            single_post_title('', true);
        } else {
            bloginfo('name'); echo " - "; bloginfo('description');
        }
        ?>" />
    	<meta http-equiv="refresh" content="300" >

    Any quick ideas?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I would think you want the refresh meta tag inside your if statement before your else.

    –AJ

    Thread Starter ecros

    (@ecros)

    Hi AJ, thanks and yes. I just don’t know how to write it correctly. I’m hoping someone smarter than me can help me figure it out.

    <meta http-equiv="refresh" content="<?php if ( is_home() ) {
            ?><meta http-equiv="refresh" content="300" ><?php
            single_post_title('', true);
        } else {
            bloginfo('name'); echo " - "; bloginfo('description');
        }
        ?>" />

    Not sure what you have above this but the last line ?>" />` makes me think you are in the middle of some other html and if that’s that case this may not work.

    Thread Starter ecros

    (@ecros)

    I removed the trailing slash, but still no go. Anyone have a better way to do this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conditional Meta Refresh’ is closed to new replies.