Ok ist ja doch ganz einfach. Habe jetzt auch angefangen, habe aber ein Problem mit php. Das habe ich bis jetzt:
PHP
<?php
/*
Plugin Name: php und html bbcode
Plugin URI: http://alti.uttx.net/blog/
Description: ein plugin das ein html und ein php bbcod ermöglicht.
Version: 1.0
Author: Oliver Loh
Author URI: http://alti.uttx.net/blog/
*/
add_filter('the_content', 'bbcode');
function bbcode($content) {
$content = preg_replace("!\[php\]<\?php(.*)\?>\[/php\]!isU",
highlight_string("$1", TRUE),$content);
$content = preg_replace("!\[php\](.*)\[/php\]!isU",
highlight_string("<?php $1 ?>", TRUE),$content);
/* $content = preg_replace("!\[html\](<)\[/html\]!isU", str_replace("$1", "<", $content), $content);
$content = preg_replace("!\[html\](>)\[/html\]!isU", str_replace("$1", ">", $content), $content);
$content = preg_replace("!\[html\](&)\[/html\]!isU", str_replace("$1", "&", $content), $content);
$content = preg_replace("!\[html\](\")\[/html\]!isU", str_replace("$1", """, $content), $content); */
return $content;
}
?>
Alles anzeigen
Es geht mir hauptsächlich erst mal um die php Funktion. Wenn ich jetzt einen Beitrag schreibe, der in etwa so aussieht: Bla bla bla, [code=php]<?php echo "foobar"; ?>
Bekomme ich nur folgendes ausgegeben: