Skip to content

Instantly share code, notes, and snippets.

View wplit's full-sized avatar
💭
I may be slow to respond.

David Browne wplit

💭
I may be slow to respond.
View GitHub Profile
@wplit
wplit / dynamic-tag
Last active July 6, 2024 08:25
using dynamic tag to output custom field
{echo:get_field('field_name')}
@wplit
wplit / code-snippet.php
Last active July 4, 2024 10:04
check user status matches in specific membership level (RCP)
<?php
/* custom function for checking status of user in membership (add to code snippets or child theme)
* @return bool True if user has the status in that memberhip.
*/
function rcp_member_status( $membership_level, $status ) {
$customer = rcp_get_customer_by_user_id( get_current_user_id() );
if ($customer) {
@wplit
wplit / footer-scripts.html
Created July 2, 2024 10:19
disable gyroscope from tilt
@wplit
wplit / code-block.js
Created June 25, 2024 17:59
remove heading text from beginning of links in table of contents
jQuery(document).ready(($) => {
const headingText = "New York Tipps - ";
tocbot.options.headingLabelCallback = (string) => {
return string.replace(headingText, "");
}
tocbot.refresh()
@wplit
wplit / code.js
Last active June 25, 2024 17:40
prevent tab moved on a + d keys
jQuery(document).ready(($) => {
$('#%%ELEMENT_ID%% .oxy-dynamic-tabs_panel-group').on('keydown', (e) => {
if ( 65 === e.keyCode || 68 === e.keyCode ) {
e.stopPropagation()
}
})
@wplit
wplit / code.js
Last active June 20, 2024 00:55
stop presto player when lightboxes close
jQuery(document).ready(function($) {
$('.oxy-lightbox').on('extras_lightbox:close', () => {
$(this).find('presto-player').stop();
})
})
@wplit
wplit / footer-scripts.html
Last active June 17, 2024 12:36
scroll to 'read more' element on collapse (page settings > custom code > footer scripts)
<?php
add_filter( 'bricks/element/render_attributes', function( $attributes, $key, $element ) {
$element_name = "xsocialshare";
if ( $element_name === $element->name && strpos( $key, "link-") === 0 ) {
foreach($attributes as $attr=>$row){
unset($attributes[$attr]['target']);
@wplit
wplit / code.css
Created June 13, 2024 01:17
change facet button colors based on nth-child
/* colors when unselected */
%root% .wpgb-facet .wpgb-button-facet li:nth-child(1) .wpgb-button {
background-color: red;
border-color: red;
color: white;
}
%root% .wpgb-facet .wpgb-button-facet li:nth-child(2) .wpgb-button {
background-color: red;
@wplit
wplit / functions.php
Created June 11, 2024 04:16
prevent Bricks' header/footer being rendered based on condition
<?php
/* do not render header if acf_hide_header field is true */
add_filter('bricks/render_header', function( $header_html ) {
return is_singular() && get_field('acf_hide_header') ? '' : $header_html;
});
/* do not render footer if acf_hide_footer field is true */
add_filter('bricks/render_footer', function( $footer_html ) {