• Hello,

    I’m using a custom welcome widget. I have added the code to my themes function.php. I noticed that when I change the theme the welcome widget doesn’t appear – obviously as the active function.php file has changed. Is there a way to make the widget appear always no matter which theme is activated

    <?php
    
    // DASHBOARD WELCOME WIDGET
    
    function register_raccoonbox_ohjauspaneeli_vimpain() {
     	global $wp_meta_boxes;
    
    	wp_add_dashboard_widget(
    		'raccoonbox_ohjauspaneeli_vimpain',
    		'Tervetuloa mahtavalle sivullesi!',
    		'raccoonbox_ohjauspaneeli_vimpain_display'
    	);
    
     	$dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
    
    	$my_widget = array( 'raccoonbox_ohjauspaneeli_vimpain' => $dashboard['raccoonbox_ohjauspaneeli_vimpain'] );
     	unset( $dashboard['raccoonbox_ohjauspaneeli_vimpain'] );
    
     	$sorted_dashboard = array_merge( $my_widget, $dashboard );
     	$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
    }
    add_action( 'wp_dashboard_setup', 'register_raccoonbox_ohjauspaneeli_vimpain' );
    
    function raccoonbox_ohjauspaneeli_vimpain_display() {
    	?>
    
      <a href="https://raccoonbox.com" target="_blank"><img src="https://raccoonbox.com/raccoonbox-img/RACCOONBOX-logo_200.png" alt="Raccoonbox logo" width="100px" height="100px"></a>
    
    	<p>
    	   Lorem
    	</p>
    	<p>
    	   Lorem
    	</p>
    
    	<?php
    }
    
    // EDIT ADMIN FOOTER
    
    add_filter('admin_footer_text', 'remove_footer_admin'); //change admin footer text
    function remove_footer_admin () {
    echo 'Kiitos kun valitsit <a href="https://raccoonbox.com">Raccoonboxin</a> | Muotoilija <a href="https://raccoonbox.com/muotoilijat">Konstantin Nikkari</a';
    }
    
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Welcome Widget in all themes’ is closed to new replies.