Forums

Less php, more html (3 posts)

  1. longwing1
    Member
    Posted 4 years ago #

    I've pretty much got my theme fixed the way I want it now. There are a lot of static elements using php which seems a little unnecessary. My blog keeps asking the database what it's name is but it never seems to learn. If I convert as much php code to html as I can for the static elements, can I expect much performance improvement.

    Also I want to bring some of the get_XXX() code into the forms. Will this speed anything up? I've only got 3 forms that need to be maintained (main, pages, single_post) so that doesn't seem like too big a deal.

    Finally, will it speed anything up if I gut the stylesheet of any unused information?

    Thanks!

  2. Michael Fields
    Theme Wrangler
    Posted 4 years ago #

    My blog keeps asking the database what it's name is but it never seems to learn.

    Oh, but it does! Your blog name is stored in the $GLOBALS array

    <?php print $GLOBALS['wp_object_cache']->cache['options']['alloptions']['blogname']; ?>

    When you access your blog's name through one of the following methods:

    bloginfo('blogname'); or get_option('blogname') you are not querying the database - you are using a cached query. Hard-coding your blog's name will not really help you optimize your blog at all - it will merely cheat you out of some helpful functionality (changing your blog's name through the WordPress Administration panels).

    If I convert as much php code to html as I can for the static elements, can I expect much performance improvement.

    There are a few functions that you can cut back to optimize performance. wp_list_pages can add a lot of queries to each page view as well as any function that makes repeated calls to the get_post() function.

    Finally, will it speed anything up if I gut the stylesheet of any unused information?

    This will definitely help to speed up client/server request times. You can also compress your css files with a tool like: http://floele.flyspray.org/csstidy/css_optimiser.php

  3. longwing1
    Member
    Posted 4 years ago #

    mfields, Thanks for the help. It will take me a while to figure out what you're saying about wp_list_pages, but I'll work it over this weekend.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.