Skip to content

Instantly share code, notes, and snippets.


wpsumo wpsumo

  • Switzerland
View GitHub Profile
swinggraphics / oxy-save-rendered-content.php
Last active Nov 19, 2020
Copy compiled Oxygen page content to post_content for search
View oxy-save-rendered-content.php
/* Copy compiled Oxygen page content to post_content for search */
function sg_save_rendered_page_content( $meta_id, $object_id, $meta_key, $meta_value ) {
// Debugging
// $debug .= preg_replace( '#(\[/[^\]]+?\])#', "$1\n", $meta_value );
// file_put_contents( plugin_dir_path( __FILE__ ) . 'debug.html', $debug );
if ( 'ct_builder_shortcodes' != $meta_key ) return;
// Don't try to render anything with inner content
if ( false !== strpos( $meta_value, '[ct_inner_content' ) ) return;
ERROPiX / oxy-cm-theme.scss
Created Sep 21, 2020
An Advanced Scripts snippet to enhance the Oxygen code editor theme
View oxy-cm-theme.scss
Title: Oxygen Code Editor Theme
Type: CSS > Compile SCSS Code
Location: Custom Hooks
Hook name: oxygen_enqueue_ui_scripts
Priority: 10
#oxygen-ui {
.cm-s-default {
yankiara / oxygen-repeater-dynamic-query.php
Last active Feb 17, 2021
Use dynamic queries with Oxygen's repeater
View oxygen-repeater-dynamic-query.php
* Example of related posts repeater for any CPT with taxonomy:
* - Filter query to prevent altering queries inside the repeater items,
* - Retrieve post category slug in taxonomy terms : I have only one for each post, so I just take first element.
* (You might need to add error tests, of course, if you don't accept empty results,
* for instance if you forgot to set post category.)
* - Set tax_query arg with taxonomy slug
* (for instance 'category' for standard posts category, 'post_tag' for tags, 'product_cat' for WooCommerce products)
* - Set random order
* - Exclude current post
hnq90 / functions.php
Created Jan 11, 2018 — forked from yoren/functions.php
Parent Post From Another Post Type And A New URL Structure In WordPress
View functions.php
// Flush rewrite rules after switch theme
function my_rewrite_flush() {
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() {
c3mdigital / cacheable-ajax.php
Last active Jan 30, 2021
Example of how to cache fronted ajax requests in WordPress. This will allow you to use ajax and page caching like varnish or redis. Where ajax requests would normally not be cached using the built in wp_ajax_action method.
View cacheable-ajax.php
add_filter( 'rewrite_rules_array', 'cache_frontend_ajax_rules' );
* Rewrite rules filter to add rules for front end ajax calls
* @param array $rewrite_rules
* @return array
gyrus / preload-images.js
Last active Mar 3, 2021
WordPress image preloading
View preload-images.js
* Image preloader
* @link
var cache = [];
// Arguments are image paths relative to the current page.
function pilau_preload_images() {
var args_len, i, cache_image;
args_len = arguments.length;