Skip to content

Instantly share code, notes, and snippets.

@infocities
infocities / bs5-navwalker.php
Created April 4, 2024 06:50 — forked from cdsaenz/bs5-navwalker.php
Wordpress Bootstrap 5 Nav Walker With Multiple Levels
<?php
/**
* CSDev - Bootstrap 5 wp_nav_menu walker
* Supports WP MultiLevel menus
* Based on https://github.com/AlexWebLab/bootstrap-5-wordpress-navbar-walker
* Requires additional CSS fixes
* CSS at https://gist.github.com/cdsaenz/d401330ba9705cfe7c18b19634c83004
* CHANGE: removed custom display_element. Just call the menu with a $depth of 3 or more.
*/
class bs5_Walker extends Walker_Nav_menu
@infocities
infocities / gravity-forms-confirmation-remain.php
Created April 1, 2024 06:26 — forked from davidwolfpaw/gravity-forms-confirmation-remain.php
Keep Gravity Forms Displayed After Submission
<?php
// Allow the Gravity form to stay on the page when confirmation displays.
add_filter( 'gform_pre_submission_filter', 'dw_show_confirmation_and_form' );
function dw_show_confirmation_and_form( $form ) {
// Inserts a shortcode for the form without title or description
$shortcode = '[gravityform id="' . $form['id'] . '" title="false" description="false"]';
// Ensures that new lines are not added to HTML Markup
ob_start();
@infocities
infocities / gist:0ed3def2019544c8cedfea82e5057586
Created April 1, 2024 02:49 — forked from 465media/gist:17664b045de75deafcb2b99695d22df9
Set default "From Email" for Gravity Forms notifications using WordPress domain.
/**
* Set default "From Email" for Gravity Forms notifications using WordPress domain.
*/
function override_gravityforms_from_email( $email, $notification ) {
// Get the WordPress site URL and extract the domain.
$site_url = get_site_url();
$parsed_url = parse_url( $site_url );
$domain = isset( $parsed_url['host'] ) ? $parsed_url['host'] : '';
if ( isset( $email['from'] ) && $email['from'] === '{admin_email}' ) {
$email['from'] = 'no-reply@' . $domain;
@infocities
infocities / reorder-admin-menu.php
Created March 10, 2024 13:24 — forked from RadGH/reorder-admin-menu.php
Reorganize a specific set of menu items in the WordPress admin dashboard. Also create a new separator and ACF options page, and move those too.
<?php
if ( !defined( 'ABSPATH' ) ) exit;
/**
* Add a menu separator to the admin dashboard. This will be positioned within axe_reorder_admin()
*/
function axe_admin_menu_separator() {
global $menu;
$menu[] = array(
@infocities
infocities / append-nav-items.php
Created March 5, 2024 04:26 — forked from wpscholar/append-nav-items.php
Add a custom link to the end of a menu that uses the wp_nav_menu() function
<?php
/**
* Add a custom link to the end of a specific menu that uses the wp_nav_menu() function
*/
add_filter('wp_nav_menu_items', 'add_admin_link', 10, 2);
function add_admin_link($items, $args){
if( $args->theme_location == 'footer_menu' ){
$items .= '<li><a title="Admin" href="'. esc_url( admin_url() ) .'">' . __( 'Admin' ) . '</a></li>';
}
@infocities
infocities / webpack.mix.js
Created September 22, 2023 07:46 — forked from dfravel/webpack.mix.js
Laravel Mix Webpack Setup for WordPress, Sage by Roots and Tailwind
const mix = require('laravel-mix');
const ImageminPlugin = require('imagemin-webpack-plugin').default;
require('laravel-mix-tailwind');
require('laravel-mix-purgecss');
const assetsPath = 'resources/assets';
const distPath = './dist';
const publicPath = '/wp-content/themes/THEME_NAME';
@infocities
infocities / _flickity.scss
Created September 22, 2023 07:45 — forked from moxdev/_flickity.scss
Home Page Carousel with Text - Flickity Based #wp #jsLibrary
/*! Flickity v2.1.2
https://flickity.metafizzy.co
---------------------------------------------- */
.flickity-enabled {
position: relative;
}
.flickity-enabled:focus {
outline: none;
@infocities
infocities / caculate_navbar_height.md
Created September 19, 2023 15:24 — forked from sanrandry/caculate_navbar_height.md
calculate navbar height
  • add this javascript
document.documentElement.style.setProperty('--nav-height', document.getElementById("navbar").offsetHeight);
  • use property iny css
:root {
    --nav-height: 70px; /*You HAVE To Give A Default Fallback Value*/
}
@infocities
infocities / index.html
Created September 11, 2023 05:21 — forked from rovria/index.html
Locomotive Scroll with ScrollTrigger overlay reveal - data-scroll-section
<div class="smooth-scroll">
<section class="red" data-scroll-section>
<div class="section-inner">Text</div>
</section>
<section class="blue" data-scroll-section>
<div class="section-inner">Text</div>
</section>
@infocities
infocities / gw-gravity-forms-submission-limit.php
Created June 30, 2022 15:41 — forked from spivurno/gw-gravity-forms-submission-limit.php
Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value)
<?php
/**
* Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value)
*
* Limit the number of times a form can be submitted per a specific time period. You modify this limit to apply to
* the visitor's IP address, the user's ID, the user's role, a specific form URL, or the value of a specific field.
* These "limiters" can be combined to create more complex limitations.
*
* @version 3.0
* @author David Smith <david@gravitywiz.com>