WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Widget Logic] Randomize Widgets

[Plugin: Widget Logic] Randomize Widgets

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author alanft
    Member

    @alanft

    Using widget logic for that wouldn’t ‘scale’ very well, and would probably prove fiddly to get the effect you are after. I am sure there are ‘ad rotator’ plugins/widgets out there you might find more productive.

    johndjs
    Member

    @johndjs

    Believe me I tried but what I really need is somehow to Randomize my widgets in any chosen widget area, or simply loop each widget one by one of course.

    Plugin Author alanft
    Member

    @alanft

    it depends on the exact effect you are after. If you want 1 of N widgets to appear, you could do this

    widget 1 (the first one defined):
    global $widget_rnd; $widget_rnd=rand(5, 15); return (1==$widget_rnd);

    widget 2
    global $widget_rnd; return (2==$widget_rnd);

    and so on. (nb, i’ve not tried this out.)

    johndjs
    Member

    @johndjs

    No, both widgets just dont appear anywhere now?

    Thanks for trying to help

    Plugin Author alanft
    Member

    @alanft

    ugh copy/paste error

    rand (1,2)

    this bit generates a random integer between the 2 values. so use (1,n) depending on the number of widgets involved.

    I still think there must be an ad rotator out there to suit you – it’s basic stuff for a blog.

    johndjs
    Member

    @johndjs

    Im sorry but can you post the exact code for 3 Widgets ?

    Thank you

    mbzo2006
    Participant

    @mbzo2006

    Sounds interesting idea.

    Would it be possible to use this technique to alternate between two different sidebar widgets?

    For example, two text widgets, A and B:

    show widget A (hide widget B)

    else

    Show Widget B (hide A)

    Can Widget-Logic already do this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Widget Logic] Randomize Widgets’ is closed to new replies.