Skip to content

Instantly share code, notes, and snippets.

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

Štěpán Kulík Kuldas

🏠
Working from home
View GitHub Profile
@wplit
wplit / code-block.js
Last active August 5, 2020 11:26
scroll with id and offset (and fix for comment reply links not working)
jQuery(document).ready(function($) {
const offset = 0, // change offset (px)
scrollTime = 300; // change scrolling animation time (ms)
$('a[href*="#"]').not('[href="#"]').not('[href="#0"]').not('[href*="replytocom"]').click(function (t) {
if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") && location.hostname == this.hostname) {
var e = $(this.hash);
(e = e.length ? e : $("[name=" + this.hash.slice(1) + "]")).length && (t.preventDefault(), $("html, body").animate({ scrollTop: e.offset().top - offset }, scrollTime));
}
@yankiara
yankiara / wordpress-pagination-frontpage.php
Last active January 19, 2023 01:15
Allow Wordpress posts pagination on frontpage
<?php
/*
* Put following code BEFORE running the query (WP loop, Oxygen's repeater, etc.)
* What it does:
* - updates query with right page number variable to display the correct page
* - assigns the query to wp_query so that pagination links work
*/
function handle_pagination_on_frontpage( $query ) {
@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: