Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] - New page button, for pg not found
#1
Is there a way to have a 404 page not found, know what page was being attempted and have a button that offers to create a new page with that name?

Media Wiki does this, and I would like to do this, if it is possible.
Thanks,
jwzumwalt
(\__/)
(='.'=)
(")_(")
Reply
#2
(2016-01-06, 00:13:25)jwzumwalt Wrote: Is there a way to have a 404 page not found, know what page was being attempted and have a button that offers to create a new page with that name?

Media Wiki does this, and I would like to do this, if it is possible.

There is no built in functionality for this, but you can create plugin.
Reply
#3
(2016-01-06, 00:13:25)jwzumwalt Wrote: Is there a way to have a 404 page not found, know what page was being attempted and have a button that offers to create a new page with that name?

Media Wiki does this, and I would like to do this, if it is possible.

Possible
Reply
#4
Since the problem is solved, it is possible that solution may be useful for others users.

1. Create new plugin with given code and activate it.
PHP Code:
<?php
/*
Plugin Name: New Page From 404
Description: Helps user to create a new page from 404 
Version: 0.1
Author: Dmitry Yakovlev
Author URI: http://dimayakovlev.ru
*/

$thisfile basename(__FILE__'.php');

# register plugin
register_plugin(
 
 $thisfile,
 
 'New Page From 404',
 
 '1.0',
 
 'Dmitry Yakovlev',
 
 'http://dimayakovlev.ru',
 
 'Helps user to create a new page from 404',
 
 '',
 
 ''
);

add_action('admin-pre-header''get_new_page_from_404_admin');

function 
get_new_page_from_404_admin() {
 
 global $url;
 
 if (basename($_SERVER['PHP_SELF']) == 'edit.php') {
 
   if (!$url && isset($_GET['newpagefrom404'])) {
 
     $url $_GET['newpagefrom404'];
 
   }
 
 }
}

function 
get_new_page_from_404_link($link_title) {
 
 global $id$url$GSADMIN;
 
 if ($url '404' && $id != '404' && is_logged_in()) {
 
   $url get_site_url(false) . $GSADMIN '/edit.php?newpagefrom404=' urlencode($id);
 
   echo '<a href="' $url '">' $link_title '</a>';
 
  


2. Place this code in template file which used for your website 404 page.
PHP Code:
if (function_exists('get_new_page_from_404_link')) {
 
 get_new_page_from_404_link('Create page');

Done!
Reply




Users browsing this thread: 1 Guest(s)
Free HDTV Channels Residential Solar Panels