Skip to content

Instantly share code, notes, and snippets.

View apsolut's full-sized avatar
🏠
Working from home

Aleksandar Perisic apsolut

🏠
Working from home
View GitHub Profile
@apsolut
apsolut / docker-wordpress-base.yaml
Last active November 27, 2021 02:34
maybe its time for Docker - WordPress local development
#### TRY
### https://gitmemory.cn/repo/nezhar/wordpress-docker-compose/issues/74
###
###
###
###
version: "3.9"
services:
@apsolut
apsolut / wp-archive-acf-options-image.php
Last active September 4, 2024 17:56
WP Archive ACF options page Image Header
<?
/**
* Get terms for this tax (cpt category)
*/
$term_id = null;
$taxonomy = NULL;
$queried_object = get_queried_object();
if ( !$queried_object == NULL && !is_search() && !is_404() ) {
@apsolut
apsolut / javascript vanilla each
Created October 19, 2021 15:57
javascript vanilla js quicks
var elementNameHere = document.getElementsByClassName("classs-first-element-check");
if ( elementNameHere ) {
for ( var i = 0, len = elementNameHere.length; i < len; i++ ) {
console.log( len[i] );
}
}
@apsolut
apsolut / woocommerce-javascript-events.js
Created October 14, 2021 06:30
WooCommerce JavaScript events
/**
* https://docs.woocommerce.com/document/composite-products/composite-products-js-api-reference/
* https://wordpress.stackexchange.com/questions/342148/list-of-js-events-in-the-woocommerce-frontend
*/
//Woocommerce Checkout JS events
$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
@apsolut
apsolut / barba-before-after.js
Created October 12, 2021 17:00
barbajs after before
barba.hooks.before((data) => {
const cols = document.querySelector('.site-branding');
gsap.to(cols, {
autoAlpha: 0,
});
});
barba.hooks.after((data) => {
@apsolut
apsolut / gsap-matchMedia.js
Last active September 4, 2024 17:57
gsap global all
ScrollTrigger.matchMedia({
// desktop
"(min-width: 1024px)": function() {
const childSplit = new SplitText('.block__slide__inner h2', {
type: 'lines',
linesClass: 'split-child'
});
const parentSplit = new SplitText('.block__slide__inner h2', {
type: "lines",
@apsolut
apsolut / wp-query-efficiency-args.php
Created September 1, 2021 09:25 — forked from mishterk/wp-query-efficiency-args.php
Some handy considerations when running WP_Query to speed up the query depending on the requirements. This demonstrates using specific post ID's from ACF custom database tables in conjunction with some built in WP_Query args to save on internal queries.
<?php
$query = new WP_Query([
// Standard query args. Using post__in can be much faster. If searching ACF custom
// database tables data, plugin the found post IDs in here.
'post_type' => 'post',
'post__in' => [1,2,3], // array of post IDs
// Optional args to improve performance. Use these to cut down on internal
@apsolut
apsolut / facetwp-loadmore.js
Last active September 4, 2024 17:58
facetwp worked part
(function($) {
window.fwp_is_paging = false;
$(document).on('facetwp-refresh', function() {
if (! window.fwp_is_paging) {
window.fwp_page = 1;
FWP.extras.per_page = 'default';
if (FWP.loaded) {
$('#pagination .container').prepend('<div class="decom-loading">Loading...</div>');
}
@apsolut
apsolut / loop-taxonomy-taxes-selected-acf.php
Last active September 1, 2021 09:28
Loop ACF field taxonomy with multi selected taxes
<?php
/**
* custom CPT `faqs` with taxonomy `faq_categories`
* section_faq_category is field Taxonomy with Term Object, multi select
* faq counter and definitions for terms
* loop taxonomy selected taxes with ACF
* tax_ID, array of IDs
*
*/
$faq_object = get_sub_field('section_faq_category');
@apsolut
apsolut / loop-acf-tax-term-list-loop.php
Last active September 1, 2021 09:28
ACF taxonomy terms to LIST - WordPress Loop
<?php
/**
WordPress loop
Taxonomy and Terms
*/
$faq_object = get_sub_field('section_faq_category');
if( $faq_object ):
foreach ( $faq_object as $faq_object_single ) {
$tax_id_convert = $faq_object_single->term_id;
$tax_id_all[] = $tax_id_convert;