so i'm looking for a global wysiwyg widget editor that will

so i’m looking for a global wysiwyg widget editor that will let me create/edit a widget on the top level multi site and then show up on all the sub sites…. i have 300+ sites and to edit the same widget on 300+ sites is a real pain!… i was looking for some way i can create a widget area on each site that is edited in the network admin/sites..so that it would ‘push’ to all the sub sites…

  • goldeneye
    • Site Builder, Child of Zeus

    i build my own themes so it would be possible that i could do some type of shortcode or sidebar like this on each of my themes

    <div class="row">
    <div class="col-md-4"><?php theme_print_sidebar('first-footer-widget-area'); ?></div>
    <div class="col-md-4"><?php theme_print_sidebar('second-footer-widget-area'); ?></div>
    <div class="col-md-4"><?php theme_print_sidebar('third-footer-widget-area'); ?></div>
    </div>

    where first/second/third/-footer-widget-area was a ‘global’ widget in the network editor, then all i’d have to do is edit that widget in the network and it would show on all the sites that had this in there theme…

  • goldeneye
    • Site Builder, Child of Zeus

    but what i’m trying to avoid is having to edit every site when the the content of the widget changes…. think of it like “advertizing” space…. each week we change advertizes and having to change the widget on all 300+ sites is a real pain/time consuming…

    i would think that other WPMU devs would want the ability to have ad space that is widgetized and able to edit in one location…. :slight_smile:

  • goldeneye
    • Site Builder, Child of Zeus

    so i was able to get the data from the wp_options for the spicific widget like so:

    <?php
    $text_widgets = get_option( 'widget_text' );
    $mainItem = $text_widgets[10]['text'];
    print_R($mainItem);
    ?>

    that will print out the widget id 10 content on screen….. i ‘guess’ i could do something like this:

    <?php
    $text_widgets = get_option( 'widget_text' );
    $Footer1Widget = $text_widgets[7]['text'];
    $Footer2Widget = $text_widgets[9]['text'];
    $Footer3Widget = $text_widgets[10]['text'];
    //echo"<pre>";print_R($text_widgets);echo"</pre>";
    ?>
    <div class="row">
    <div class="col-md-4"><?php print($Footer1Widget); ?></div>
    <div class="col-md-4"><?php print($Footer2Widget); ?></div>
    <div class="col-md-4"><?php print($Footer3Widget);?></div>
    </div>

  • Hoang Ngo
    • Code Slayer

    Hi @goldeneye,

    I hope you are well today

    The code you posted above should work, but that’s only display the widget content.

    Just for clarify, so what you want is in the network admin, if you update the settings and click save, all the widgets will force to implement that settings?

    Please advise,

    Thanks!!!

    Best regards,

    Hoang

  • goldeneye
    • Site Builder, Child of Zeus

    the main goal is to have a WYSIWYG editor for a widget in the network admin, then i can use the widget created in the network admin on all sub site…. we have 300+ sites that all “share” the same widget (like footer/advertizements/etc.” when we update/change the content of one of these widgets i have to go to all 300+ sites and change each one… which is a pain/time consuming…

    what i was looking for was to have a plugin/place were someone with “author” rights could log into the network admin, go to some type of WYSIWYG widget editor, update the widget content and that would replicate to all the sub sites with out having to edit every sub site…. since i control ALL the themes i can ‘hard code’ what ever is needed in the theme files to ‘call’ the ‘global widget’ ..sort of like the above code sample….

    i have found this WYSIWYG editor to work well for a single site, but it does not support multi-site/global widgets… http://wordpress.org/plugins/wysiwyg-widgets/

    i would imagine that other multi-site owners would love to have one place to edit/update/change ‘globally’ a widget area that would replicate to all sub sites.. think of it as if we had google ads or other types of banners/advertizements that we wanted to push to each site… and not have to edit each one individual… and not have to know “code” to make it “look” nice hence the WYSIWYG editor.. yet another WPMYDEV plugin to sell :slight_smile: something like you do with the global posts and post indexer https://premium.wpmudev.org/project/recent-global-posts-widget/

    i would be glad to help build it if you would like to collaborate….

  • Hoang Ngo
    • Code Slayer

    Hi @goldeneye

    Many thanks for your clarification.

    Actually, we can do that, but each widget, will need it own code for manager the content & settings for whole network.

    Unfortunately, this is beyond the scope of custom coding that we could provide. What I can do now is making a general code template, and you can base on that build the logic for your widgets.

    Best Regards

    Hoang

  • Hoang Ngo
    • Code Slayer

    Hi @goldeneye,

    I hope you are well today

    This is a demo code, which will push the new data to all of the text widgets in your network.

    Please add this code to your theme functions.php or use mu-plugins

    add_action( 'network_admin_menu', 'custom_network_admin_menu' );
    function custom_network_admin_menu() {
    add_menu_page( __( 'Update Text Widget' ), __( 'Update Text Widget' ), 'manage_options', 'update-text-widget', 'push_text_widget_to_all' );
    }

    function push_text_widget_to_all() {
    $saved = 0;
    if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
    if ( ! wp_verify_nonce( $_POST['_wpnonce'], 'push_widgets' ) ) {
    return '';
    }

    $title = $_POST['title'];
    $text = $_POST['text'];
    $blogs = wp_get_sites();
    foreach ( $blogs as $blog ) {
    switch_to_blog( $blog['blog_id'] );
    $widget_datas = get_option( 'widget_text' );
    //backup first
    wp_cache_set( 'widget_text_backup_' . time(), $widget_datas );
    foreach ( $widget_datas as $key => $widget ) {
    if ( ! empty( $widget ) ) {
    $widget_datas[$key]['title'] = $title;
    $widget_datas[$key]['text'] = $text;
    }
    }
    update_option( 'widget_text', $widget_datas );
    $saved = 1;

    }
    restore_current_blog();
    }
    ?>
    <?php if ( $saved == 1 ): ?>
    <p>The new data has pushed</p>
    <?php endif; ?>
    <form method="post">
    <table class="form-table">
    <tr>
    <th>Title</th>
    <td><input type="text" name="title"></td>
    </tr>
    <tr>
    <th>Text</th>
    <td><textarea name="text"></textarea></td>
    </tr>
    <?php wp_nonce_field( 'push_widgets' ) ?>

    </table>
    <p><input type="submit" value="Save"></p>
    </form>
    <?php
    }

    After added, you will see a new menu from your network admin, it having a form, just click submit for new data.

    Please use this on your test network first, before implement on the live site.

    If you have any issues please don’t hesitate to let us know so we can assist

    Best regards,

    Hoang

  • Hoang Ngo
    • Code Slayer

    Hmm, yes, your code seem have some convert when copy & pasted and this become error. Can you please send in:

    – Mark to my attention – ATTN: Hoang Ngo

    – Link back to this thread

    – Include admin/network access

    – Include FTP

    – Include any relevant URLS for your site

    On the contact form, select “I have a different question”, this ensures it comes through and gets assigned to me.

    So I can copy that for you :slight_smile:

    Best regards,

    Hoang

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.