The MU forums have moved to WordPress.org

Possible For Sitewide Widget? (11 posts)

  1. redsoxmaniac
    Member
    Posted 13 years ago #

    Is it possible that there can be a sitewide widget where you can have one function but it exist for every site that has the widget in its sidebar?

    For example, I change around a text widget to showcase different things to 20 blogs. It would be easier if I could change it just once, and that text is shown in 20 blogs, instead of changing it one by one.

    Is there a function that exists for any widgets? Or at least the text or rss widget?

  2. spherical
    Member
    Posted 13 years ago #

    I posted this in another thread a few days ago:

    Widget Cache has a 'feature' where a widget on one blog will appear with the same content across all blogs if it is in the same location in the sidebar and cached by Widget Cache plugin. It's not MU aware, so thinks that they're all the same. The author would do well, instead of fixing this 'feature', _make_ it a feature and write another version that is MU aware. That, or put in a switch to turn on site-wide for a particular widget in a particular location; leaving all others to cache/refresh at their own rates individually.

    In order for this to work you'd only set the cache time equally for the one widget in all blogs and leave the time field empty (turns off caching) in all others that you don't want to appear in all blogs with the same content. So, you'd set the time to something relatively short and any updates would refresh at the specified time, updating them all. Pretty cool, though not what was intended at first, I'd wager.

  3. redsoxmaniac
    Member
    Posted 13 years ago #

    Have you mentioned this to the author? I will check it out and see how it will work on my site.

  4. spherical
    Member
    Posted 13 years ago #

    Posted it to the forum connected to the plugin in Extend a week ago. No response so far. Juat updated with the suggestion.

  5. torre
    Member
    Posted 13 years ago #

    you can build a plugin with a widget with your text insinde an put this plugin into mu-plugins.

    <?php
    /*
    Plugin Name: text-Menu
    Plugin URI: [insert the plugin uri here]
    Description: Widget
    Author:
    Version: 0.1
    Author URI:
    */

    if (!class_exists('textmenu')) {
    class textmenu {

    function textmenu(){$this->__construct();}
    function __construct(){
    add_action("plugins_loaded",array(&$this,"register_widget_text_menu_textMenue"));
    }

    function register_widget_text_menu_textMenue($args) {
    register_sidebar_widget("textMenue",array(&$this,"widget_text_menu_textMenue"));
    register_widget_control("textMenue",array(&$this,"widget_text_menu_textMenue_control"),500,400);
    }

    function widget_text_menu_textMenue($args) {
    extract($args);
    ?>
    <?php echo $before_widget; ?>
    <?php echo $before_title . $after_title; ?>

    [YOUR CONTENT]
    <?php echo $after_widget; ?>
    <?php
    }

    function widget_text_menu_textMenue_control() {
    if ( $_POST["textMenue-submit"] ) {
    }
    ?>
    <input type="hidden" id="textMenue-submit" name="textMenue-submit" value="1" />
    <?php
    }

    }
    }

    //instantiate the class
    if (class_exists('textmenu')) {
    $textmenu = new textmenu();
    }

    ?>

  6. redsoxmaniac
    Member
    Posted 13 years ago #

    Thanks! I am going to try this out.

    Does this take html as well?

  7. cafespain
    Member
    Posted 13 years ago #

    If you want it to be easily update-able without the need to edit the code, then change the:
    [YOUR CONTENT]

    to something like:
    <?php echo get_site_option('my_global_widget_text'); ?>

    Then you can put what you want to display in that line in the sitemeta table.
    Maybe create yourself a little site admin plugin with a textarea that accepts some input and does a:

    update_site_option('my_global_widget_text', $_POST['myinput']);

    when it's posted.

  8. redsoxmaniac
    Member
    Posted 13 years ago #

    I tried this out and I didn't get to have this work.

    to something like:
    <?php echo get_site_option('my_global_widget_text'); ?>

    Then you can put what you want to display in that line in the sitemeta table.

    I don't know where this is other than maybe getting it from phpmyadmin. Is there a way to create this widget and be able to add to it in the admin interface like the other widgets. Maybe a sitewide widget bar in the admin area.

    I think I could make this happen, but if someone already knows a way or knows impediments that it can't be done, let me know. The reason for this is because there are others who will use our project and they are only good at using the widget/admin interface.

  9. cratercraver
    Member
    Posted 13 years ago #

    I am a WPMU user and I too would like to be able to maintain at least some level of sitewide cosmetic consistency by having a 2 or 3 "fixed" sitewide widgets across all blogs (e.g., I'd like to have the WP-Cumulus 3D tag cloud at the top of the right sidebar in every blog).

    It appears that torre is proposing a specific solution, but since I am new to WMPU and php coding, I'm wondering whether someone has the solution already.... (This thread is 6 months old.)

    Thanks in advance. I have seen the same question about declaring sitewide widgets come up several times in the past, on this and other sites, so it is clearly a feature that users are wanting.

  10. DeannaS
    Member
    Posted 13 years ago #

    Most people that want to control look/feel that tightly just do it at the theme level. You can hardcode a widget into each sidebar (outside the dynamic part) and let the users control the other parts of the sidebar.

  11. kaberi
    Member
    Posted 12 years ago #

    Can someone please point to the code for this ?

    For example how to hard code a plugin named " my plug in" in side bar ?

    Is it <?php include myplugin ? or what ?

    Seems there are so many threads but no solution.

About this Topic

  • Started 13 years ago by redsoxmaniac
  • Latest reply from kaberi