Elegant Themes: After Single Post Content Widget For Foxy Theme

There’s at least 2 ways you can add a custom widget which displays after the content on single posts in any Elegant theme.

In this post, we’ll add the new widget area directly to the single.php file which we’ll copy over to a child theme before modifying.

Foxy Theme

Note: The code in this tutorial has been tested on the Foxy theme using a child theme. The child theme saves your custom code/modifications from being lost if the parent theme is updated in the future.

Demo Foxy Parent Theme

There’s 2 steps involved:

  1. Register a new sidebar widget area in your child themes functions file.
  2. Add the dynamic sidebar wrapped in a div directly to your single.php file

1. Register Widget

Simply copy this PHP code from the view raw link and paste in your functions.php file using a code editor. Preferably use a child theme which won’t be over written if your parent theme is updated.

Here’s a child theme for Foxy ( you can download the zip from Github ) which already includes the after post widget code so you can simply install it after the parent theme is installed.

Download Zip – Foxy Child Theme

No need to read on if you download & install the Foxy child theme zip after the parent theme.

2. Add Dynamic Sidebar To Single.php File

Add this PHP around Line 34 of your single.php file.

If you’re not adding this widget to Foxy, add the code after this line:

<?php get_template_part( 'content', get_post_format() ); ?>

and before the code for the comments in any other Elegant Theme.

Code Not Working

View the code in the single.php & functions.php files on Github to check against your own.

View Code on Github


Comments

2 responses to “Elegant Themes: After Single Post Content Widget For Foxy Theme”

  1. Val Lynn Avatar
    Val Lynn

    And here I thought you only covered one theme shop. Good to see you posting about Elegant Themes. You’re the best!

    1. Brad Dalton Avatar
      Brad Dalton

      Better late than never! haha

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.