Support » Themes and Templates » Loading all content for zero load time !Help!

  • Hi,

    A client has picked up on the minute time between pages where the screen goes white and quite rightly pointed out “we only need to load (the content), (the title), and (the featured image) each time.. can’t we do this and keep the rest displayed?”

    The only way I can think of doing this is by loading all of the content in the header using get_pages(); and storing it in an array, with the pages ID as the key, then use javascript to display and remove content.

    I would use a custom walker to remove the href from nav menus and instead have a function onClick like changePage($id) or something.

    has anyone ever done anything like this before, and can you offer any advice on how I should go about it?
    would you say I shouldn’t do this?

    the site is located on our staging site at

Viewing 3 replies - 1 through 3 (of 3 total)
  • can anyone help me? I have encountered my first problem after attempting this, which is trying to get the array returned by get_pages into java script in order to utilize the content that i need.

    I also realized that the page templates that I made for the theme have been rendered a bit redundant as I will be using JS to add/remove/change content. sigh.

    anyway, I came up with this code, but the page refuses to load and I don’t know why.

    <script type="text/javascript">
    		pages = new Array();
    		$pages = get_pages();
    		foreach ($pages as $page): ?>
    			pages[<? echo $page->ID; ?>] = <? echo $page; ?>;
    		<? endforeach; ?>

    in the foreach loop, I changed the <? echo $page ?> to echo_r, which allows the page to load, but gives and error because I’m trying to use a std class object in an array. (I think?)

    does anyone have a good way to get $pages (an array of objects) into js as an array of arrays?

    can someone PLEASE help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Loading all content for zero load time !Help!’ is closed to new replies.