Title: Moving PHP code into a Widget
Last modified: August 19, 2016

---

# Moving PHP code into a Widget

 *  [Bsfez](https://wordpress.org/support/users/bsfez/)
 * (@bsfez)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/moving-php-code-into-a-widget/)
 * Hello,
    I need to help a friend that have a WordPress website developped by someone
   that stop to work for him.
 * If i’m familiar with website dev i’m not with WordPress.
    Part of the coding 
   have been done directly in the php page where (i believe) it should have been
   integrated to WP tools.
 * Part of the side is Widget but some are coded in the sidebar.php file.
    Is there
   a way to cut the relevant code from the .php and to paste it in a Widget ?
 * I tried text widget bud it didn’t parse.
    Before i break anything i’d like to
   have some feedback.
 * Thanks

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

 *  [David Gwyer](https://wordpress.org/support/users/dgwyer/)
 * (@dgwyer)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/moving-php-code-into-a-widget/#post-2064246)
 * As long as you follow WordPress best practices and the correct guidelines, creating
   widgets in WordPress is pretty straight forward.
 * See here for more details: [http://codex.wordpress.org/Widgets_API#Developing_Widgets](http://codex.wordpress.org/Widgets_API#Developing_Widgets)
 *  Thread Starter [Bsfez](https://wordpress.org/support/users/bsfez/)
 * (@bsfez)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/moving-php-code-into-a-widget/#post-2064329)
 * dgwyer,
 * Thanks i will explore this, but i wonder if i need to go that far…
 * Widget like [http://wordpress.org/extend/plugins/advanced-text-widget/](http://wordpress.org/extend/plugins/advanced-text-widget/)
   should do it, right ?
 *  [David Gwyer](https://wordpress.org/support/users/dgwyer/)
 * (@dgwyer)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/moving-php-code-into-a-widget/#post-2064338)
 * I have no idea, try it and see! 😉

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

The topic ‘Moving PHP code into a Widget’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [David Gwyer](https://wordpress.org/support/users/dgwyer/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/moving-php-code-into-a-widget/#post-2064338)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
