Title: Making Custom Widget
Last modified: February 4, 2017

---

# Making Custom Widget

 *  [Rupam Hazra](https://wordpress.org/support/users/rupamhazra/)
 * (@rupamhazra)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/making-custom-widget/)
 * Hi, I am new in wordpress and i want to make a own custom widget so, if you help
   to do.

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

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/making-custom-widget/#post-8738846)
 * Have a look at the [Widgets API](https://codex.wordpress.org/Widgets_API).
 *  [compusolver](https://wordpress.org/support/users/compusolver/)
 * (@compusolver)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/making-custom-widget/#post-8739107)
 * Rupam, here’s a simple dashboard widget to get you started. I wrote this so contributors
   to a client’s site could easily return to the main website…
 *     ```
       <?php
       /**
        * @package Back to Website
        * @version 1.0
        */
       /*
       Plugin Name: Back to Website
       Plugin URI: https://compusolver.com
       Description: Back to website widget.
       Author: Hank Castello
       Version: 1.0
       Author URI: https://compusolver.com
       */
   
       function register_cs_hm_dashboard_widget() {
        	global $wp_meta_boxes;
   
       	wp_add_dashboard_widget(
       		'cs_hm_dashboard_widget',
       		'Back to Website',
       		'cs_hm_dashboard_widget_display'
       	);
   
        	$dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
   
       	$my_widget = array( 'cs_hm_dashboard_widget' => $dashboard['cs_hm_dashboard_widget'] );
        	unset( $dashboard['cs_hm_dashboard_widget'] );
   
        	$sorted_dashboard = array_merge( $my_widget, $dashboard );
        	$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
       }
   
       add_action( 'wp_dashboard_setup', 'register_cs_hm_dashboard_widget' );
   
       function cs_hm_dashboard_widget_display() {
       	?>
               <h2>To return to website:</h2>
       	<p><a href='/'><img src='/wp-content/plugins/cs-hm-widget/home320px.png'></a></p>
   
       	<?php
       }
       ```
   

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

The topic ‘Making Custom Widget’ is closed to new replies.

## Tags

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

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 3 participants
 * Last reply from: [compusolver](https://wordpress.org/support/users/compusolver/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/making-custom-widget/#post-8739107)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
