Title: Inserting widgets in PHP code?
Last modified: August 19, 2016

---

# Inserting widgets in PHP code?

 *  [mcbryant](https://wordpress.org/support/users/mcbryant/)
 * (@mcbryant)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/inserting-widgets-in-php-code/)
 * OK I’m fairly new to WordPress but I have a problem that should be fairly easy
   to solve, except I can’t find the solution online.
 * I’m using the Gridline theme which uses a separate front page. So all the wonderful
   widgets I add to the sidebar don’t show up on the front page. I want to display
   the text widget on the right side of the front page, sounds simple.
 * I’ve found the file to alter it’s /wp-content/themes/gridline/library/apps/featured.
   php. I’ve managed to insert the datafeedr ads on the front page by just pasting
   the template code: <?php if (function_exists(‘dfrads’)) { echo dfrads(‘xxxxxxx’);}?
   >. Works great but how do I do that with other widgets, specifically the text
   widget. Does it have a template code?
 * I’ve already wasted a couple of hours searching for the answer so I’m hoping 
   someone will have some insights.
 * M

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/inserting-widgets-in-php-code/#post-1673104)
 * You’d be better off editing the template and adding in a widgetable area.
    see:
   [http://codex.wordpress.org/Widgets_API](http://codex.wordpress.org/Widgets_API)
 *  Thread Starter [mcbryant](https://wordpress.org/support/users/mcbryant/)
 * (@mcbryant)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/inserting-widgets-in-php-code/#post-1673239)
 * Thanks I gave that a try but found all sorts of formatting issues arose plus 
   they’d have to enter a new text widget in the new widgetable area and duplicate
   entering text. I found a better solution.
 * I put the sidebar on the front page using the <?php get_sidebar(); ?> command
   in the featured.php page and then used the widget logic plugin to turn off all
   widgets except the text widget on the front page. Allowed me to add a subset 
   of the sidebar to the front page without too much fuss.
 * M

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Inserting widgets in PHP code?’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [mcbryant](https://wordpress.org/support/users/mcbryant/)
 * Last activity: [15 years, 9 months ago](https://wordpress.org/support/topic/inserting-widgets-in-php-code/#post-1673239)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
