Skip to content

Instantly share code, notes, and snippets.

View lori's full-sized avatar

Lori Berkowitz lori

View GitHub Profile
@jchristopher
jchristopher / gist:7312074
Last active August 12, 2020 02:43
Supplemental SearchWP search engine integration with Genesis, supports pagination
<?php
/* Template Name: Genesis and SearchWP integration with pagination */
function prefix_searchwp_form( $query ) {
echo '<form class="searchwp-form" action="" method="get">';
echo '<input type="text" id="searchwpquery" name="searchwpquery" value="' . esc_attr( $query ) . '" />';
echo '<button type="submit">' . __( 'Search', 'text-domain' ) . '</button>';
echo '</form>';
}
@jaredatch
jaredatch / gist:8307866
Created January 7, 2014 22:11
Generate slideshow from ACF gallery field via Soliloquy Dynamic addon
<?php
/**
* Generate slideshow from ACF gallery field.
*
* A Flexslider (Soliloquy) slider will be created from from images assigned
* via the ACF gallery field type.
*
* The following plugins are needed:
* - Soliloquy
* - Soliloquy Dyanmic Addon
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 16, 2025 13:41
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@portfola
portfola / author.php
Last active May 6, 2023 18:15
Custom User Taxonomies in WordPress
<?php
/**
* The template for displaying Profile pages.
*
* Used for Artist and Cultural Org "mini" pages.
*
* @package ArtsWestchester
* @since ArtsWestchester 1.0
*/
@imknight
imknight / gravity-form-save-acf
Last active November 22, 2017 21:29
WordPress Gravity Form Save Custom Meta Field for Advanced Custom Fields
add_action("gform_after_submission_1", "acf_post_submission", 10, 2);
function acf_post_submission ($entry, $form)
{
$post_id = $entry["post_id"];
update_field('address1', $entry['29.1'], $post_id);
update_field('address2', $entry['29.2'], $post_id);
update_field('address3', $entry['29.3'], $post_id);
}
@chriscoyier
chriscoyier / frontendplugins.md
Last active March 3, 2021 17:31
How WordPress Plugins Should Handle Front End Resources

How WordPress Plugins Should Handle Front End Resources

This is a WORK IN PROGRESS intended for fleshing out and feedback

It's very common for people to be unhappy with how a WordPress plugin adds front end resources to their site. If a plugin needs CSS, the plugin will add a <link> element to that CSS. If the plugin needs JavaScript, it will add a <script> to that JavaScript.

Plugins do this because it works. It's damn important for a WordPress plugin to work, even in adverse conditions. They rightfully want good ratings and little customer support.

But this comes at the cost of additional HTTP requests. In optimizing front end performance of a site, reducing the number of HTTP requests is a huge thing. Front end developers want to decide and control how front end resources are being handled, and WordPress plugins don't typically make this easy on them.

@calliaweb
calliaweb / display-advanced-custom-fields-gallery-as-an-envira-gallery.php
Last active November 11, 2020 18:44
Display Advanced Custom Fields Gallery as an Envira Gallery
@spivurno
spivurno / gw-gravity-forms-edit-entries.php
Last active December 19, 2021 01:01
Gravity Wiz // Gravity Forms // Edit Entries on Frontend — https://gravitywiz.com/edit-gravity-forms-entries-on-the-front-end/
<?php
/**
* --------------------------------------------------------------------
* STOP! There's a better way to do this now:
* https://gravitywiz.com/edit-gravity-forms-entries-on-the-front-end/
* --------------------------------------------------------------------
*
* Gravity Wiz // Gravity Forms // Edit Entries
*
* Automatically populate a form with data based on an entry ID and update that entry on submission.
@jchristopher
jchristopher / gist:046e62499a9f32cc8b7b
Last active June 21, 2020 23:23
Have SearchWP short circuit if an empty search was submitted
<?php
if ( isset( $_GET['s'] ) && 0 == strlen( trim( $_GET['s'] ) ) ) {
add_filter( 'searchwp_short_circuit', '__return_true' );
}
@tomazzaman
tomazzaman / class-developer-import.php
Created March 31, 2015 18:03
Import JSON into WordPress
<?php
// Published under GPL
// tutorial here: https://codeable.io/community/how-to-import-json-into-wordpress/
class Developer_Import {
public function __construct() {
add_action( 'wp_ajax_import_developer', array( $this, 'import_developer' ) );