Skip to content

Instantly share code, notes, and snippets.

View gioeleber's full-sized avatar

gioele bernardi gioeleber

  • Italy
View GitHub Profile
<?php
/**
* Add meta fields support in rest API for post type `Post`
*
* This function will allow custom parameters within API request URL. Add post meta support for post type `Post`.
*
* > How to use?
* http://mysite.com/wp-json/wp/v2/posts?meta_key=<my_meta_key>&meta_value=<my_meta_value>
*
* > E.g. Get posts which post meta `already-visited` value is `true`.
// npm install --save scrollreveal or install like you're used to doing it.
// It doesn't work well if there are multiple instances of ScrollReveal,
// so we have to create a module returning an instance:
// file ScrollReveal.js:
import ScrollReveal from 'scrollreveal'
export default ScrollReveal()
// Then in a component:
import React from 'react'
import sr from './ScrollReveal'
@CodeProKid
CodeProKid / wp-exclude-child-categories.php
Last active July 29, 2023 13:16
Exclude child categories from a category archive page in WordPress
<?php
/**
* Excludes child terms from the main query on the category archive.
*
* @param object $query the WP_Query instance
* @return void
* @access public
*/
function rk_fix_tax_queries_on_archives( $query ) {