The role of WordPress themes
Most of us are used to seeing WordPress as a CMS. In its default view, a theme is a collection of files used to skin your web application layouts. In web applications, it's recommended to separate different components into layers such as models, views, and controllers. WordPress doesn't adhere to the MVC architecture. However, we can easily visualize themes or templates as the presentation layer of WordPress.
In simple terms, views should contain the HTML needed to generate the layout and all the data it needs should be passed to the views. WordPress is built to create content management systems, and hence it doesn't focus on separating views from its business logic. Themes contain views, also known as template files, as a mix of both HTML code and PHP logic. As web application developers, we need to alter the behavior of existing themes in order to limit the logic inside templates and use plugins to parse the necessary model data to views.