Skip to content

Instantly share code, notes, and snippets.

View brettkelly's full-sized avatar

Brett Kelly brettkelly

View GitHub Profile
window.addEventListener( 'DOMContentLoaded', function() {
var $map = $( '.jet-map-listing' );
if ( ! $map.length ) {
return;
}
$map.on( 'jet-filter-custom-content-render', function( event, response ) {
<?php
add_action('rest_api_init', 'getawayRegisterRoute');
function getawayRegisterRoute() {
register_rest_route( 'getaway/v1', 'data', array(
'methods' => WP_REST_SERVER::READABLE,
'callback' => 'getawayDataResults'
));
}
@jheddings
jheddings / ex-notes.py
Last active December 28, 2023 00:07
Import Apple Notes into Notion.
#!/usr/bin/env python3
# !! NOTE - this script is no longer maintained... please see the repo for further
# updates: https://github.com/jheddings/notes2notion
# this script attempts to migrate from Apple Notes to Notion while retaining as
# much information and formatting as possible. there are limitations to the
# export data from Notes, so we try to preserve the intent of the original note.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
@yankiara
yankiara / oxygen-repeater-dynamic-query.php
Last active September 6, 2023 19:25
Use dynamic queries with Oxygen's repeater
/* I'll put here different examples of dynamic query for Oxygen repeater :
* - Use one of the following repeater_dynamic_query definitions
* in code block just BEFORE the repeater
* - Set the repeater custom query settings : post type, number of posts, order...
* - Add the remove_action in a code block AFTER the repeater
*/
/****************************************************************************************************
* Display related posts for any CPT with taxonomy:
@rushijagani
rushijagani / functions.php
Created October 19, 2018 11:07
Override Custom Post Type template
<?php
add_action( 'astra_content_loop', 'custom_post_type_loop_callback' );
function custom_post_type_loop_callback(){
if( "movies" == get_post_type() ) {
remove_action( 'astra_template_parts_content', array( Astra_Loop::get_instance(), 'template_parts_default' ) );
remove_action( 'astra_template_parts_content', array( Astra_Loop::get_instance(), 'template_parts_post' ) );
if ( is_singular( "movies" ) ) {
add_filter( 'astra_post_link', '__return_false' );
}
@devinsays
devinsays / example-ajax-enqueue.php
Last active October 4, 2023 13:09
Simple WordPress Ajax Example
<?php
function example_ajax_enqueue() {
// Enqueue javascript on the frontend.
wp_enqueue_script(
'example-ajax-script',
get_template_directory_uri() . '/js/simple-ajax-example.js',
array( 'jquery' )
);
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
@michaellihs
michaellihs / tmux-cheat-sheet.md
Last active April 21, 2024 20:22
tmux Cheat Sheet
@lopspower
lopspower / README.md
Last active April 24, 2024 19:24
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@Nilpo
Nilpo / Using Git to Manage a Live Web Site.md
Last active April 3, 2024 06:29
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents