Skip to content

Commit ddc39a0

Browse files
committed
Initial commit
0 parents  commit ddc39a0

25 files changed

+1172
-0
lines changed

LICENSE.txt

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

README.txt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
=== Custom Featured Image Metabox ===
2+
3+
Contributors: 1fixdotio, yoren
4+
Donate link: http://1fix.io/
5+
Tags: featured image, metabox
6+
Requires at least: 3.5
7+
Tested up to: 3.9.1
8+
Stable tag: 0.1.0
9+
License: GPLv2 or later
10+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11+
12+
Custom the title, content and link / button text in the Featured Image metabox.
13+
14+
== Description ==
15+
16+
Custom the title, content and link / button text in the Featured Image metabox.
17+
18+
== Installation ==
19+
20+
= Using The WordPress Dashboard =
21+
22+
1. Navigate to the 'Add New' in the plugins dashboard
23+
2. Search for 'custom-featured-image-metabox'
24+
3. Click 'Install Now'
25+
4. Activate the plugin on the Plugin dashboard
26+
27+
= Uploading in WordPress Dashboard =
28+
29+
1. Navigate to the 'Add New' in the plugins dashboard
30+
2. Navigate to the 'Upload' area
31+
3. Select `custom-featured-image-metabox.zip` from your computer
32+
4. Click 'Install Now'
33+
5. Activate the plugin in the Plugin dashboard
34+
35+
= Using FTP =
36+
37+
1. Download `custom-featured-image-metabox.zip`
38+
2. Extract the `custom-featured-image-metabox` directory to your computer
39+
3. Upload the `custom-featured-image-metabox` directory to the `/wp-content/plugins/` directory
40+
4. Activate the plugin in the Plugin dashboard
41+
42+
== Screenshots ==
43+
44+
1. A settings page for this plugin
45+
2. A customized Featured Image metabox
46+
47+
== Changelog ==
48+
49+
= 0.1.0 =
50+
* The first version

admin/assets/css/admin.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* This stylesheet is used to style the admin option form of the plugin. */

admin/assets/css/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php // Silence is golden

admin/assets/js/admin.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(function ( $ ) {
2+
"use strict";
3+
4+
$(function () {
5+
6+
// Place your administration-specific JavaScript here
7+
8+
});
9+
10+
}(jQuery));

admin/assets/js/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php // Silence is golden
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
<?php
2+
/**
3+
* Custom Featured Image Metabox.
4+
*
5+
* @package Custom_Featured_Image_Metabox_Admin
6+
* @author 1fixdotio <1fixdotio@gmail.com>
7+
* @license GPL-2.0+
8+
* @link http://1fix.io
9+
* @copyright 2014 1Fix.io
10+
*/
11+
12+
/**
13+
* Plugin class. This class should ideally be used to work with the
14+
* administrative side of the WordPress site.
15+
*
16+
* If you're interested in introducing public-facing
17+
* functionality, then refer to `class-custom-featured-image-metabox.php`
18+
*
19+
* @package Custom_Featured_Image_Metabox_Admin
20+
* @author 1fixdotio <1fixdotio>
21+
*/
22+
class Custom_Featured_Image_Metabox_Admin {
23+
24+
/**
25+
* Instance of this class.
26+
*
27+
* @since 0.1.0
28+
*
29+
* @var object
30+
*/
31+
protected static $instance = null;
32+
33+
/**
34+
* Slug of the plugin screen.
35+
*
36+
* @since 0.1.0
37+
*
38+
* @var string
39+
*/
40+
protected $plugin_screen_hook_suffix = null;
41+
42+
/**
43+
* Initialize the plugin by loading admin scripts & styles and adding a
44+
* settings page and menu.
45+
*
46+
* @since 0.1.0
47+
*/
48+
private function __construct() {
49+
50+
/*
51+
* @TODO :
52+
*
53+
* - Uncomment following lines if the admin class should only be available for super admins
54+
*/
55+
/* if( ! is_super_admin() ) {
56+
return;
57+
} */
58+
59+
/*
60+
* Call $plugin_slug from public plugin class.
61+
*
62+
*/
63+
$plugin = Custom_Featured_Image_Metabox::get_instance();
64+
$this->plugin_slug = $plugin->get_plugin_slug();
65+
66+
// Load admin style sheet and JavaScript.
67+
// add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
68+
// add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
69+
70+
// Add the options page and menu item.
71+
add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) );
72+
73+
// Add an action link pointing to the options page.
74+
$plugin_basename = plugin_basename( plugin_dir_path( realpath( dirname( __FILE__ ) ) ) . $this->plugin_slug . '.php' );
75+
add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'add_action_links' ) );
76+
77+
/*
78+
* Define custom functionality.
79+
*
80+
* Read more about actions and filters:
81+
* http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
82+
*/
83+
// add_action( '@TODO', array( $this, 'action_method_name' ) );
84+
// add_filter( '@TODO', array( $this, 'filter_method_name' ) );
85+
86+
}
87+
88+
/**
89+
* Return an instance of this class.
90+
*
91+
* @since 0.1.0
92+
*
93+
* @return object A single instance of this class.
94+
*/
95+
public static function get_instance() {
96+
97+
// If the single instance hasn't been set, set it now.
98+
if ( null == self::$instance ) {
99+
self::$instance = new self;
100+
}
101+
102+
return self::$instance;
103+
}
104+
105+
/**
106+
* Register and enqueue admin-specific style sheet.
107+
*
108+
* @since 0.1.0
109+
*
110+
* @return null Return early if no settings page is registered.
111+
*/
112+
public function enqueue_admin_styles() {
113+
114+
if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
115+
return;
116+
}
117+
118+
$screen = get_current_screen();
119+
if ( $this->plugin_screen_hook_suffix == $screen->id ) {
120+
wp_enqueue_style( $this->plugin_slug .'-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), Custom_Featured_Image_Metabox::VERSION );
121+
}
122+
123+
}
124+
125+
/**
126+
* Register and enqueue admin-specific JavaScript.
127+
*
128+
* @since 0.1.0
129+
*
130+
* @return null Return early if no settings page is registered.
131+
*/
132+
public function enqueue_admin_scripts() {
133+
134+
if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
135+
return;
136+
}
137+
138+
$screen = get_current_screen();
139+
if ( $this->plugin_screen_hook_suffix == $screen->id ) {
140+
wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), Custom_Featured_Image_Metabox::VERSION );
141+
}
142+
143+
}
144+
145+
/**
146+
* Register the administration menu for this plugin into the WordPress Dashboard menu.
147+
*
148+
* @since 0.1.0
149+
*/
150+
public function add_plugin_admin_menu() {
151+
152+
/*
153+
* Add a settings page for this plugin to the Settings menu.
154+
*
155+
* NOTE: Alternative menu locations are available via WordPress administration menu functions.
156+
*
157+
* Administration Menus: http://codex.wordpress.org/Administration_Menus
158+
*
159+
* @TODO:
160+
*
161+
* - Change 'Custom Featured Image Metabox' to the title of your plugin admin page
162+
* - Change 'Custom Featured Image Metabox' to the text for menu item for the plugin settings page
163+
* - Change 'manage_options' to the capability you see fit
164+
* For reference: http://codex.wordpress.org/Roles_and_Capabilities
165+
*/
166+
$this->plugin_screen_hook_suffix = add_options_page(
167+
__( 'Custom Featured Image Metabox', $this->plugin_slug ),
168+
__( 'Custom Featured Image Metabox', $this->plugin_slug ),
169+
'manage_options',
170+
$this->plugin_slug,
171+
array( $this, 'display_plugin_admin_page' )
172+
);
173+
174+
}
175+
176+
/**
177+
* Render the settings page for this plugin.
178+
*
179+
* @since 0.1.0
180+
*/
181+
public function display_plugin_admin_page() {
182+
include_once( 'views/admin.php' );
183+
}
184+
185+
/**
186+
* Add settings action link to the plugins page.
187+
*
188+
* @since 0.1.0
189+
*/
190+
public function add_action_links( $links ) {
191+
192+
return array_merge(
193+
array(
194+
'settings' => '<a href="' . admin_url( 'options-general.php?page=' . $this->plugin_slug ) . '">' . __( 'Settings', $this->plugin_slug ) . '</a>'
195+
),
196+
$links
197+
);
198+
199+
}
200+
201+
/**
202+
* NOTE: Actions are points in the execution of a page or process
203+
* lifecycle that WordPress fires.
204+
*
205+
* Actions: http://codex.wordpress.org/Plugin_API#Actions
206+
* Reference: http://codex.wordpress.org/Plugin_API/Action_Reference
207+
*
208+
* @since 0.1.0
209+
*/
210+
public function action_method_name() {
211+
// @TODO: Define your action hook callback here
212+
}
213+
214+
/**
215+
* NOTE: Filters are points of execution in which WordPress modifies data
216+
* before saving it or sending it to the browser.
217+
*
218+
* Filters: http://codex.wordpress.org/Plugin_API#Filters
219+
* Reference: http://codex.wordpress.org/Plugin_API/Filter_Reference
220+
*
221+
* @since 0.1.0
222+
*/
223+
public function filter_method_name() {
224+
// @TODO: Define your filter hook callback here
225+
}
226+
227+
}

admin/includes/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php // Silence is golden

admin/views/admin.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Represents the view for the administration dashboard.
4+
*
5+
* This includes the header, options, and other information that should provide
6+
* The User Interface to the end user.
7+
*
8+
* @package Plugin_Name
9+
* @author Your Name <email@example.com>
10+
* @license GPL-2.0+
11+
* @link http://example.com
12+
* @copyright 2014 Your Name or Company Name
13+
*/
14+
?>
15+
16+
<div class="wrap">
17+
18+
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
19+
20+
<!-- @TODO: Provide markup for your options page here. -->
21+
22+
</div>

admin/views/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php // Silence is golden

0 commit comments

Comments
 (0)