Last active
August 29, 2015 14:27
-
-
Save laverboy/e4b218be29cf690ae545 to your computer and use it in GitHub Desktop.
Singleton Pattern for functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace CharityPress\Functions; | |
/** | |
* Enqueue scripts and styles. | |
*/ | |
class DashboardWidget extends Singleton { | |
//required function | |
public function init() { | |
add_action( 'wp_dashboard_setup', [ $this, 'intro_widget' ] ); | |
} | |
public function intro_widget() { | |
wp_add_dashboard_widget( 'custom_help_widget', 'Theme Introduction', 'intro_widget_output' ); | |
} | |
public function intro_widget_output() { | |
echo '<p>Welcome to Charity Press! Need help? Contact the developers <a href="mailto:info@reasondigital.com">here</a>.</p>'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require "vendor/autoload.php"; | |
CharityPress\Functions\DashboardWidget::get_instance(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment