WordPress VS PHP Scripting

WordPress VS PHP Scripting

This is my comparison and contrast between WordPress(E-reader's digest) and PHP Scripting(Furniture shop) to build websites. If you are interested in learning one or the other, this may give you an enlightenment to make your mind up to decide which one you would start with first.

  • Navigation

Both websites have responsive navigation which automatically fits the users' screen size from a single URL. As can be seen below, they are very similar navigations in terms of how they work and are viewed by users. However, there are a few distinctions to achieve the same functionality between the two websites.

The WordPress theme provides a responsive layout as default. Therefore, it doesn’t require any hand-coding unless a user wants to make any customisations for cosmetic purposes. It can be simply created by adding up the menu categories from the admin page.

image.png

On the other hand, Furniture Shop requires web programming skill to implement responsive navigation such as comprehending what a responsive design and media query are and how to create grid/flex layouts. For the Furniture shop, CSS bootstrap framework is used to reduce the initial set-up time for CSS. As such, HTML formatting, pictured below, was the prime task and all CSS classes are preconfigured from bootstrap; they have been added to class attributes accordingly in order to create the user interface. Since the navigation is present throughout all pages on the website, it is modularised into navigation.php in the components folder, so that it can be embedded throughout all the pages by using <?php includes 'components/navigation.php' ?>.

image.png

image.png


  • Database

With E-reader’s digest, the data tables are preconfigured and the data is populated automatically when categories, posts and other data is created by users. The easy-to-use interface is intuitive and allows for the creation of a website even without knowing about the database. At the same time, the provision of preconfigured options in WordPress could be seen to somewhat limit creativity; WordPress might be seen more like a paint-by-numbers picture compared to the blank canvas offered by PHP Scripting.

image.png

The database for Furniture Shop was created with phpMyAdmin which supports MySQL with its intuitive web interface. Creating, dropping and modifying tables, columns and data isn’t challenging and it actually can be comparable with the former method thanks to its web interface. But, the difference with WordPress is that the connection and closure of database and query statements should be hardcoded in a PHP file to communicate with the database. Once specific data from products table is called, the relevant data based on columns’ name would be displayed according to a unique product_id. Unlike the former method, the configuration and displaying of columns is up to the developer so that the customisation pertains to the programming logic.

image.png


  • Thumbnails

The thumbnail of E-reader’s digest was created by a plugin called Advanced Excerpt. It automatically generates thumbnails of all the posts based on the user’s setting, as can be seen in the image below. While it might be desirable to allow users to have full control of the thumbnail customisation, ‘Advanced Excerpt’ is arguably very helpful for non-technical users.

image.png

image.png

With regards to Furniture Shop, the thumbnails, which were created by hand-coded PHP, HTML and CSS, can be seen below. The benefit of this method is having full control of the thumbnail component such as styling, layout and content. Owing to the bootstrap framework, the fluid layout was easily achieved by adding a few CSS classes.

image.png

image.png


  • Detail page

The detail page of WordPress was generated by creating a post using its WYSIWYG editor. This is the power of WordPress’ Content Management System (CMS) which provides several component blocks such as Heading, Paragraph, Table, Columns, etc and reusable blocks can be created by grouping them.

This is arguably the best way to create a blog post as bloggers can be creative online without web programming skills and present their work in a way they want to.

While this is the case, when considering an e-commerce website with a thousand products that need to be uploaded, this kind of repetitive creation for each product page could be seen to be cumbersome and inefficient.

image.png

On the other hand, the detail page of Furniture Shop avoids the aforementioned potential disadvantage of the WordPress website. Each thumbnail of a product item is wrapped by <a> tag and the hyperlink contains a query parameter “product_id” with a unique ID for the product. As soon as a user clicks the hyperlink, PHP scripting starts communicating with the database to request the product data which has the same ID from the products table.

Once it successfully retrieves the data, the rest of the codebase runs and the display of the detail page is completed. If not retrieved, it will show an error message. By doing so, it eliminates the onerous amount of work to create each detail page per item.

스크린샷 2021-03-20 18.53.08.png 스크린샷 2021-03-20 18.54.00.png

image.png

  • Conclusions

WordPress enables the buildings of a website without initial engineering overhead. However, the more a user wants to customise a theme and plugins, the more time would be needed to learn how to do so and then optimise it. This would be a time-consuming process to take more control over those plugins and the theme. At the same time, the loading time appears to be somewhat cumbersome and slow in terms of performance. Perhaps it may be a downside of the server-side rendering which is implemented by WordPress using PHP and MySQL under the hood. Moreover, the more new code blocks such as CSS and JavaScript are embedded for the modification of plugins and themes, considering the performance is more important as they would affect both the First Content Paint and the First Meaningful Paint.

PHP Scripting requires more time for the initial configuration and codebases should be hard coded to communicate with the database. Besides, the logic which tells a browser what to do and how to do the tasks needs to be explicit. At the same time, PHP scripting generally allows have full control over a website in areas such as layout, styling, performance optimisation, website architecture and Search Engine Optimisation, etc.

It would be fair to say that both WordPress and PHP Scripting have their advantages and disadvantages. Programming is about problem-solving and trade-offs. The best decision would be the most viable and achievable one within the given time, resources and knowledge as a developer.

Hope you find this was helpful for you and why don't you crack on it?

WordPress Local