Skip to content

Instantly share code, notes, and snippets.

🤠
Big Transition

Landon Otis landbryo

🤠
Big Transition
Block or report user

Report or block landbryo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rcp_restrict_activity.php
<?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 Dec 12, 2019
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.
View pp_post_grid_a11y.js
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);
}
}
View view-limit-condition-example.php
/**
* 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;
}
View 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 Aug 23, 2019
Window size function to be used as a Chrome bookmark
View window_size_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 Jun 13, 2019
This function looks for the most recent post and adds it to any menu item with #placeholder as a link.
View latest_post_menu_item.php
/**
* Look for placeholder url and replace it with latest post
*
* @param $items
*
* @return mixed
*/
function latest_conference_item( $items ) {
// Get the latest conference
View gravity-field-template
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
A filter to override the Restrict Content Pro - Resume Manager resume limit and set it to a custom value.
View custom_set_limit.php
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',
View bp_reg_assign_users
/**
* 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' ) ) {
View bp_assignuser_forum
/**
* Assign users to forums upon registration
*/
function sc_user_activate_forum( $user_id ) {
$current_user = get_user_by( 'ID', $user_id );
// Subscribe to forums in listed IDs
if ( groups_is_user_member( $user_id, 7 ) ) {
$forum_ids = array(
997,
1070,
You can’t perform that action at this time.