Skip to content

Instantly share code, notes, and snippets.

View DeveloperWil's full-sized avatar

Wil Brown DeveloperWil

View GitHub Profile
@DeveloperWil
DeveloperWil / code-snippet-1.php
Last active August 10, 2017 03:11
[WordPress] Code from our blog post Integrating JetPack Infinite Scroll with Genesis - https://zeropointdevelopment.com/integrating-jetpack-infinite-scroll-with-genesis/
/**
* Add support for JetPack infinite scroll
**/
function zpd_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' => 'content',
'footer' => 'footer',
'render' => 'genesis_do_loop'
) );
}
@DeveloperWil
DeveloperWil / JS PHP Redirect
Created August 26, 2014 16:37
JS PHP redirect function. Use when Headers have already been output to screen
function lc_js_redirect($url, $seconds=1){
echo "<script language=\"JavaScript\">\n";
echo "<!-- hide from old browser\n\n";
echo "function redirect() {\n";
echo "window.location = \"" . $url . "\";\n";
echo "}\n\n";
echo "timer = setTimeout('redirect()', '" . ($seconds*1000) . "');\n\n";
echo "-->\n";
echo "</script>\n";
return true;
@DeveloperWil
DeveloperWil / Gravity Forms Get Credit Card Details
Created August 27, 2014 05:59
Enables the credit card fields for Gravity Forms and provides a function to get the credit card details which are not available through the filter $form or $entry
//Turn on our credit card field for admin and front end
add_action("gform_enable_credit_card_field", "enable_creditcard");
function enable_creditcard($is_enabled){
return true;
}
//Email encoded card details when the form is submitted.
add_action('gform_after_submission', 'email_encoded_cc', 10, 2);
function email_encoded_cc($entry, $form) {
function get_creditcard_field($form){
$fields = GFCommon::get_fields_by_type($form, array("creditcard"));
@DeveloperWil
DeveloperWil / gravity-forms-complex-labels-above-fields.php
Created September 2, 2014 05:05
Place Gravity Forms complex labels above fields
/**
* register custom form scripts
* @param array $form
* @return array
*/
add_filter('gform_register_init_scripts', function($form) {
ob_start();
?>
jQuery(".ginput_container").has("input[type='email'],input[type='text'],input[type='password'],select,textarea").find("label").each(function() {
@DeveloperWil
DeveloperWil / equiheight-li
Created May 19, 2015 06:33
Equal height <li>
var $height = 0 ;
$("li.l").each(function(){
if(($(this).height())>$height){
$height = $(this).height();
}
});
$("li.l").each(function(){
$(this).css("height",$height)
});
@DeveloperWil
DeveloperWil / gf-input-to-button
Created June 23, 2015 07:27
Gravity Forms change < input type=submit > form elements to <button>
/**
* Change GF input type=submit to HTML 5 <button>
*
* @param $button
* @param $form
* @return mixed|string
*/
function lc_gf_form_submit_button ( $button, $form ){
$button = str_replace( "input", "button", $button );
$button = str_replace( "/", "", $button );
@DeveloperWil
DeveloperWil / im-attending-wcsyd-2016-transparent-bg-300x300
Created May 26, 2016 04:32
WCSyd I'm attending WordCamp Sydney 2016 PNG
<a href="https://2016.sydney.wordcamp.org" title="I'm attending WordCamp Sydney 2016" target="_blank"><img src="https://2016.sydney.wordcamp.org/files/2016/05/im-attending-wcsyd-2016-transparent-bg-300x300.png"></a>
@DeveloperWil
DeveloperWil / im-attending-wcsyd-2016-white-bg-300x300.txt
Created May 26, 2016 04:36
WCSyd I'm attending WordCamp Sydney 2016 JPG
<a href="https://2016.sydney.wordcamp.org" title="I'm attending WordCamp Sydney 2016" target="_blank"><img src="https://2016.sydney.wordcamp.org/files/2016/05/im-attending-wcsyd-2016-white-bg-300x300.jpg"></a>
@DeveloperWil
DeveloperWil / im-speaking-at-wcsyd-2016-transparent-bg-300x300.txt
Created May 26, 2016 04:39
WCSyd I'm speaking at WordCamp Sydney 2016 PNG
<a href="https://2016.sydney.wordcamp.org" title="I'm speaking at WordCamp Sydney 2016" target="_blank"><img src="https://2016.sydney.wordcamp.org/files/2016/05/im-speaking-at-wcsyd-2016-transparent-bg-300x300.png"></a>
@DeveloperWil
DeveloperWil / im-speaking-at-wcsyd-2016-white-bg-300x300.txt
Created May 26, 2016 04:40
WCSyd I'm speaking at WordCamp Sydney 2016 JPG
<a href="https://2016.sydney.wordcamp.org" title="I'm speaking at WordCamp Sydney 2016" target="_blank"><img src="https://2016.sydney.wordcamp.org/files/2016/05/im-speaking-at-wcsyd-2016-white-bg-300x300.jpg"></a>