CongressLookup

Description

CongressLookup is a free WordPress plugin giving your site visitor an easy way to find United States US senators and representatives. CongressLookup makes it easier to launch a grassroots campaign for your favorite cause and will keep your visitors on your site instead of sending them elsewhere to find their Congressional legislators.

Where The Data Comes From
CongressLookup uses data provided by Google Maps GeoCoding API and Google Civics API.

Google Maps GeoCoding API
By using this plugin you are bound by the Google Maps terms of use. Google GeoCoding API limits use to 2,500 requests per IP address per day. We have added a cache feature (default setting is 30 minutes) you can set to reduce the number of requests made to the API. To obtain a Google Maps API key there is a link in: WP Admin > Settings > CongressLookup > Configuration, or do the following:

1. Go to the Google API Console.
2. Create or select a project.
3. Click Continue to enable the API and any related services.
4. On the Credentials page, get an API key.

Google Civic Information API
To display the contact information for each Congress person we now use the Google Civic Information API which requires a separate API key. To receive one:
1. Using your Google account, login to the Google API Console. Here you create a project if you don’t already have one.
2. Click “Create credentials”.
3. Choose “API Keys” (do not restrict). Copy and save this key to use in the CongressLookup settings.
Now you have to enable the Civic API:
4. Click the “Library” side menu tab.
5. In the search field enter “Civic”.
6. Click on the “Google Civic Information API” link.
7. Then click the word “Enable”.
8. On your website, go to: Settings > CongressLookup > Configuration. Paste the Civic API key in the Google Civic API Key field.
9. Save CongressLookup settings.

PLEASE NOTE: YOU CAN NOT USE THE SAME API KEY FOR GOOGLE MAPS AND GOOGLE CIVICS.

The following information can be displayed for each legislator. You can turn any of these on/off in the Admin settings: Title, Picture, Office, Phone, Zip code, Party, State Name, Contact Form, Email, Website, Facebook, Youtube, Twitter, and Google Plus. NOTE: If one or more of these are not available for an individual Congress person, the information will not show in the results on the page, even if you have the box checked.

Using CongressLookup Plugin
The minimum information needed to get results is (1) a State name and (2) a 5-digit zip code. However, some zip codes cover more than one congressional district so the more of the address is entered the more accurate the results will be.

CongressLookup is implemented on your WordPress site with use of a shortcode. See the Installation and FAQs for more information.

Customizing The Look of the Plugin
There are three theme options available: No Theme, Modern and Custom Theme.

  • No Theme: Uses the core styling from your theme without adding any of it’s own.
  • Custom Theme: Allow you to create your own look using CSS and comes with a demo area to preview your changes.
  • Modern Theme:

Support
If you have any problems, please see our Trouble Shooting Guide before putting in a support request.

Please use the CongressLookup plugin support tab here on the WordPress.org website. Keeping support questions and answers public helps everyone. However, feel free to contact us here for any other help you may need.

Official Website
http://congresslookup.com

Troubleshooting

If CongressLookup is not working properly, please try the following steps:

1. Make sure you are using the most recent version of the plugin.

2. Make sure your server is running at least PHP 5.4.

3. When creating your Google Maps API, set Key Restrictions to “None”.

4. PLUGIN CONFLICT: Please try deactivating all plugins except CongressLookup. If CongressLookup does then work, turn on one plugin at a time and test it again until you find the plugin it conflicts with. Please let us know what plugin this is.

5. THEME CONFLICT: If there is still an issue after testing for a plugin conflict, and all other plugins are turned off, please try temporarily switching to another theme. We recommend trying one of the default WordPress themes.

6. SERVER SETTINGS: If none of the above has helped, please tell your webmaster to enable allow-url-fopen in php.ini
http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
When doing this, disable the cache option for testing, then when allow-url-fopen is enabled and CongressLookup works only then enable the cache again.

7. If you are still having any issues, please put in a support request.

Screenshots

  • CongressLookup frontend with Modern theme screenshot-1.jpg
  • WP Admin > Settings > CongressLookup > Configuration screenshot-2.jpg
  • WP Admin > Settings > CongressLookup > Custom Shortcode screenshot-3.jpg
  • WP Admin > Settings > CongressLookup > Custom Shortcode > Add Shortcode screenshot-4.jpg

Installation

  1. Unzip CongressLookup.zip and Upload folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Or in your Plugin page “Add Plugin” search: enter “CongressLookup” then install and activate.
  4. Obtain a Google Maps API
    • Go to the Google API Console.
    • Create or select a project.
    • Click Continue to enable the API and any related services.
    • On the Credentials page, get an API key.
  5. Enter Google Maps API key and configure in: WP Admin > Settings > CongressLookup
  6. To display the contact information for each Congress person we now use the Google Civic Information API which requires a separate API key. To receive one:
    • Using your Google account, login to the Google API Console. Here you create a project if you don’t already have one.
    • Click “Create credentials”.
    • Choose “API Keys” (do not restrict). Copy and save this key to use in the CongressLookup settings.
      Now you have to enable the Civic API:
    • Click the “Library” side menu tab.
    • In the search field enter “Civic”.
    • Click on the “Google Civic Information API” link.
    • Then click the word “Enable”.
    • On your website, go to: Settings > CongressLookup > Configuration. Paste the Civic API key in the Google Civic API Key field.
    • Save CongressLookup settings.

PLEASE NOTE: YOU CAN NOT USE THE SAME API KEY FOR GOOGLE MAPS AND GOOGLE CIVICS.

  1. Use the following shortcodes in a page, post, widget, or/and sidebars:
    Search for Senators and Representatives: [CongressLookup]
    Search for Senators only: [CongressLookup show="senator"]
    Search for Representatives only: [CongressLookup show="representative"]
  2. You can use the following codes in your template, placed outside the loop:

  3. You can create shortcodes with different configurations by going to: WP Admin > Settings > CongressLookup > Custom Shortcode.
  4. If you have any problems, please see our Trouble Shooting Guide before putting in a support request.

FAQ

Installation Instructions
  1. Unzip CongressLookup.zip and Upload folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Or in your Plugin page “Add Plugin” search: enter “CongressLookup” then install and activate.
  4. Obtain a Google Maps API
    • Go to the Google API Console.
    • Create or select a project.
    • Click Continue to enable the API and any related services.
    • On the Credentials page, get an API key.
  5. Enter Google Maps API key and configure in: WP Admin > Settings > CongressLookup
  6. To display the contact information for each Congress person we now use the Google Civic Information API which requires a separate API key. To receive one:
    • Using your Google account, login to the Google API Console. Here you create a project if you don’t already have one.
    • Click “Create credentials”.
    • Choose “API Keys” (do not restrict). Copy and save this key to use in the CongressLookup settings.
      Now you have to enable the Civic API:
    • Click the “Library” side menu tab.
    • In the search field enter “Civic”.
    • Click on the “Google Civic Information API” link.
    • Then click the word “Enable”.
    • On your website, go to: Settings > CongressLookup > Configuration. Paste the Civic API key in the Google Civic API Key field.
    • Save CongressLookup settings.

PLEASE NOTE: YOU CAN NOT USE THE SAME API KEY FOR GOOGLE MAPS AND GOOGLE CIVICS.

  1. Use the following shortcodes in a page, post, widget, or/and sidebars:
    Search for Senators and Representatives: [CongressLookup]
    Search for Senators only: [CongressLookup show="senator"]
    Search for Representatives only: [CongressLookup show="representative"]
  2. You can use the following codes in your template, placed outside the loop:

  3. You can create shortcodes with different configurations by going to: WP Admin > Settings > CongressLookup > Custom Shortcode.
  4. If you have any problems, please see our Trouble Shooting Guide before putting in a support request.
Where does the legislator information comes from

CongressLookup uses data provided by both Google GeoCoding API and the Google Civics API.

What are Google Maps API Terms of Use?

By using this plugin you are bound by both the Google Maps terms of use and the Google GeoCoding API terms of use. The information presented here and on our website is for informational purposes only and is not intended to be legal advise.

Why use Google Maps GeoCoding API?

Google GeoCoding API is used to obtain the longitude and latitude of a particular address. This is the most accurate way to determine within which legislative districts an address is located.

How accurate is Google GeoCoding data?

GeoCoding is not 100% accurate. Sometimes an entered address will not return the correct location. For this reason, we have included a Google Map the visitor can use to verify the location is correct.

What if the map location is different from the address entered?

The plugin’s Google map has a movable pointer you can click and drag to more accurately target the desired location. The address in the input window (and the corresponding legislators) will automatically recalculate each time the red marker is repositioned.

How do I tell Google their information is wrong?

You can tell Google of any inaccuracies by clicking the link in the lower right corner of the map: “Report a map error”.

Are there limits on how many addresses can be looked up with CongressLookup plugin?

We, the developers, created CongressLookup plugin to be free and do not limit how much you can use it, however, both Google GeoCoding and Google Civics have restrictions and/or limits imposed when using the APIs. Please consult their websites for more information on the legal use of their APIs.

How does the CongressLookup Admin cache setting help with the Google GeoCoding limit?

We have added a cache feature you can set to reduce the number of requests made to the API. The default setting will clear the cache every 30 minutes. If you anticipate 2,500 requests per day will not be enough for your site, even with the caching, please contact us about a custom solution.

What is the Google Civic Information API used for?

CongressLookup uses free information provided by Google Civic API. For any U.S. residential address, you can look up who represents that address at each elected level of government. We make use of their legislator information and legislator photos databases in CongressLookup plugin.

Where is the CongressLookup settings page located?

WP Admin > Settings > CongressLookup

What legislator information can be displayed?

The following information can be displayed for each legislator. You can turn any of these on/off in the Admin checkbox settings. Note: Even if you turn them on, if one of more of this information is not available for a particular member of Congress, the information will not display in their results:

  • Title
  • Picture
  • Office
  • Phone
  • Zip code
  • Party
  • State Name
  • Contact Form
  • Email
  • Website
  • Facebook
  • Youtube
  • Twitter
  • Google Plus
How much information must be entered in the address field to get results?

Minimum information needed is (1) the state and (2) a 5-digit zip code. However, some zip codes cover more than one congressional district so the more of the address is entered, the more accurate the results will be.

Can I change the look of the plugin?

There are three themes to choose from:

  • Modern Theme: By default.
  • No Theme: Uses the core styling from your theme without adding any of it’s own.
  • Custom Theme: Allows you to create your own look using CSS and comes with a demo area to preview your changes.
How do I use CongressLookup on my site?

Use the following shortcode in a page, post, widget, or/and sidebar:

[CongressLookup]
[CongressLookup show=’senator’]
[CongressLookup show=’representative’]

Use the following code in your template, outside of the loop:

<?php echo do_shortcode(“[CongressLookup]”); ?>
<?php echo do_shortcode(“[CongressLookup show=’senator’]”); ?>
<?php echo do_shortcode(“[CongressLookup show=’representative’]”); ?>

You can custom configure shortcodes by going to: WP Admin > Settings > CongressLookup > Custom Shortcode.

Do you have “hooks” to modify the output?

Yes. As of version 2.1.8 we have added the following hooks:

  • “congress_results” filter to modify array returned by api
  • “congress_field” filter to modify field title
  • “congress_value” filter to modify field value
  • “congress_output” filter to modify output per field

CONGRESSLOOKUP HOOK FILTERS EXAMPLES

add_filter( 'congress_results', 'congress_results_callback', 10 );
function congress_results_callback( $results ){
  //$out = '<pre>' . print_r($results, 1) . '</pre>';

  $out .= '<p>add_filter( "congress_results" ) example:</p>';
  $out .= '<table>';
  $out .= '<tr>
        <td>Name</td>
        <td>Picture</td>
        <td>Facebook</td>
      </tr>';
  foreach($results as $i => $arr){
    $out .= '<tr>
          <td>' . esc_html($arr['full_name']) . '</td>
          <td>' . '<img src="' . $arr['pic'] . '">' . '</td>
          <td>' . '<a href="https://www.facebook.com/' . $arr['facebook_id'] . '">' . $arr['facebook_id'] . '</a>' . '</td>
        </tr>';
    }
  $out .= '</table>';

  return $out;
}

//add_filter( 'congress_field', 'congress_field_callback', 10, 2 );
function congress_field_callback($field_title, $key){
  if( $key == 'facebook_id'){
    return 'FB';
  }else{
    return $field_title;
  }
}

//add_filter( 'congress_value', 'congress_value_callback', 10, 3 );
function congress_value_callback($field_value, $key, $value){
  if( $key == 'office'){
    return $field_value . ' <a href="#">(MAP)</a>';
  }else{
    return $field_value;
  }
}

//add_filter( 'congress_output', 'congress_output_callback', 10, 6 );
function congress_output_callback($li, $key, $value, $field_title, $field_value, $result){
  return "<li>{$field_title} => {$field_value}</li>";
}
How do I contact support?

Please use the CongressLookup plugin Support Tab above. Keeping support questions and answers public helps everyone. But feel free to contact us here for any other help you may need.

Official Website
http://congresslookup.com

Reviews

Initial Issues, but Support Went Above and Beyond

For a free plugin, the Support staff went way above and beyond to assist in getting the program to work on my site. I had some difficulty getting the plugin to work that really did not have anything to do with the plugin structure. It will be a great addition to my website.

Read all 4 reviews

Contributors & Developers

“CongressLookup” is open source software. The following people have contributed to this plugin.

Contributors

Translate “CongressLookup” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

3.0

  • Updated 30 September 2017
  • Removed Sunlight Labs Congress 3.0 API
  • Added Google Civic Information API
  • Added placeholder setting for frontend address input field
  • Fixed bug in default address for frontend address input field

2.1.8

  • Added “congress_results” filter to modify array returned by api
  • Added “congress_field” filter to modify field title
  • Added “congress_value” filter to modify field value
  • Added “congress_output” filter to modify output per field

2.1.7

  • Add CSS to wrap long URLs
  • Add custom javascript call (if the function exist) everytime api called

2.1.6

  • Fix undefined variables
  • Fix shortcode bug when displaying senator or representative only

2.1.5

  • Add shortcode creation area
  • Modify admin interface
  • Update get photos function
  • Update internal cache API call using wp transient api
  • Update API call to get congress members
  • Fix bugs 404 when calling API
  • Add “What to display” options at shortcode level

2.1.4

  • Enable multiple map call
  • Merge geocode.js into main plugin file
  • Add option to input Google Map API Key
  • Update picture files
  • Update do_shortcode usage at readme.txt file

2.1.3

  • Update 28 November 2016
    Sunlight Labs database and API is now run by Propublica.org They are not requiring an API key but CongressLookup still expects one so enter any character string in the API Key field to make it work.

2.1.2

  • Update 20 April 2016
    Fixed “window.onload” function conflict that occurred with another plugin.

2.1.1

  • Update 21 February 2015
  1. Fixed an “Undefined property” error.

2.1

  • Update 01 June 2014
  1. Added two new shortcodes for displaying (1) US Senators only, and (2) US Representatives only.

2.0

  • Update 15 May 2014
  1. Replaced the use of deprecated Sunlight Labs Congress API with more comprehensive Sunlight Congress API.
  2. Added more congressperson stats, now available from new API, with checkboxes in admin.
  3. Added ability for admin to choose to display only Senators, only Representatives, or both (default) from a dropdown menu in admin.
  4. Minor CSS changes

1.0

  • Original version, 23 August 2012