Auto refresh WordPress pages and post

WordPress posts and pages can be automatically refreshed using some tweaks in header of the website.

Auto refresh functionality can be used in many ways depending upon needs.It can be used in landing pages to redirect to a particular page or posts after a certain interval of time.

It can be used in other situations.for example, if the website is moved from root directory to a new directory and want the users to go to new website through root directory then simply create a page in root directory and write the code so that users will automatically redirected to new website directory.

It can be used in websites which provide live scores of sports like cricket score.

Auto page refresh in wordpress can be used in following ways

By inserting some php codes in header.php theme file.
it needs you have basic knowledge of php or at-least WordPress editing.

General code

where:

CONTENT is time in seconds after which page will be refreshed or redirected.
URL is the url where you want to redirect after the time specified in CONTENT.

Note: before editing the header.php file of your WordPress theme
it is advisable that you should backup it before editing.


Page Auto Refresh:

a. If want to refresh the home page of WordPress site after 5 seconds
enter following code between <header> </header> of header.php

Note: this code will not work if you have set a page as a home page by
Settings=>Reading=>Front page displays=>A static page (select below)

for this you have to enter following code between <header> </header> of header.php

b. if want to refresh a particular post of post id 17 after 10 seconds .
enter following code between <header> </header> of header.php

c. If want to refresh the posts in bulk you have to apply condition on array of posts as shown in below code.
enter following code between <header> </header> of header.php

Where 17,19,1,11 are post id of posts you want to refresh after 10 seconds.

d. If want to refresh a particular page after a interval of 23 seconds with page id of 47.
enter following code between <header> </header> of header.php

e. If want to refresh the pages in bulk you have to apply condition on array of page as shown in below code.
enter following code between <header> </header> of header.php

Where 42,54,6 are page id of pages you want to refresh after 21 seconds.

f. If want to refresh a particular Category archive page after a interval of 5 seconds with category id of 7.
enter following code between <header> </header> of header.php

This code can also be extended for a number other pages like author page ,archive pages etc.

 

 

Related posts

2 thoughts on “Auto refresh WordPress pages and post

  1. Pamala Foskett

    Why the nearer to the equator, the more vertical the solar
    path is. The nearer to the poles, the more horizontal the
    solar oath is? Because Earth is a sphere or oblate spheroid.
    The sun can be vertically overhead at local noon only between -23.5°
    south and +23.5° north latitude. The southern pert of the Florida Keys is
    North of that. New Orleans is at +30° north
    latitude and -90° west longitude. That poi t is in Jefferson parish, in Metairie….
    show more Earth spins at near enough the orbit to the Sun’s Equator
    About 3 degrees from Earth’s perspective and about 7 degrees to the
    Sun’s Jupiter actually is the closest to the Suns Equatorial plane It was
    nature that made it this way and not an Oath
    Earth is a sphere, more or less that is tilted which means the Suns rays have a longer
    way to go than at the Equator I hope that clears it up a bit I have been called
    a Toll lately That is a Level 7 Troll to all of you !! Check it out
    So there !!

  2. Lokesh Kumar Tak

    I read this post and understand what is wordpress and how it is work ,please read proper this post understand wordpress beginners

Leave a Comment