Widget Logic
[resolved] Modify text in a text widget? (3 posts)

  1. chrisHe
    Posted 3 years ago #

    Hi, can Widget Logic be used to modify the text (a shortcode with options) in a WP Text Widget?

    Basically I want a text widget to contain [calendar category="1,2,3"] if user is admin, and [calendar category="1"] if user is NOT admin

    I guess I could set up TWO text widgets and use is_admin() in one text widget and !is_admin() in the other, but would be nice to do it in one go!


  2. alanft
    Plugin Author

    Posted 3 years ago #

    your latter option is going to be WAY less prone to breaking in revisions of code and just easier to setup.

    WL *could* do what you say - the 'widget_content' filter is there to do things like this, take the content of a widget and change it, but I'm not even sure if it steps in before shortcodes are then expanded. I'm going to actually have a look into this anyway as you've brought the possibility up!

  3. chrisHe
    Posted 2 years ago #

    Thanks, done as you suggest with two widgets!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic