Converting a static HTML site into WordPress can be daunting, especially if you want clean, lightweight code without relying on page builders. Over the years, I’ve refined a workflow that prioritizes performance, maintainability, and scalability. In this article, I’ll walk you through my step-by-step process, so you can create a custom WordPress theme from scratch — efficiently and without bloat.
Why Avoid Page Builders
Page builders like Elementor or WPBakery are popular for their convenience. However:
- They inject unnecessary CSS and JavaScript, slowing down your site
- Code is often hard to maintain if you want to tweak it later
- They can make your theme less flexible for custom features
For portfolio sites, performance and control are key. A clean custom theme is faster, lighter, and easier to update.
Step 1: Prepare Your HTML
Start with a well-structured static HTML site. I like to:
- Keep semantic markup:
<header>,<main>,<section>,<footer> - Optimize images and media for web
- Ensure mobile responsiveness with flexible grids or CSS Flexbox/Grid
Tip: Organize your files in folders (css/, js/, images/) — this makes it easier to migrate to WordPress.
Step 2: Set Up a WordPress Theme
- Create a new folder in
wp-content/themes/(e.g.,my-portfolio) - Add these essential files:
style.css → Theme info & styles
index.php → Main template fallback
functions.php → Theme setup & scripts
header.php → Site header
footer.php → Site footer
front-page.php → Custom homepage
single.php → Single post template
archive.php → Blog/archive template
- Keep HTML from your static site in
front-page.phpandindex.phpfirst. - Remove any inline scripts or redundant styles to avoid bloat.
Step 3: Enqueue CSS and JS Properly
Instead of copying <link> and <script> tags into header.php:
function my_portfolio_scripts() {
wp_enqueue_style('main-style', get_stylesheet_uri());
wp_enqueue_script('main-js', get_template_directory_uri() . '/js/main.js', [], null, true);
}
add_action('wp_enqueue_scripts', 'my_portfolio_scripts');
Benefits:
- Keeps WordPress happy
- Loads scripts in the right order
- Reduces duplicate CSS and JS
Step 4: Convert HTML to WordPress Templates
- Replace static content with WordPress functions:
| Static HTML | WordPress Function |
<h1>My Blog</h1> | <h1><?php bloginfo('name'); ?></h1> |
<p>Post excerpt</p> | <?php the_excerpt(); ?> |
<a href="post.html">Read</a> | <a href="<?php the_permalink(); ?>">Read More</a> |
- Wrap blog posts in the Loop:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article>
<h2><?php the_title(); ?></h2>
<p><?php the_excerpt(); ?></p>
<a href="<?php the_permalink(); ?>">Read Article →</a>
</article>
<?php endwhile; endif; ?>
Step 5: Make It Modular with get_template_part()
For maintainability:
<?php get_template_part('template-parts/content', 'blog'); ?>
- Keep repeated sections like blog cards, portfolio items, or testimonials modular
- Makes updates easier and avoids code repetition
Step 6: Optimize for SEO
- Use semantic HTML5 tags:
<article>,<section>,<header> - Add proper meta tags in
header.php:
<meta name="description" content="<?php bloginfo('description'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- Use WordPress functions for dynamic titles:
<title><?php wp_title('|', true, 'right'); ?></title>
- Add Open Graph tags for social sharing if desired
Step 7: Keep It Lightweight
- Avoid bloated plugins for design
- Load only essential scripts
- Use native WordPress features for menus, widgets, and custom post types
This ensures your portfolio is fast, responsive, and easy to maintain.
Step 8: Test and Deploy
- Test across devices and browsers
- Check page speed using tools like Google PageSpeed Insights or GTmetrix
- Use child themes if you plan future customization
Key Takeaways
- Skip page builders — they create unnecessary bloat
- Start with clean HTML and structure it semantically
- Use the WordPress Loop and template hierarchy
- Modularize code with
get_template_part() - Enqueue scripts properly and optimize for performance
- Focus on SEO and semantic HTML
By following this workflow, you get a custom, lightweight WordPress portfolio that’s fast, maintainable, and scalable — perfect for showing off your work.
Ready to see the code in action? Check out the portfolio section on my site where I built everything from scratch — no page builders, no unnecessary plugins.