WordPress.org

Ready to get started?Download WordPress

Forums

Query Wrangler
[resolved] current class (3 posts)

  1. bart_behiels@yahoo.com
    Member
    Posted 2 years ago #

    hi (excuse my english),

    I like the plugin very much. But I would like it even more if it would be possible to apply a current class to the query widget. I'm using the query widget in my sidebar with only 'post title fields'. It would be very interesting if it would behave more like a menubar.

    Can anyone help me out?

    http://wordpress.org/extend/plugins/query-wrangler/

  2. Jonathan Daggerhart
    Member
    Plugin Author

    Posted 2 years ago #

    Hmm... Off the top of my head, I can think of an easy way to do it with jQuery.

    jQuery(document).ready(function(){
      jQuery('.query-[query_slug]-wrapper a.query-field-link').each(function(i,element){
        if (jQuery(element).attr('href') == window.location.href){
          jQuery(element).addClass('my_custom_class');
        }
      });
    });

    This should be very close to what you would need to do that. You would need to change [query_slug] and 'my_custom_class' to the correct values for your site.

    This should be simple enough for QW to do, so I will add a class to a link if it is the 'current page being viewed' in the next major release (1.6).

    Hope this helps.

  3. bart_behiels@yahoo.com
    Member
    Posted 2 years ago #

    thanks, I'll try this one.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic