Plugin for URL shortener
-
I have problem with this code… I want to make plugin that will automaticaly add https://shorted.ga/’.$userid.’/’.$type.’/ just after ‘href=”‘ – This is something like adfly Easy Link but I want to make wordpress pluggin for it… I made everything – I just don’t know what should I edit here to make my script save settings…
`<?php
/*
Plugin Name: Shorted.ga Easy Link pluggin
Plugin URI: https://shorted.ga/
Description: Just simple, if you use this plugins, your Shorted.ga EASY LINK will be added automatically, for all the external links of your website posts or pages.
Version: 1.0
Author: John
Author URI: https://shorted.ga/
License: GPL2
*/
function register_my_setting() {
register_setting( ‘shorted’, ‘shortedgaid-info-settings’ );
register_setting( ‘shorted’, ‘shortedgatip-info-settings’ );
}
add_action( ‘admin_init’, ‘register_my_setting’ );
add_filter( ‘the_content’, ‘cn_nf_url_parse2’);
function cn_nf_url_parse2( $content ) {
$tip = get_option( ‘shortedgatip_info’ );
$id = get_option( ‘shortedga_info’ );
$content = str_replace(‘href=”‘, ‘href=”https://shorted.ga/’.$id.’/’.$tip.’/’, $content);
return $content;
}
add_action( ‘admin_menu’, ‘register_shortedga_menu_page’ );
function register_shortedga_menu_page(){
add_menu_page( ‘Shorted Menu’, ‘Shorted Menu’, ‘manage_options’, ‘shorted-easy-link-pluggin/shorted-easy-link-pluggin.php’, ‘shortedga_menu_page’, ”, 6 );
}
function shortedga_menu_page(){
?><h1>Shorted.ga Menu Options</h1>
<form method=”post” action=”options.php”>
<?php settings_fields( ‘shortedgaid-info-settings’ ); ?>
<?php do_settings_sections( ‘shortedgaid-info-settings’ ); ?>
<?php settings_fields( ‘shortedgatip-info-settings’ ); ?>
<?php do_settings_sections( ‘shortedgatip-info-settings’ ); ?>
<table class=”form-table”>
<tr valign=”top”>
<th scope=”row”>Shorted.ga Menu Options</th>
</tr> <tr valign=”top”> <td>Please add your Shorted.ga ID<br /><input type=”text” name=”‘shortedgaid-info” value=”<?php echo get_option( ‘shortedgaid-info’ ); ?>”/></td>
</tr> <tr valign=”top”>
<td>Please write correct type of links “0” for Family Safe and “1” for Adult links<br /><input type=”text” name=”shortedgatip-info” value=”<?php echo get_option( ‘shortedgatip-info’ ); ?>”/></td>
</tr>
</table>
<?php submit_button(); ?></form>
<?php
}`
I always get ERROR: options page not found.
- The topic ‘Plugin for URL shortener’ is closed to new replies.