Adding Dynamic Content – Introduction Section

To make the Introduction section on the Homepage of the theme dynamic so it can be edited through the WordPress I needed to add a loop and create a separate content.php file.

The area below highlighted in grey is the content being made dynamic.  Cut this highlighted code out of the index.php file:

Create a content.php file and add this code into the content.php file:





To make the code dynamic remove the static code above and add the code below so it looks for content.  Add the below code to the index.php file to call the external content.php file:









Through the WordPress dashboard update the Homepage as below adding ‘This is the home page’ as test data:


Then save and update the code and refresh the local blog homepage and the dynamic text ‘This is the home page’ is shown as below: