Skip to content

Instantly share code, notes, and snippets.

<?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 / 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;
}
@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;
<?php
function populate_csv( $entry, $form ) {
/* remove some questions from the output via label filtering */
$exclusions = array(
'Field Name One',
'Field Name Two',
'Field Name Three',
);
@JRyven
JRyven / site__function__jquery_set_unavailable_available_and_weekly_date_options.js
Last active August 15, 2020 11:16
jQuery Datepicker set Unavailable, Available, Weekly date options
<script>
// set unavailable dates
var unavailableDates = ['26-11-2020','24-12-2020','25-12-2020'];
var availableDates = ['9-9-2020','25-11-2020'];
// check unavailable dates and verify if the weekday is approved
function unavailable(date) {
// beforeShowDay, get date
@JRyven
JRyven / oop-html-builder.php
Last active September 30, 2020 08:33
OOP PHP HTML Builder
<?php
/* https://stackoverflow.com/questions/3488373/php-class-to-generate-html#answer-62349439 */
/**
* HTML - Simplest html element builder
* - @param1 Element name
* - @param2 Class name
* - @param3 ID
* - @param2 Element content
*/
class HTML{
@JRyven
JRyven / site__content__popup.php
Last active February 25, 2021 15:10
Simple, cookied popup
<?php
/*
*
*
*
*
*/
class Popup__Elm {
@JRyven
JRyven / functions.php
Last active February 25, 2021 15:16
Generate 301 Redirects for and remove Taxonomy Terms
<?php
function redirect_builder(){
// CLEAN UP TAGS
// GATHER TAGS
$product_tag = 'product_tag';
$tags = get_terms( array(
'taxonomy' => $product_tag,
@JRyven
JRyven / functions.php
Created April 20, 2021 09:12
WordPress Shortcode Template OOP with Style and Scrip
<?php
/*
*
*
*
*
*/
class Name__Class {
@JRyven
JRyven / functions.php
Last active October 26, 2021 08:45
Add a simple button to the WordPress administrator toolbar that will remove the admin toolbar from the DOM.
<?php
/* Click_Hide_Admin_Toolbar
*
*
*/
class Click_Hide_Admin_Toolbar {