Tagged: ,

Viewing 1 reply thread
  • Author
    Posts
    • #1410
      Marcus
      Member

      I love using piklist widgets, they make the process of updating little requests by clients such a breeze. (they can change colors, text, its surrounding css, all by dropping in a widget)

      In fact, here’s a screen shot of one of my widget areas:
      Widget Active Titles

      You’ll notice that the piklist widgets all have a nice little feature.
      They display the active title below them, and that title changes when you change the active widget in the drop down.

      To achieve this, this is all you need to do:
      In your functions.php file add this:

      
      add_action('admin_init', 'mae_piklist_widgets_titles');
      function mae_piklist_widgets_titles() {
      	global $pagenow;
      	if ($pagenow=='widgets.php') {
      	    wp_enqueue_script('piklist_widgets_titles', get_template_directory_uri() . '/js/admin-piklist-widgets-titles.js', array(), '1.0.0', true );
      	}
      }
      

      The javascript file this references is here on Gist:
      https://gist.github.com/marcuseby/9017929

      Finally add the following to your admin css file:

      
      .widget .widget-title .widget-piklist-active-title {
          clear: both;
          position: relative;
          display: block;
          padding: 0px 0px 10px 15px;
          font-size: 80%;
          margin-top: -15px;
          font-weight: normal;
      }
      

      Whats nice was this was much easier than all the code needed to do it through hooks instead of js.

      Marcus

    • #1421
      Kevin
      Keymaster

      There you go writing piklist features again, thank you sir. I will review and get back to you on getting this into core, since you got to it before I did 😉

      Thanks,

      Kevin

      PS You might want to check out the piklist_assets filter, it has a few upgrades 🙂

Viewing 1 reply thread
  • You must be logged in to reply to this topic.