Skip to content

Instantly share code, notes, and snippets.

@Nerd-Rush
Nerd-Rush / Client editing disclaimer PHP snippet
Last active January 29, 2024 00:15
Dismissable WordPress message to your clients.
// Client editing disclaimer
function custom_admin_notice_with_logo() {
$user_id = get_current_user_id();
if (get_user_meta($user_id, 'custom_notice_dismissed', true) !== 'yes') {
if (current_user_can('administrator') || current_user_can('editor') || current_user_can('author')) {
$nonce = wp_create_nonce('custom_notice_dismiss_nonce');
$image_url = 'https://nerdrush.com/wp-content/uploads/2023/08/Nerd-Rush-Logo-Blue-2023.svg'; // External image URL
?>
<div class="notice notice-warning custom-notice" style="padding-top: 20px;">
<img src="<?php echo esc_url( $image_url ); ?>" alt="Logo" style="width: 120px; display: block; margin-bottom: 10px;">
@Crocoblock
Crocoblock / booking-calendar-api-doc.md
Last active May 16, 2025 02:18
JetBooking. JavaScript API documentation

Documentation for JetBooking calendar JS API

Filter jet-booking.input.config

Allows to change initial set up of booking calendar. Usage example:

window.JetPlugins.hooks.addFilter( "jet-booking.input.config", "jetBooking", ( config ) => {

	const validateDay = config.beforeShowDay;
@Crocoblock
Crocoblock / get-meta.php
Last active May 8, 2025 17:36
Get current JetEngine listing object meta value ( somewhat similar to ACF get_field() )
<?php
//You may just use get_post_meta() / get_term_meta() / get_user_meta() to get post/term/user meta
//However, in Listing Grid, you may use get_meta() method for convenience
$value = jet_engine()->listings->data->get_meta( $meta_key, $object );
/**
* Get object meta value. Works for Posts, Terms, Users, Comments
* $object defaults to null, then the value will be retrieved from the current listing object
@philipgledhill
philipgledhill / Mai Theme Engine: Shortcodes I use most often
Created November 30, 2018 08:31
There are many Mai Theme Engine shortcodes. Most of them are only rarely used. The shortcodes I list here do most of the things I want to do most of the time. For much more comprehensive documentation, see the Mai Theme help pages.
/** ----------- Grid Shortcodes I use Most Often ---------- */
[grid content="post"]
[grid content="post" columns="4"]
[grid content="post" categories="16, 7"]
[grid content="post" content_limit="50"]
@feliciaceballos
feliciaceballos / forminator-example.txt
Created September 25, 2018 02:09
New Client Questionnaire
{"type":"form","data":{"fields":[{"id":"section-1","element_id":"section-1","form_id":"wrapper-1537827779502-1868","condition_action":"show","condition_rule":"any","conditions":[],"type":"section","options":[],"cols":12,"section_title":"Project Leader","section_border":"false","section_subtitle":"","custom-class":"","wrapper_id":"wrapper-1537827779502-1868"},{"id":"name-1","element_id":"name-1","form_id":"wrapper-1511347711918-1669","condition_action":"show","condition_rule":"any","conditions":[],"type":"name","cols":4,"required":"true","field_label":"Project Leader Name","placeholder":"E.g. John","prefix_label":"Prefix","fname_label":"First Name","fname_placeholder":"E.g. John","mname_label":"Middle Name","mname_placeholder":"E.g. Smith","lname_label":"Last Name","lname_placeholder":"E.g. Doe","prefix_description":"","fname_description":"","mname_description":"","lname_description":"","description":"","custom-class":"","wrapper_id":"wrapper-1511347711918-1669"},{"id":"email-1","element_id":"email-1","form_id
@JiveDig
JiveDig / facetwp-pagination-genesis-markup.php
Last active September 24, 2021 18:54
Adjust FacetWP's pager html to match Genesis markup. This allows it to inherit the Genesis theme styles. Used with [facetwp pager="true"]
<?php
/**
* Style pagination to look like Genesis.
*
* @version 1.0.0
*
* @author Mike Hemberger @JiveDig
*
* @link https://gist.github.com/JiveDig/b9810ba4c322d7757993159ed9ccb61f
@yoren
yoren / functions.php
Last active March 21, 2023 23:15
Parent Post From Another Post Type And A New URL Structure In WordPress
<?php
// Flush rewrite rules after switch theme
function my_rewrite_flush() {
flush_rewrite_rules();
}
add_action( 'after_switch_theme', 'my_rewrite_flush' );
// A little help so we can get the stylesheet from parent theme
// Remove line 10-19 if this is not a child theme
function my_enqueue_styles() {
@mgibbs189
mgibbs189 / test.php
Last active October 20, 2018 07:19
FacetWP - index multiple field values for a single autocomplete facet
<?php
// Add to functions.php
function fwp_combine_sources( $params, $class ) {
if ( 'MY_FACET_NAME' == $params['facet_name'] ) {
$value = get_field( 'YOUR_FIELD_1' );
$params['facet_value'] = sanitize_title( $value );
$params['facet_display_value'] = $value;
$class->insert( $params );
<?php
$terms = array( 'citywide', 'central', 'east', 'west', 'seasonal' );
foreach( $terms as $term ) {
$events = tribe_get_events(
array(
'posts_per_page' => 4,
'tax_query' => array(
array(
'taxonomy' => 'tribe_events_cat',
@neilgee
neilgee / sidebar-cpt.php
Last active December 2, 2017 05:02
Genesis Simple Sidebar - Conditionally change cased on CPT
<?php
//do not copy the above opening php tag
/**
* Conditionally Change Sidebar in Genesis whilst using Simple Sidebars
*
* @package Genesis Simple Sidebar on Custom Post Type
* @author Neil Gee
* @link http://wpbeaches.com/set-sidebar-custom-post-type-genesis/
* @copyright (c) 2014, Neil Gee