WordPress.org

Forums

Flexible Posts Widget
Current nav item highlighted? (3 posts)

  1. gloriagoldrea
    Member
    Posted 1 year ago #

    Hi,

    I've got my current nav highlighted for all other pages (when I am on a page, that page's navigation is a different color) except for the pages that correspond to the widget. Is there a way to add this functionality? I can't figure out how to make it work.

    thank you!
    Gloria

    https://wordpress.org/plugins/flexible-posts-widget/

  2. gloriagoldrea
    Member
    Posted 1 year ago #

    Nevermind, I figured it out.

    If anybody needs to do this:

    Add this to your header:
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

    <script type="text/javascript">
    jQuery(document).ready(function($){

    // Get current url
    // Select an a element that has the matching href and apply a class of 'active'. Also prepend a - to the content of the link

    var url = window.location;

    $('a[href="'+url+'"]').parent('.dpe-flexible-posts li').addClass('highlight a');

    });
    </script>

    and then this to your css:
    .dpe-flexible-posts li.highlight a,
    .dpe-flexible-posts li.highlight a:visited {
    color:#339933 !important;
    }

  3. DaveE
    Member
    Plugin Author

    Posted 1 year ago #

    Hi gloriagoldrea,

    Thanks for posting this issue and a possible solution. I'm looking at what it would take to add that CSS class programmatically. I'll post back to this thread if a future release adds this capability.

    Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Flexible Posts Widget
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.