Skip to content

Instantly share code, notes, and snippets.

View JRyven's full-sized avatar

James Ryven Valeii JRyven

View GitHub Profile
@JRyven
JRyven / site__function__browser_compat_check.php
Last active August 15, 2020 10:22
Browser compatibility check ... disable feature on specific browsers.
<?php
function detect_browser() {
$arr_browsers = ["Opera", "Edge", "Chrome", "Safari", "Firefox", "MSIE", "Trident"];
$agent = $_SERVER['HTTP_USER_AGENT'];
$user_browser = '';
foreach ($arr_browsers as $browser) {
if (strpos($agent, $browser) !== false) {
$user_browser = $browser;
break;
@JRyven
JRyven / style.css
Last active April 6, 2021 14:29
Styled Selector with just CSS
// CSS
div.select {
position: relative;
display: block;
width: 100%;
margin-bottom: 1rem;
border: 1px solid lightgrey;
border-radius: 10px;
}
<?php
//BUILD LOGIN
function bpm_custom_login_shortcode( $atts, $content = null ) {
if( ! is_user_logged_in() ) :
$a = shortcode_atts( array(
'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
@JRyven
JRyven / vimeo__shortcode.php
Created August 26, 2019 09:42
WordPress Vimeo Shortcode
<?php
//
//
//
//
//
//
global $vimeo_ids;
@JRyven
JRyven / loop__wordpress__posts.php
Last active October 20, 2020 17:43
Standard WordPress Custom Loop
<section class="page-loop easybib-guides-loop">
<div class="container">
<?php
// WP_Query arguments
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'paged' => $paged,
'posts_per_page' => 10,
'post_type' => array( 'post' ),
@JRyven
JRyven / twilio__text___functions.php
Last active October 26, 2021 08:42
Trigger Twilio MMS when MMS is Received
<?php
/**
* Send Information to Twilio, Require SKD https://www.twilio.com/docs/libraries/php
*
*
*/
require __DIR__ . '/twilio/Twilio/autoload.php';
use Twilio\Rest\Client;
@JRyven
JRyven / twilio__text___functions.php
Last active October 26, 2021 08:42
Trigger Twilio Text Message as a result of form submission
<?php
/**
* Send Information to Twilio, Require SKD https://www.twilio.com/docs/libraries/php
*
*
*/
require __DIR__ . '/twilio/Twilio/autoload.php';
use Twilio\Rest\Client;
@JRyven
JRyven / paypal___shortcodes.php
Last active June 26, 2019 09:31
Use a nicer button to place PayPal donation buttons on your site.
<?php
/* *
* Simple PayPal Button Shortcode
* @Jryven boilingpotmeida.com
*
* Use:
* Get a PayPal provided donation button.
* Find the line: <input type="hidden" name="hosted_button_id" value="**************">
* Enter the code within the value parameter into the shortcode via the id parameter
* Enter the text for the button into the shortcode via the text parameter
@JRyven
JRyven / jQuery___resizing___functions.php
Last active September 28, 2020 09:56
jQuery Examples for Resizing
<script>
jQuery(document).ready(function($) {
// Set all Elms to Height of Tallest
function setEqualHeight(e) {
var t = 0;
e.each(function(){
currentHeight = $(this).height();
if (currentHeight > t) {
t = currentHeight
}
@JRyven
JRyven / woocommerce___checkout___functions.php
Last active June 26, 2019 09:28
Adding a custom question to WooCommerce Checkout, Saving the answer to the Database, Retrieving the Answer on order Completion
<?php
// WooCommerce Add Custom Checkout Fields
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
// append to the billing questions
// we output a 'header' with CSS:before
$fields['billing']['custom_question_slug'] = array(
'type' => 'text',