Adding Lawmaker/Legislation Widgets

As part of our state legislative coverage, we’ve partnered with the Sunlight Foundation to make it easy for our reporters to include information about lawmakers and bills in their WordPress posts and pages. We’ve created a tool that automatically pulls in data points from the foundation’s Open State Project and places them inside widgets.

Inside posts or topics pages, two new buttons now appear in the editing ribbon inside the visual editor. The left button will help you add information about lawmakers. The right button you’ll use to create widgets about specific legislation:

First, let’s create a lawmaker widget for Idaho Senate President Pro-Tem Brent Hill. In your post or topic page, hit “return” to create a new line in the place where you want your module to go.

Click the lawmaker button, and a modal window opens. You can use it to select your state, enter a first or last name or other information to filter the lawmakers lists, and then click search. This search narrowed the results to our selected lawmaker: Sen. Hill.

Next, choose whether to embed the widget on the right or left side of your topic page. Remember to insert the widget in a place that won’t bump up against images or data tables or other non-text content:

I’ve inserted the widget on the right side. Notice the short code that’s now in my page. It pulls in Hill’s lawmaker ID and aligns his widget to the right. It’s important to make sure you include a line break after the short code, just like any other paragraph, like this: 

Save, and you’re done. This information will update automatically if, for example, Hill were to change committees or his contact information. The “more” link will open a new window to Hill’s official page on the state’s website:

Next, let’s add information about a specific bill into a post. Select the bill button, and a similar modal window opens. Use it to filter out specific bills by state and topic. When you find your bill, select insert left or right and close the modal:

You’ll see a short code that lists the bill number, legislative session year and alignment. Again, make sure the code gets a line break like any other paragraph. 

Save your post, and you get this fancy widget. A note: The bill number, caption and latest action are reported exactly as the state releases them. Sometimes there will be anomalies that are out of our control. If you notice something strange, let us know, and we’ll let the Sunlight team know — but don’t post a widget with missing or oddly formatted data. In most cases, though, this is what you’ll see:

Let us know if you have suggestions to improve this feature. Enjoy…

Comments are closed.