WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Text Widget
[resolved] Does not utilize theme stylesheet (15 posts)

  1. azazure
    Member
    Posted 3 years ago #

    This is a great plugin, but for some reason it does not use all of my theme's stylesheet settings when using php to insert a plugin element. For example, all of my links are set to be bold, but when using ATW they are not bolded - the active and hover colors look to be correct however. I couldn't figure out how to correct the problem or why it was happening. Thanks.

    http://wordpress.org/extend/plugins/advanced-text-widget/

  2. Max Chirkov
    Member
    Plugin Author

    Posted 3 years ago #

    @azazure - from your words I'm making an assumption that you're very new to CSS, and probably WordPress as well. This plugin doesn't limit nor eliminate any global styles that are being applied to the content within or/and around the ATW widgets. I would recommend to look into how to use web inspection tools that exist in Safari, Google Chrome, IE9 and Firefox (see Firebug) - inspect your web pages and see why your CSS doesn't apply the way you expect it to. Then fix the CSS.

  3. kilolima
    Member
    Posted 2 years ago #

    Hmm, I have the same problem. [edit]. widget not inheriting jquery styles.

    Nice plugin but alt text popup while editing a widget "You Must enclose php in <?" or something is really annoying.

  4. Max Chirkov
    Member
    Plugin Author

    Posted 2 years ago #

    @kilolima - I see you edited your original comment, but I still got it via email - I guess you realized you were wrong in the first place...

    I can eliminate the "annoyance" of the title tags of input fields in the backend in my future update.

    As for the stylesheet inheritance, the plugin itself doesn't remove nor carry any of its own styles whatsoever. I will take a few minutes of my time to investigate your issues if you post links to the live examples.

  5. azazure
    Member
    Posted 2 years ago #

    Kilolima,

    There are other plugins which accomplish the same thing, so enough said...

    Best of luck!

  6. Max Chirkov
    Member
    Plugin Author

    Posted 2 years ago #

    I'm sensing a misunderstanding here... all personal feelings aside, I am trying to get to the bottom of each issues for all my plugins. And again, if you can give me a live example where I can investigate the issues with element inspector and see what exactly is happening, I'll be happy to look into it.

    I tested this plugin on default 2010 and 2011 themes (beside my own custom themes) and haven't been able to reproduce the problem.

    On a side note - each ATW widget is wrapped into its own DIV layer, if you have css rules that somehow tread DIV layers differently from the rest of your code, then that might affect the appearance of the content within the ATW widget.

  7. bholman
    Member
    Posted 2 years ago #

    I seem to be having a similar problem. I've just replaced Daiko's Text Widget with ATW, copying the text over from each widget, and the styling has changed. Specifically, it did not underline URLs, which is how the theme styles it. If you look at my site you can see three ATW widgets in the sidebar. The top one is fine but it's just text. The other two are "Free e-books" and "From my library" (near the bottom). As you can see, they both have underlined links now. The other sidebar widgets are styled correctly as per the theme; no underlines. I haven't a chance to look at the CSS much to see what's going on, but I wonder why it would change from Daiko to ATW.

  8. Max Chirkov
    Member
    Plugin Author

    Posted 2 years ago #

    @bholman, thanks for posting a link to the live example. I made a video http://www.screenr.com/bzqs which explains the reasons why your theme has underlined links in some cases but not other one.

    I ran out of time trying to explain how the <div class="content">...</div> wrapper could've been added... basically, widgets have placeholders $before_widget, $after_widget - this placeholders are being utilized by themes to wrap widgets into their own tags. Some themes utilize

      tags to wrap widgets, others divs with specific classes. If a widget author doesn't include those placeholders (which is a good practice and official WP Codex teaches to include them), then the widget will not have those wrappers. In my case I did include them, and my widget does obey by the Theme's style rules.

      If you wish to avoid any bordering on the links, simply overwrite your existing rule with:

      body .content a:link, body .content a:hover, body .content a:visited {
          border: none;
      }

      add that at the bottom of your theme's stylesheet and I think it should be sufficient. If not, then you'll have to use the element inspector to nail down all the rules that affect those links.

      Anyway, I just hope this gives other users an idea on how they can fix this type of issues.

      P.S. if you open up the main PHP file of the plugin and simply search for class or even word "content" within the code - you won't find it. So, again, the class is not being added by the widget itself.

  9. bholman
    Member
    Posted 2 years ago #

    Thanks for going to all that trouble! I don't want border:none to apply to posts and pages, just to the sidebar and footer (in conformity with the other widgets) so I just did it for ATW itself:

    body .AdvancedText a:link, body .AdvancedText a:hover, body .AdvancedText a:visited {
            border: none;
    }

    The output looks okay so I'm happy with that.

    I'm still a bit confused about why other widgets behave differently (including most of the widgets which come with WordPress, though not the Text widget it seems). Daiko's Text Widget has $before_widget and $after_widget like ATW does, but the styling is not the same. But given that it all works now I don't care too much :)

    Thanks again for your help.

  10. Max Chirkov
    Member
    Plugin Author

    Posted 2 years ago #

    @bholman - I missed the fact that the class .content also appears in your posts.

    Can you do me a favor and try commenting out one line in my plugin?
    advancedtext.php line #74 - it's a filter. I have a feeling that something in the theme or other plugins using that filter to wrap the content of the widget into the div with the class .content. It's the same filter that affects the native text widget...

    Just change line 74 from:

    $text = apply_filters( 'widget_text', $instance['text'], $instance );

    to

    //    $text = apply_filters( 'widget_text', $instance['text'], $instance );

    You can see the function responsible for the widget output here starting on line 63 http://plugins.trac.wordpress.org/browser/advanced-text-widget/trunk/advancedtext.php#L62 - as you can see, the lines with "echo" function don't contain any additional wrappers.

  11. bholman
    Member
    Posted 2 years ago #

    OK, I just tried that but it broke ATW! Only the widget title is rendered; the actual text disappears. But so has the "content" class:

    <div id="advanced_text-3" class="widget advanced_text"><div class="AdvancedText"><h3>Free e-books</h3></div></div>

    So I've changed it back.

  12. Max Chirkov
    Member
    Plugin Author

    Posted 2 years ago #

    @bholman - uhh, of course! I didn't pay enough attention to that line - $instance['text'] was supposed to be assigned to the variable $text and we simply removed that... I only meant to remove the filter.

    If you do the stuff above, then add a new line below:

    $text = $instance['text'];

    The content of the widget will appear, but the wrapper with the .content class won't be there.

  13. bholman
    Member
    Posted 2 years ago #

    Yes! That works. I've removed my CSS entries and it still looks good. Thanks!

  14. Max Chirkov
    Member
    Plugin Author

    Posted 2 years ago #

    Great! Thanks @bholman for helping to test this. I'll make sure to rename the filter in the next update, so it doesn't use the default text widget's filter.

  15. Max Chirkov
    Member
    Plugin Author

    Posted 2 years ago #

    For everyone who experiencing styles issues, you can download the development version of this plugin http://downloads.wordpress.org/plugin/advanced-text-widget.zip (should be version 2.0.3).

    The reason why in some cases the content of the widget is/was differently formatted because it was using "default text widget's" filtering mechanism. Which means if some plugin applied a filter to content within the default text widget (specific formatting or styling etc), the same effect was applied to the advanced text widget as well, since it was using the same filter. The logic behind this was - to have advanced text widget behave as the default text widget does. Since in some cases this behavior is "unwanted", I simply changed the name of the filter form "widget_text" to "atw_widget_content". So, if anyone wants to filter the content of this widget, please use the correct filter name.

    I'm marking this issue as resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic