1

I would quite like to get advice on how to go about creating a theme that is as light and as fast as possible. Basically avoiding things that slow a theme down. I assume there are best practices and even empirical tests that have established what does and does not work. On some SEs this is a good question but I've asked so many "poor" questions here I am hesitant to just jump in without checking.

Is there a good way to ask for best practices and/or empirical facts or should I avoid this type of question like the plague itself?

1
  • 1
    Please don't forget to mark answers as correct if it addressed your question accordingly, or leave a comment with appropriate feedback. Thanks!
    – Christine Cooper Mod
    Commented Sep 17, 2019 at 15:46

1 Answer 1

2

Is there a good way to ask for best practices

Not really, questions on stack exchange need to be specific enough that they can be answered concretely, as in an absolute manner, that all people with that question will have that answer. Some stacks naturally have a little more leeway here based on their subject.

For example, sometimes best practices can be strict and well defined, either because that's how the subject works, or law demands it. Thus asking for best practices on smuggling goods across a border, or telling lies in a visa application on the travel stack is somewhat easy, don't.

In those cases, the best practice isn't a best practice but the correct practice.

and/or empirical facts or should I avoid this type of question like the plague itself?

Generally it should be avoided. Best practice questions are rarely in a position where you can mark an answer as correct, not just what was most useful to you but canonically correct. The question tend to veer into "it depends..." territory.

Lets take the example:

I would quite like to get advice on how to go about creating a theme that is as light and as fast as possible. Basically avoiding things that slow a theme down.

This is essentially either a shopping question, or a discussion. Discussions are great! But Stack Exchange isn't a discussion forum. You can get some interesting comments, but it doesn't directly fit the format.

The other issue is that it's broad. There are so many things that could be slowing down a theme, some beyond the scope of the theme. Writing an answer that accurately and cannonically answer that question could take a small book.

The only way I can think of to cannonically answer such a question would be to provide the most minimal theme WP would handle:

<head>
    <? php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
if ( have_posts() ) {
    while ( have_posts() ) {
        the_post();
        ?>
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <?php
        the_title( '<h2>','</h2>');
        the_content();
        ?>
        </article>
        <?php
    }        
} else {
    echo "<p>No posts found</p>";
}
wp_footer();
?>
</body>
/*
 * Theme Name: Tiny Theme
 */

Anything added on top could be stripped away to make it lighter

Having said that, such a discussion held elsewhere is very likely to spawn lots of specific and very good questions that could be asked on WPSE.

Examples include the difference between pre_get_post and query_posts, or how to conditionally enqueue assets, etc, some of which are the most upvoted questions and answers on the entire stack

2
  • So, essentially what I have is not a question but a good source of question. I can run with that. Commented Sep 18, 2019 at 0:53
  • 3
    What you have is a discussion topic!
    – Tom J Nowell Mod
    Commented Sep 18, 2019 at 2:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .