I am creating a Wordpress Plugin that creates shortcodes. I want to load those shortcodes with an given name via my plugin.
like this [name]
But when I save my shortcode the shortcode is generated but not saved
What am I doing wrong.
This is my form
<form method="post" enctype="multipart/form-data">
<table>
<tr>
<td>
Naam:
</td>
<td>
<input name="naam" type="text" placeholder="Geef hier een unieke naam op" required/>
</td>
</tr>
<tr>
<td>
Site URL:
</td>
<td>
<input name="url" type="text" placeholder="Site URL" required/>
</td>
</tr>
<tr>
<td>
Breedte:
</td>
<td>
<input name="breedte" type="text" placeholder="Breedte in pixels" required/>
</td>
</tr>
<tr>
<td>
Bevestig:
</td>
<td>
<?php submit_button('Upload') ?>
</td>
</tr>
</table>
</form>
On post:
if(isset($_POST['naam'])) {
$naam = $_POST['naam'];
$url = $_POST['url'];
$breedte = $_POST['breedte'];
createShortcode($naam, $url, $breedte);
add_shortcode($naam, 'createShortcode');
}
Create shortcode function
function createShortcode($naam, $url, $breedte){
echo 'Naam: ' . $naam . ' ';
echo 'URL: ' . $url . ' ';
echo 'Breedte: ' . $breedte . ' ';
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire