Forums

Prefetch Page (4 posts)

  1. cableghost
    Member
    Posted 2 years ago #

    Is it possible to prefetch another page on a site when the home page is visited? If so, how?

    -Scott

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Is that prefetch in terms of a perfomance thing--if so maybe a cache type plugin might help.

    And then do what with the page?

    You can use get_pages or query_posts to get a specific page. You can wrap the code in the is_home() Conditional Tag.

    But here's an example to get a page...

    <?php
    $args=array(
      'p' => 42,
      'post_type' => 'page',
      'post_status' => 'publish',
      'posts_per_page' => 1,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    //$my_query will hold that page
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
  3. a_johnson
    Member
    Posted 2 years ago #

    If you just want to pre fetch images, create a class called prefetch, put display none important in it then use a href tags in your template footer file.

  4. cableghost
    Member
    Posted 2 years ago #

    @a_johnson- it's more than images, though thank you for the reply. I will probably could use though in other situations.

    @MichaelH- this would be for an exit pop-up and want to have it display quickly. I'll give it a try...thanks!

    -Scott

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags