Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Quick'n' dirty fix to set correct select item on a subpage or page with no subpages. willy@apeland.no April 2012
- // Because it was much easier then setting a single class for pages and subpages in WordPress. :)
- // Is the selected page a sub page?
- var subClass = $('body').hasClass('page-parent');
- // Is the current page a page with no subpages?
- var pageArbeidsmetode = $('body').hasClass('page-id-12');
- var pageSelskapet = $('body').hasClass('page-id-14');
- // Set the correct active item if it's a main page or a page with no subpages
- if (subClass || pageArbeidsmetode || pageSelskapet) {
- $select
- .find(':eq(' + $(l_namespace_i + ' li')
- .index($(l_namespace_i + ' li.' + settings.active)) + ')')
- .attr('selected', true);
- }
- // If none of the above, it's a subpage and current_page_parent is the active class.
- else if (!subClass) {
- $select
- .find(':eq(' + $(l_namespace_i + ' li')
- .index($(l_namespace_i + ' li.' + settings.active2)) + ')')
- .attr('selected', true);
- }
Add Comment
Please, Sign In to add comment