• I am going to have many instances of many widgets, but the menu on the editor only shows the widget name (many of the same), not the instance. I think it would be very helpful to show on the menu both the widget name and the widget instance title, in the same way the Appearance > Widgets page does. I think it would also be useful to insert that automatically into the shortcode as a parameter, even if you ignore it in the plugin code, so that when reading the text later you can see at a glance which instance the shortcode refers to (the number is pretty meaningless, as it’s not displayed in the Appearance > Widgets page, so it’s hard to see which widget instance a shortcode refers to, except by searching each one manually for the corresponding widget)

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter frankieandshadow

    (@frankieandshadow)

    I will see if I can offer some code to do this. (Is the source on github?)

    Thread Starter frankieandshadow

    (@frankieandshadow)

    Hmm… I see the code is supposed to do that. But it isn’t working for my custom widget, possibly for the same reason as the bug I previously reported (getting the wrong id from the preg_match).

    Thread Starter frankieandshadow

    (@frankieandshadow)

    Yes, indeed it is a similar bug. There is a second preg_match with exactly the same problem if the widget name has a number in it, in get_widget_options at line 129, needs to be
    preg_match('/-(\d+)$/', $widget_id, $number)
    and then use $number[1], not $number[0].

    Thread Starter frankieandshadow

    (@frankieandshadow)

    The other part of my original comment was to describe the instance in the shortcode. I think you can achieve this very easily at line 17 of tinymce.js thus:
    editor.insertContent( '[widget id="' + v.id + '" description="' + v.title + '"]' );

    Thread Starter frankieandshadow

    (@frankieandshadow)

    (that does rather depend on the instance title not having a double quote in it)

    Thread Starter frankieandshadow

    (@frankieandshadow)

    > (Is the source on github?)

    OK, I see it is in WordPress SVN. I have a fix ready to check in.

    Plugin Author shazdeh

    (@shazdeh)

    I see the issue, although I’m not much fond of the idea of adding text which is not used later on, and it might cause confusion as well (questions like “does this text replaces my widget title?”).

    I think maybe better solution would be to add a TinyMCE View and display the widget title there. Will see how it works out.

    Thank you for your suggestions.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Numerous instances’ is closed to new replies.