Skip to content

Instantly share code, notes, and snippets.

View landbryo's full-sized avatar
🤠
Always Excitied

Landon Otis landbryo

🤠
Always Excitied
View GitHub Profile
/**
* If post ID is in array then disable View Limit functionality
*/
add_filter( 'skpvl_is_active', function ( $active ) {
global $post;
$disabled = [ 25, 33, 107 ];
if ( in_array( $post->ID, $disabled ) ) {
<?php
/**
* Require user to have access level to view BuddyPress page
*/
add_filter( 'rcp_member_can_access', function ( $can_access ) {
$access_level = 4;
$page_slug = 'activity';
$customer = rcp_get_customer_by_user_id( get_current_user_id() );
@landbryo
landbryo / pp_post_grid_a11y.js
Created December 12, 2019 19:01
The Beaver Builder Power Pack Post Grid has empty links which are flagged for accessibility. This function maps the post's title to an aria label.
function ppPostAria() {
let links = document.querySelectorAll('.pp-post-link');
let titles = document.querySelectorAll('.pp-content-grid-title');
for (let i = 0; i < links.length; i++) {
let title = titles[i].innerText;
links[i].setAttribute('aria-label', title);
}
}
/**
* If post ID is 25 then disable View Limit functionality
*/
add_filter( 'skpvl_is_active', function ( $active ) {
global $post;
if ( 25 == $post->ID ) {
$active = false;
}
@landbryo
landbryo / google_serp_extractor
Created August 23, 2019 16:18
Google SERP Extractor
javascript:(function(){output='<html><head><title>SEO SERP Extraction Tool</title><style type=\'text/css\'>body,table{font-family:Tahoma,Verdana,Segoe,sans-serif;font-size:11px;color:#000}h1,h2,th{color:#405850}th{text-align:left}h2{font-size:11px;margin-bottom:3px}</style></head><body>'; output+='<table><tbody><tr><td><h1>SEO%20SERP%20Extraction%20Tool</h1></td></tr></tbody></table>'; pageAnchors=document.getElementsByTagName('a'); divClasses=document.getElementsByTagName('div'); var%20linkcount=0;var%20linkLocation=''; var%20linkAnchorText=''; output+='<table><th>ID</th><th>Link</th><th>Anchor</th>'; for(i=0;i<pageAnchors.length;i++){ if(pageAnchors[i].parentNode.parentNode.getAttribute('class')!='_Rm'){ var%20anchorText%20=%20pageAnchors[i].textContent; var%20anchorLink%20=%20pageAnchors[i].href; var%20linkAnchor%20=%20anchorLink%20+%20'\t'+anchorText; var%20anchorID%20=%20pageAnchors[i].id; if(anchorLink!=''){ if(anchorLink.match(/^((?!google\.|cache|blogger.com|\.yahoo\.|youtube\.com\/\?gl=|youtube\.com\
@landbryo
landbryo / window_size_bookmark
Created August 23, 2019 16:02
Window size function to be used as a Chrome bookmark
javascript: (function () {
var v = window, d = document;
v.onresize = function () {
var w = v.innerWidth ? v.innerWidth : d.documentElement.clientWidth,
h = v.innerHeight ? v.innerHeight : d.documentElement.clientHeight, s = d.getElementById('WSPlgIn'), ss;
if (!s) {
s = d.createElement('div');
s.id = 'WSPlgIn';
d.body.appendChild(s);
s.onclick = function () {
@landbryo
landbryo / latest_post_menu_item.php
Created June 13, 2019 20:23
This function looks for the most recent post and adds it to any menu item with #placeholder as a link.
/**
* Look for placeholder url and replace it with latest post
*
* @param $items
*
* @return mixed
*/
function latest_conference_item( $items ) {
// Get the latest conference
add_filter( 'gform_form_post_get_meta_7', 'add_form_fields' );
function add_form_fields( $form ) {
// Don't make the parent form messy
if ( ! GFCommon::is_form_editor() ) {
// form we are adding fields to
$parent_id = $form['id'];
// template form ID
$childId = 5;
@landbryo
landbryo / custom_set_limit.php
Last active May 1, 2019 23:05
A filter to override the Restrict Content Pro - Resume Manager resume limit and set it to a custom value.
function custom_set_limit( $at_limit, $user_id ) {
if ( is_user_logged_in() && ! current_user_can( 'administrator' ) ) {
if ( empty( $user_id ) ) {
$user_id = get_current_user_id();
}
$resume_args = array(
'post_type' => 'resume',
/**
* Assign users to groups upon registration
*/
function group_user_activate( $user_id ) {
if ( ! function_exists( 'groups_join_group' ) ) {
return;
}
if ( is_page( 'registration' ) || is_page( 'other-registration' ) ) {