Categories
Plugins WordPress

Edit Hopper

The purpose of this plugin is to allow WordPress admin’s to more easily navigate through child and parent pages. This plugin will create a widget in the WordPress admin interface on a Page Edit screen. It will show any child or parent pages and allow you to navigate to those pages by simply clicking the link for that page. The .zip can be downloaded here.¬†Similarly, you can take the following code and copy it into your theme’s¬†functions.php file.

function edit_hopper_main(){
echo "<div class='ultimate-container'>";
echo "<div class='hopper-title'><strong>Click a page to go to the edit page</strong></div></br>";

$current = get_post($id);
$parvar = $current->post_parent;
if($parvar) {
echo "<div class='hopper-parent-link'><a href='" . get_edit_post_link( $parvar) . "'>"
. get_post($parvar)->post_title . "</a></div>";
}

echo "<div class='hopper-current-link'>".get_post( $id)->post_title. "</div>";
$args = array(
'post_type' => 'page',
'child_of' => (get_post($id)->ID));
$children = get_pages($args);
if($children)
{
foreach ($children as $child) {
echo "<div class='hopper-child-link'><a href='" . get_edit_post_link($child->ID) . "'>"
. get_post($child->ID)->post_title . "</a></div>";
}
}

echo "</div>";
}

function edit_hopper_custom_box() {
$screens = array( 'post', 'page' );

foreach ( $screens as $screen ) {

add_meta_box(
'edit_hopper_box',
__( 'Edit Screen Page Hopper', 'edit_hopper_textdomain' ),
'edit_hopper_main',
$screen
);
}
}
add_action( 'add_meta_boxes', 'edit_hopper_custom_box' );

?>

By Dylan Hildenbrand

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.