Skip to content

Instantly share code, notes, and snippets.

@infn8
infn8 / functions.php
Created March 7, 2018 22:00
Show Bootstrap Sizers in Wordpress
<?php
function getBootstrapBreakpoints() {
return array(
'xs',
'sm',
'md',
'lg',
'xl',
);
// paste into WP console in admin
jQuery(document).ready(function($) {
$('.acf-flexible-content .values .acf-icon.-collapse').click(function(e){
$this = $(this);
if(e.shiftKey) {
open = $this.is('.-collapsed .-collapse');
console.log('shift clicked');
console.log('open: ', open);
if (open){
$all = $this.parentsUntil('.values').parent().find('.-collapsed .acf-icon.-collapse');
@infn8
infn8 / get_adjacent_custom_posts.php
Created January 21, 2025 19:32
WordPress Previous and Next posts with the same taxonomy term
<?php
/**
* Retrieve the adjacent posts for a specific custom post type and taxonomy.
*
* This function returns the previous and next posts based on the provided
* custom post type, taxonomy, and ordering by published date in descending order (newest first).
*
* @param int $post_id The ID of the current post.
* @param string $taxonomy The taxonomy to filter posts by.
* @param string $post_type The custom post type to query.