Skip to content

Instantly share code, notes, and snippets.

View alanef's full-sized avatar

Alan Fuller alanef

View GitHub Profile
$url = "https://v3.openstates.org/jurisdictions';
$args = array(
'headers' => array (
'X-API-KEY' => 'your api key here'
),
);
$response = wp_remote_get( $url, $args );
$response_code = wp_remote_retrieve_response_code( $response );
if ( 200 != $response_code ) {
<?php
add_shortcode( 'my_filter', function ( $atts ) {
ob_start();
?>
<form method="get">
<select name="category_name">
<option value="name1">Name1</option>
<option value="name2">Name2</option>
</select>
<input type="submit" value="Filter">
/**
* Filter to modify the returned data from Display Eventbrite
* to take the day of the start date and apply it to teh end of teh last day of
* multi day events
*
* So the event appears as a single bookable entry in calendar layouts
*
*/
add_filter(
'wfea_api_results', // hook to filter returned event data before display
<head>
<style>
.vfx-slideshow {
position: relative;
}
.vfx-slideshow > div:not(:first-child) {
display:none;
}
.vfx-slideshow > div {
@alanef
alanef / slider.js
Last active October 11, 2021 18:54
// wfea_slide_count set externally
// wfea_slide_speed milliseconds set externally
(function ($) {
function specific_slide(num) {
while ( num != counter ) {
counter++;
if (counter > wfea_slide_count ) {
counter = 1;
}
<?php
// this should be in top template I think
enqueue_script('wfea-slideshow-script');
$speed=apply_filters('wfea_slideshow_speed', $speed);
$script_vars = 'var wfea_slider_speed = ' . $speed . ';' .
'var wfea_slider_count = ' . $data->atts['limit'] . ';';
wp_add_inline_script( 'wfea-slideshow-script', $script_vars, 'before' );
?>
<div class="wfea-slides" style="position: absolute;top: 0;left: 0;bottom: 0; right: 0;"> // style in CSS?
var isIE = window.document.documentMode ? true : false;
if ( isIE ) {
window.location.replace("https://my-site/new-page");
}
.help-tip {
position: absolute;
text-align: center;
background-color: #409EBB;
border-radius: 50%;
width: 15px;
height: 15px;
font-size: 12px;
line-height: 17px;
cursor: default;
$gravity_view_frontend = \GravityView_frontend::getInstance();
remove_filter('the_title', [$gravity_view_frontend, 'single_entry_title'], 1, 2);
@alanef
alanef / bitof.php
Last active January 8, 2022 14:22
/* code to check if logged in to a different WP site example.com */
$logged_in_cookie = 'wordpress_logged_in_' . md5( 'https://example.com' );
if ( ! isset($_COOKIE[ $logged_in_cookie ]) ) {
// display adverts
}