Documentation

How to Make a Theme in LaraPress CMS?

Creating a custom theme in LaraPress CMS is simple, flexible, and developer friendly. If you are already familiar with Laravel Blade, you will feel very comfortable working with LaraPress themes. In this article, I will explain the basic folder structure, the purpose of each file, and how you can start building your own theme step by step.


Understanding the Theme Folder Structure

All frontend themes in LaraPress CMS are stored inside the following directory:

-> resources/views/front/themes

Each theme has its own folder. For example, if your theme name is default, the structure will look like this:

resources/views/front/themes
└── default
    ├── layouts
    │   └── master.blade.php
    ├── index.blade.php
    ├── posts.blade.php
    ├── sidebar.blade.php
    └── single.blade.php

This clean separation makes it easy to manage multiple themes and switch between them without affecting the core CMS files.


Master Layout (master.blade.php)

The master.blade.php file is the main layout file of your theme. It usually contains:

-> HTML <head> section

-> Website header

-> Footer

-> Common CSS and JavaScript files

This file acts as a base layout that other pages extend. A typical structure looks like:

<!DOCTYPE html>
<html>
<head>
    <title>@yield('title')</title>
</head>
<body>
    @include('front.themes.default.sidebar')

    <div class="content">
        @yield('content')
    </div>

    <footer>
        Footer content here
    </footer>
</body>
</html>

Using a master layout helps you maintain consistency across all pages.


Home Page (index.blade.php)

The index.blade.php file is used as the home page of your website. In most cases, it displays:

-> Latest blog posts

-> Featured content

-> Homepage widgets

This file extends the master layout and defines its own content section.


Posts Listing Page (posts.blade.php)

The posts.blade.php file is responsible for showing all blog posts. This can be used for:

 -> Blog archive pages

 -> Category-wise post listings

 -> Tag-based content

Here, you usually loop through posts and display titles, excerpts, and links to single post pages.


Sidebar (sidebar.blade.php)

The sidebar.blade.php file contains all widgets and side content, such as:

-> Recent posts

-> Categories

-> Tags

-> Custom widgets

Keeping the sidebar in a separate file allows you to reuse it easily across multiple pages.


Single Post Page (single.blade.php)

The single.blade.php file displays the details of a single blog post. It commonly includes:

-> Post title

-> Full content

-> Author information

-> Comments section

This file is essential for showing individual post details in a clean and readable format.


== Folder Stucture==

    • -resources/views/front/themes
    • --default /theme name
    • ---layouts/master.blade.php //main master file of headerfooter
    • ---index.blade.php //main home page or blog/post list
    • ---posts.blade.php //all posts
    • ---sidebar.blade.php //sidebar is all widgets
    • ---single.blade.php //details of blog 

----------------------------------

Creating a theme in LaraPress CMS is straightforward if you follow the proper folder structure and Blade conventions. By separating layouts, pages, and reusable components, you can build professional, maintainable, and upgrade-safe themes.

Once your theme structure is ready, you can enhance it with custom styles, JavaScript, and dynamic CMS data. This approach keeps your theme clean and ensures smooth updates to LaraPress CMS in the future.

Happy coding with LaraPress CMS 🚀