2016-01-19, 23:46:52
(This post was last modified: 2016-01-20, 01:44:53 by DimaYakovlev.)
jwzumwalt, you can try another way, with using Shawns plugin sa hook components.
For simplicity, I combined all code into one component. But you can split it into to two components - one for frontend, another for backend.
How to use:
1. Install sa hook components plugin;
2. Create new component with name hook_admin-pre-header and paste into it given PHP code;
3. Call created component from your template or from another component. For example place this code in the default sidebar component:
For simplicity, I combined all code into one component. But you can split it into to two components - one for frontend, another for backend.
PHP Code:
<?php
global $GSADMIN;
global $id;
global $url;
if (is_frontend()) {
if ($url == '404' && $id != $url && is_logged_in()) {
$url = get_site_url(false) . $GSADMIN . '/edit.php?newpagefrom404=' . urlencode($id);
echo '<a href="' . $url . '">Create page</a>';
}
} else {
if (basename($_SERVER['PHP_SELF']) == 'edit.php') {
if (!$url && isset($_GET['newpagefrom404'])) {
$url = $_GET['newpagefrom404'];
}
}
}
?>
1. Install sa hook components plugin;
2. Create new component with name hook_admin-pre-header and paste into it given PHP code;
3. Call created component from your template or from another component. For example place this code in the default sidebar component:
PHP Code:
<?php get_component('hook_admin-pre-header'); ?>