Note: This is for people comfortable editing theme files. Always make sure to backup your work before editing theme files!
I had a client recently contacting me, asking me to modify their WordPress theme to look like Buffer’s blog. In particular, they wanted to have a modifiable call to action area after every 4th blog post on the blog page.
So, for those aspiring WordPress developers out there who are a bit PHP shy, I thought I’d share my solution.
First, encode a new widget area in the Functions.php file. Then copy and modify the code below into the Index.php file.
Things you want to change:
- After how many posts you want it to appear (1, 5, 20, etc)
- The name of the widget area
And that’s it! Now you have a new widget area that you can add a mailing list plugin, an Instagram feed plugin, and event plugin—anything you want! And just add the CSS styles and you’re on your way.