Ich bekomme es nicht hin. Ich will ein vorhanden Shortcode löschen und eins mit dem gleichen Namen erstellen.
Child Theme Funktions.php
Code
function shortcode_cleaner() {
remove_shortcode( 'information' );
add_shortcode( 'information', 'my_remove_shortcode' );
}
add_action( 'init', 'shortcode_cleaner' );
function my_remove_shortcode( $atts, $content = null ) {
return '<div class="information"><p><span>Test </span>' .do_shortcode($content). '</p></div>'; }
original shortcodes.php
Code
// Information shortcode
function shortcode_information( $atts, $content = null ) {
return '<div class="information"><p><span>Information </span>' .do_shortcode($content). '</p></div>';
}
function pre_process_shortcode($content) {
global $shortcode_tags;
// Backup current registered shortcodes and clear them all out
$orig_shortcode_tags = $shortcode_tags;
$shortcode_tags = array();
add_shortcode('soundcloud', 'shortcode_soundcloud');
add_shortcode('youtube', 'shortcode_youtube');
add_shortcode('vimeo', 'shortcode_vimeo');
add_shortcode('button', 'shortcode_button');
add_shortcode('dropcap', 'shortcode_dropcap');
add_shortcode('highlight', 'shortcode_highlight');
add_shortcode('checklist', 'shortcode_checklist');
add_shortcode('badlist', 'shortcode_badlist');
add_shortcode('blocklist', 'shortcode_blocklist');
add_shortcode('tabs', 'shortcode_tabs');
add_shortcode('tab', 'shortcode_tab');
add_shortcode('toggle', 'shortcode_toggle');
add_shortcode('one_fourth', 'shortcode_one_fourth');
add_shortcode("one_half","shortcode_one_half");
add_shortcode('one_third', 'shortcode_one_third');
add_shortcode('two_third', 'shortcode_two_third');
add_shortcode('three_fourth', 'shortcode_three_fourth');
add_shortcode('attention', 'shortcode_attention');
add_shortcode('information', 'shortcode_information');
add_shortcode('error', 'shortcode_error');
add_shortcode("googlemap", "shortcode_googleMaps");
// Do the shortcode (only the one above is registered)
$content = do_shortcode($content);
// Put the original shortcodes back
$shortcode_tags = $orig_shortcode_tags;
return $content;
}
add_filter('the_content', 'pre_process_shortcode', 7);
add_filter('widget_text', 'pre_process_shortcode');
Alles anzeigen
keine ahnung ob ich noch was vergessen habe, aber er zeigt immer wieder das alte an.