Title: PHP code for widgets
Last modified: August 31, 2016

---

# PHP code for widgets

 *  [angelebaby](https://wordpress.org/support/users/angelebaby/)
 * (@angelebaby)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/php-code-for-widgets/)
 * I’m trying to figure out how to code in a sidebar widget in this piece of code
 *     ```
       <?php if ( ! dynamic_sidebar( 'sidebar' ) ) : // If the user hasn't defined any specific widgets in the admin yet, display a couple dummy widgets, as written below ?>
       				<aside id="archives" class="widget">
       					<h3 class="side-title"><?php _e( 'Archives', 'naked' ); // WordPress archives widget ?></h3>
       					<ul>
       						<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
       					</ul>
       				</aside>
   
       				<aside id="meta" class="widget">
       					<h3 class="side-title"><?php _e( 'Meta', 'naked' ); // WordPress meta widget ?></h3>
       					<ul>
       						<?php wp_register(); ?>
       						<li><?php wp_loginout(); ?></li>
       						<?php wp_meta(); ?>
       					</ul>
       				</aside>
       ```
   
 * Thanks! My site: angelebaby.com

The topic ‘PHP code for widgets’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * 0 replies
 * 1 participant
 * Last reply from: [angelebaby](https://wordpress.org/support/users/angelebaby/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/php-code-for-widgets/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
