Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7ada416
Showing
4 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.class | ||
*.pyc | ||
*.pyo |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Post Parents</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>com.aptana.editor.php.aptanaPhpBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.aptana.ide.core.unifiedBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>com.aptana.editor.php.phpNature</nature> | ||
<nature>com.aptana.projects.webnature</nature> | ||
</natures> | ||
</projectDescription> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
phpVersion=php5.3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
/* | ||
Plugin Name: Post Parents | ||
Plugin URI: http://mtekk.us/code/ | ||
Description: Adds a metabox that allows you to set a page as the parent of a post | ||
Version: 0.0.1 | ||
Author: John Havlik | ||
Author URI: http://mtekk.us/ | ||
License: GPL2 | ||
TextDomain: mtekk-post-parents | ||
DomainPath: /languages/ | ||
*/ | ||
/* Copyright 2012 John Havlik (email : mtekkmonkey@gmail.com) | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
*/ | ||
/** | ||
* The plugin class | ||
*/ | ||
class mtekk_post_parents | ||
{ | ||
protected $version = '0.0.3'; | ||
protected $full_name = 'Post Parents'; | ||
protected $short_name = 'Post Parents'; | ||
protected $access_level = 'manage_options'; | ||
protected $identifier = 'mtekk_post_parents'; | ||
protected $unique_prefix = 'mpp'; | ||
protected $plugin_basename = 'post-parents/post_parents.php'; | ||
/** | ||
* mlba_video | ||
* | ||
* Class default constructor | ||
*/ | ||
function __construct() | ||
{ | ||
//We set the plugin basename here, could manually set it, but this is for demonstration purposes | ||
$this->plugin_basename = plugin_basename(__FILE__); | ||
add_action('add_meta_boxes', array($this, 'meta_boxes')); | ||
} | ||
/** | ||
* Function that fires on the add_meta_boxes action | ||
*/ | ||
function meta_boxes() | ||
{ | ||
//Add our post parent metabox | ||
add_meta_box('postparentdiv', __('Parent', 'mtekk-post-parents'), array($this,'parent_meta_box'), 'post', 'side', 'high'); | ||
} | ||
/** | ||
* This function outputs the post parent metabox | ||
* | ||
* @param WP_Post $post The post object for the post being edited | ||
*/ | ||
function parent_meta_box($post) | ||
{ | ||
//If we use the parent_id we can sneak in with WP's styling and post save routines | ||
wp_dropdown_pages(array( | ||
'name' => 'parent_id', | ||
'id' => 'parent_id', | ||
'echo' => 1, | ||
'show_option_none' => __( '— Select —' ), | ||
'option_none_value' => '0', | ||
'selected' => $post->post_parent) | ||
); | ||
} | ||
} | ||
$mtekk_post_parents = new mtekk_post_parents(); |