Hi,
wie schon einmal angemerkt bin ich neuer Wordpress User, dennoch möchte ich ein Plugin coden das die Permalink Tags um das %monthname% Tag erweitert.
Und man also statt der Monatszahl auch den Monatsnamen nehmen kann.
Doch das Tag %monthname% wird mit folgendem, Plugin-Code, nicht richtig ersetzt, hab das Objekt nach dem Methodenaufruf mal dumpen lassen:
PHP
class monthname {
/* get_monthnames([$seperator])
* this function return all monthnames out of the local.php
* in a line seperted with the $seperator
*/
function get_monthnames($seperator='|') {
global $month;
$monthnames = '';
foreach($month as $name) {
// add seperator before the current monthname if this is NOT the first name
if(!empty($monthnames)) {
$monthnames .= $seperator;
}
$monthnames .= $name;
}
return $monthnames;
}
function replace_monthname($rewrite) {
$rewrite->add_rewrite_tag('%monthname%', '('.monthname::get_monthnames('|').')', 'monthname=');
var_dump($rewrite);
}
}
add_action('generate_rewrite_rules', array('monthname', 'replace_monthname'));
Alles anzeigen
Hat jemand eine Idee?
Nen Beispiel aus dem Dump:
Grüße,
Schaelle