Skip to content

Commit 44fc2ff

Browse files
committed
URL rewrite for invoice.
1 parent 58b10ac commit 44fc2ff

File tree

2 files changed

+44
-9
lines changed

2 files changed

+44
-9
lines changed

includes/paystack-invoice.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
<title>Paystack Invoice</title>
3+
<?php
4+
//call the wp head so you can get most of your wordpress
5+
get_header();
6+
?>
7+
8+
<?php
9+
echo @$_GET['code'];
10+
11+
?>
12+
<h1>Here's my plugin front-end page</h1>
13+
<h2>You can put anything you want in this php file.</h2>
14+
<h2>You can put anything you want in this php file.</h2>
15+
<h2>You can put anything you want in this php file.</h2>
16+
<h2>You can put anything you want in this php file.</h2>
17+
<h2>You can put anything you want in this php file.</h2>
18+
<h2>You can put anything you want in this php file.</h2>
19+
<h2>You can put anything you want in this php file.</h2>
20+
<h2>You can put anything you want in this php file.</h2>
21+
<h2>You can put anything you want in this php file.</h2>
22+
<h2>You can put anything you want in this php file.</h2>
23+
<h2>You can put anything you want in this php file.</h2>
24+
<h2>You can put anything you want in this php file.</h2>
25+
<h2>You can put anything you want in this php file.</h2>
26+
<h2>You can put anything you want in this php file.</h2>
27+
<h2>You can put anything you want in this php file.</h2>
28+
<h2>You can put anything you want in this php file.</h2>
29+
<h2>You can put anything you want in this php file.</h2>
30+
<h2>You can put anything you want in this php file.</h2>
31+
<h2>You can put anything you want in this php file.</h2>
32+
<h2>You can put anything you want in this php file.</h2>
33+
<?php
34+
//call the wp foooter
35+
get_footer();
36+
?>

paystack-forms.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,12 @@ function insertInput(){
143143
<?php
144144
}
145145
}
146-
function elegance_referal_init()
147-
{
148-
if(is_page('share')){
149-
$dir = plugin_dir_path( __FILE__ );
150-
include($dir."frontend-form.php");
151-
die();
152-
}
146+
add_action( 'init', 'invoice_url_rewrite' );
147+
function invoice_url_rewrite(){
148+
global $wp_rewrite;
149+
$plugin_url = plugins_url( 'includes/paystack-invoice.php', __FILE__ );
150+
$plugin_url = substr( $plugin_url, strlen( home_url() ) + 1 );
151+
$wp_rewrite->non_wp_rules['paystackinvoice$'] = $plugin_url;
152+
file_put_contents(ABSPATH.'.htaccess', $wp_rewrite->mod_rewrite_rules() );
153+
// $wp_rewrite->add_external_rule( 'paystackinvoice$', $plugin_url );
153154
}
154-
155-
add_action( 'wp', 'elegance_referal_init' );

0 commit comments

Comments
 (0)