Willkommen |
|
myGully |
|
Links |
|
Forum |
|
|
|
 |
01.11.10, 02:19
|
#1
|
Newbie
Registriert seit: Aug 2008
Beiträge: 39
Bedankt: 100
|
Wordpress bbcode
Hallo,
ich habe ein Problem mit Wordpress.
Hab das bbcode Plugin installed.
Mein Problem ist jetzt, das wenn man einen Link einfügen will, man immer
PHP-Code:
[url="link"]text[/url]
eingeben muss.
Will aber, das man nur
PHP-Code:
[url=link]text[/url]
eingeben muss.
Das ist der Code im Plugin:
Code:
class BBCode {
// Plugin initialization
function BBCode() {
// This version only supports WP 2.5+ (learn to upgrade please!)
if ( !function_exists('add_shortcode') ) return;
// Register the shortcodes
add_shortcode( 'b' , array(&$this, 'shortcode_bold') );
add_shortcode( 'B' , array(&$this, 'shortcode_bold') );
add_shortcode( 'i' , array(&$this, 'shortcode_italics') );
add_shortcode( 'I' , array(&$this, 'shortcode_italics') );
add_shortcode( 'u' , array(&$this, 'shortcode_underline') );
add_shortcode( 'U' , array(&$this, 'shortcode_underline') );
add_shortcode( 'url' , array(&$this, 'shortcode_url') );
add_shortcode( 'URL' , array(&$this, 'shortcode_url') );
add_shortcode( 'img' , array(&$this, 'shortcode_image') );
add_shortcode( 'IMG' , array(&$this, 'shortcode_image') );
add_shortcode( 'quote' , array(&$this, 'shortcode_quote') );
add_shortcode( 'QUOTE' , array(&$this, 'shortcode_quote') );
}
// No-name attribute fixing
function attributefix( $atts = array() ) {
if ( empty($atts[0]) ) return $atts;
if ( 0 !== preg_match( '#=("|\')(.*?)("|\')#', $atts[0], $match ) )
$atts[0] = $match[2];
return $atts;
}
// Bold shortcode
function shortcode_bold( $atts = array(), $content = NULL ) {
if ( NULL === $content ) return '';
return '<strong>' . do_shortcode( $content ) . '</strong>';
}
// Italics shortcode
function shortcode_italics( $atts = array(), $content = NULL ) {
if ( NULL === $content ) return '';
return '<em>' . do_shortcode( $content ) . '</em>';
}
// Italics shortcode
function shortcode_underline( $atts = array(), $content = NULL ) {
if ( NULL === $content ) return '';
return '<span style="text-decoration:underline">' . do_shortcode( $content ) . '</span>';
}
// Italics shortcode
function shortcode_url( $atts = array(), $content = NULL ) {
$atts = $this->attributefix( $atts );
// [ Link nur für registrierte Mitglieder sichtbar. Bitte einloggen oder neu registrieren ]
if ( isset($atts[0]) ) {
$url = $atts[0];
$text = $content;
}
// [ Link nur für registrierte Mitglieder sichtbar. Bitte einloggen oder neu registrieren ]
else {
$url = $text = $content;
}
if ( empty($url) ) return '';
if ( empty($text) ) $text = $url;
return '<a href="' . $url . '">' . do_shortcode( $text ) . '</a>';
}
// Italics shortcode
function shortcode_image( $atts = array(), $content = NULL ) {
if ( NULL === $content ) return '';
return '<img src="' . $content . '" alt="" />';
}
// Italics shortcode
function shortcode_quote( $atts = array(), $content = NULL ) {
if ( NULL === $content ) return '';
return '<blockquote>' . do_shortcode( $content ) . '</blockquote>';
}
}
// Start this plugin once all other plugins are fully loaded
add_action( 'plugins_loaded', create_function( '', 'global $BBCode; $BBCode = new BBCode();' ) );
Hat da jemand ne Idee?
Auserdem bräuchte ich noch ne Funtkion, das wenn jemand nur einen Direktlink postet, also z.B. nur
PHP-Code:
http://something.com
das Wordpress dann
PHP-Code:
[url]something.com[/url]
draus macht. Kennt jemand sowas?
Demjenigen, der mir die richtige Lösung für beide Probleme gibt, biete ich einen 1 Monats Premium Account für Depostfiles.com
|
|
|
01.11.10, 08:15
|
#2
|
Mitglied
Registriert seit: Jan 2010
Beiträge: 334
Bedankt: 166
|
Eigenen BBCode schreiben? Es gibt von PHP sogar fertige BBCode-Funktionne!
|
|
|
01.11.10, 17:43
|
#3
|
Newbie
Registriert seit: Aug 2008
Beiträge: 39
Bedankt: 100
|
Das Problem ist ja, das ich nicht so gut coden kann  Deshalb frag ich ja hier nach hilfe.
EDIT: Das Problem mit dem ist nun gelöst!
Habe aber wieder ein neues
Uns wzar wenn ich habe:
PHP-Code:
[img]test.jpg[/img]
[url]test.de[/url]
Dann zeigt er mir nachher im Fertigen Beitrag den Link neben dem Bild an statt darunter.
Hat da einer noch eine Idee?
Hab WordpressVersion 3.0.1 und für den BBCODE das Plugin boingball-bbcode
EDIT2:
So nun sind alle Probleme gelöst! Trhead kann geschlossen werden.
|
|
|
Forumregeln
|
Du kannst keine neue Themen eröffnen
Du kannst keine Antworten verfassen
Du kannst keine Anhänge posten
Du kannst nicht deine Beiträge editieren
HTML-Code ist Aus.
|
|
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:44 Uhr.
().
|