Skip to content

Instantly share code, notes, and snippets.

View array_for_repeater.php
<?php
/**
* A Hack to generate mock WP Post objects from any arbitrary array
* A possible use case is to render a list of taxonomy terms using Oxygen Builder's repeater element,
* as the repeater allows only WP_Query as a source of data
*
* @author: Gagan S Goraya
* @link: https://gagangoraya.com
*
@gsgoraya
gsgoraya / php_snippets.php
Last active Jun 5, 2021
grouping posts by categories for FilterWP display
View php_snippets.php
<?php
class FWSP_Group_Sub_Cats {
public static $last_cat;
public static function init() {
self::$last_cat = false;
add_filter('posts_orderby', array( __CLASS__, 'fwsp_orderby_cat' ), 10, 2);
View ajaxtest.js
(($) => {
$('.oxy-dynamic-list').on('click', '.oxy-repeater-pages-wrap a', (e) => {
e.preventDefault();
let list = $(e.target).closest('.oxy-dynamic-list');
$.get(e.target.getAttribute('href'), (data) => {
let container = $('<div>');
container.html(data);
View .php
<?php
class ExtraCounter extends OxygenExtraElements {
var $js_added = false;
function name() {
return 'Counter';
}
/*function icon() {
View gist:79a3ff70d9cdd2e76cac97e1486668cb
// insert the code inside this block
$('a#ct-edit-template-builder, a#ct-edit-template-builder-parent').on('click', function(e) {
.......
.......
.......
.......
// following is the code to be inserted at the end of this block.
View gradient_layout_repeater.txt
[oxy_dynamic_list_2 ct_sign_sha256='8a252fcf5de243d4553c3cf6b197dd5ba8d78d02340e815873e577578c6369aa' ct_options='{"ct_id":3,"ct_parent":0,"selector":"_dynamic_list-3-43","original":{"wp_query":"custom","query_post_types":{"0":"post"}},"activeselector":false}'][ct_div_block_3 ct_sign_sha256='09446a37831b649be581dfd06a1aaacae3922e42c66ebcee28808723ddaf1ab9' ct_options='{"ct_id":4,"ct_parent":3,"selector":"div_block-4-43","original":{"background-image":"[oxygen ct_sign_sha256='da3f019e25ef5e506aa9a0b20b450d380922d266d98fe7fe2be40a68967e1cd8' data='featured_image' size='large' ]","background-imagedynamic":true,"background-size":"cover","width":"50","width-unit":"%","position":"relative","overflow":"hidden","height":"650","padding-top":"390","transition-duration":"0.5"},"activeselector":false,"hover":{"padding-top":"300"}}'][ct_div_block_4 ct_sign_sha256='f0fb393b515f5513d4a253e4947691a6252bd3e77e133d94b41e2f8f7baf3d61' ct_options='{"ct_id":35,"ct_parent":4,"selector":"div_block-35-43","original":{"position":"rel
View woocommerce_product_card1.php
<?php
/**
* woocommerce_before_shop_loop_item hook.
*
* @hooked woocommerce_template_loop_product_link_open - 10
*/
do_action( 'woocommerce_before_shop_loop_item' );
/**
* woocommerce_before_shop_loop_item_title hook.
View woocommerce_product_card1.css
div.th-filterable-list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
div.th-filterable-list > div {
width: 48%;
text-align: center;
margin-bottom: 3em;
}
View filterlisttemplates.json
{"gists":[{"title":"Woocommerce Products","css":"https://gist.githubusercontent.com/gsgoraya/e160df718a7f1e38e4bf17196c9c9585/raw/dbf1d98f68c9099ef97ba5adeff9c0bb055c6f32/woocommerce_product_card1.css","code":"https://gist.githubusercontent.com/gsgoraya/00d831b3a68df09dd34e3515934177f8/raw/4b9bdfe9f4fe9b981fc5ac37d012f8fb5e57248c/woocommerce_product_card1.php"},{"title":"style2","css":"somepath.css","code":"code.php"}]}