You may find plenty of blog articles which will teach to build a WordPress theme step by step, but we are not doing it here. It is important for the new-age developers to gain some baseline knowledge and go out and explore things on their own. It’s better to learn by doing that through emulation.
On WordPress, there is no need for you to develop themes from scratch, but can make use of the high-level platform based on what it requires, to get instant solutions. Considering what is new on WordPress in 2019, here we will find out some ways to more effectively approach WordPress theme building.
While building a new WordPress theme, you can first refer to WordPress codex for themes and the cheat sheets like ‘Anatomy of a WordPress Theme’ to check whether you are using the proper codes and desirable elements. This will further give you a better insight into what you would be expecting from WordPress.
You need to first set up a theme folder in the wp-content > themes directory where you can store all the files. You can name this folder with whatever name you like, but the folder name must be matching to your text domain theme. To work properly, a WP theme requires two elements as:
- style.css with all the theme details, and
- index.php file.
It is possible to learn about the needed files from WordPress, where they may comment a screenshots.php or comments.php as the requirements. Besides the theme information in the style sheet, you may not need a markup to activate the theme, even though it won’t do any damage at this point.
Installation of new themes
You can next start adding the template files to the new theme. Some of such add-on files include.
- 404.php which handles the not found page content.
- comments.php to handle the comments.
- functions.php to add default setup for your custom theme.
- footer.php for the page ending text, which closes all tags.
- index.php as the default home template.
- header.php to open tags and manage the navigation, etc.
- screenshot.png to take up a high-pixel screenshot for theme dashboard.
- page.php as page template
- style.css for different styles and themes, which also consists of theme info and description.
- single.php as single post template
All these can help build a well-rounded theme for WordPress as offered by RemoteDBA.com. You may also explore various other themes which you like to decide as to which template and content you like the most and must be included in your portal.
Once the above step is over, next your theme may need various functions. The best place to start with is functions.php. You can set up the function of _theme_setup, which will help hook some action s. This also gives the ability to register some default functions and add such support to do many things.
Setting up a theme with WordPress 5.0+
The major elements to consider here are the new additions with WordPress 5.0, which is known as Project Gutenberg, offering great theme support with many items to accommodate all types of themes. Find the below elements to explore
Allows the theme to add to core block style. The ‘responsive-embeds’ in it will allow embedding the media to retain an apt aspect ratio. ‘dark-editor-style’ in add theme support can be used to make your foreground more visually pleasing. This is most ideally used with the editor-styles add theme support.
The ‘align-wide’ theme support will offer the capability to add any class names to the image wrapper for the elements which offer full-width or wider images. These elements are not available by default in the editor. ‘editor-font-sizes’ is used to set the font sizes which corresponds to editor styles and makes available with block settings as applicable. ‘editor-color-palette’ can also do the same thing in editing which helps to change your main theme colors.
Planning a new theme
There are two different themes out there which you can consider for WordPress site themes, which the users can try for setting up themes in a specific way. To do this well, you need to have a clear-cut game plan to identify how you can get involved in the theme development projects.
While thinking of a WordPress theme for the new-age users, you can keep these three considerations in mind as – simple, – clean, and – focused.
For a primary website, unless you own an e-Commerce store, one may not have to need more than a few basic pages. There is a lot of information available for WordPress builders, which may not be needed for all users like the tags, post author, comment numbers, etc. A user may probably need to know when the posts are published and also in which category these are published.
Making it clean
Being clean is also needed to keep things concise. The concept of being ‘clean’ refers to your layout and design.
You need a perfect focus while developing the themes. First set a goal for your theme as to ‘people need to see the recent blog posts here,’ or ‘images must be kept more important.’ Such a focus will help decide the website structure and stay focused on purpose.
Backing up WordPress Database
Before installing a new thing or repairing a WordPress site, always remember to back up your database. There are plenty of plug-ins available for backup; however, provided that you cannot access your WordPress account, creating manual back up of WordPress database is an ideal starting point.
You can do the backup by modifying the file of ‘wp-config.php.’ Follow the below steps if you need to repair this file in the FTP folder.
- Go to the control panel and access your FTP client.
- Download ‘wp-config.php’ file
- Open this file using a text editor
- Add the text WP_ALLOW_REPAIR just in front of the [if ( !defined(‘ABSPATH’) )]
- You can save the ‘wp-config.php’ file with the correction made.
- Just upload this modified file to FTP server by replacing the previous one.
- Next click on the ‘Repair Database’ option
However, while you make a plan to repair the WP database, it is also important to identify the reason for corruption in the first place. This will help you eradicate the root cause and maintain a cleaner database.