Skip to content

Instantly share code, notes, and snippets.

@wpscholar
wpscholar / .eslintignore
Last active March 14, 2022 10:21
Webpack 4 Config for WordPress plugin, theme, and block development
**/*.min.js
**/*.build.js
**/node_modules/**
**/vendor/**
build
coverage
cypress
node_modules
vendor
@chrismccoy
chrismccoy / gutenberg.txt
Last active April 4, 2024 20:34
Gutenberg Resources
How to parse Gutenberg content for headless WordPress
https://kinsta.com/blog/headless-wordpress-gutenberg/
Adding wrapper to Gutenberg’s Table block
https://helloadmin.com/adding-wrapper-to-gutenbergs-table-block/
Display specific Gutenberg blocks of a post outside of the post content in the theme
https://florianbrinkmann.com/en/display-specific-gutenberg-blocks-of-a-post-outside-of-the-post-content-in-the-theme-5620/
Modifying the Markup of a Core Block
@kellenmace
kellenmace / save-menu-date-modified-timestamps.php
Last active February 23, 2018 16:23
Set of functions for storing and getting last modified timestamps for WordPress menus
<?php
/**
* Save the date modified timestamp for a WordPress menu.
*
* @param int $menu_id Term ID of the menu being created/updated.
*/
function wds_save_menu_modified_timestamp( $menu_id ) {
$modified_timestamps = get_option( '_wds_menu_modified', array() );
@Twipped
Twipped / Trans-feminine HRT Changes.md
Last active June 3, 2022 15:15
My collective research and experiences with trans-feminine (male to female) hormone therapy

UPDATE: This gist is now deprecated, please visit The Gender Dysphoria Bible for the latest version of this document.

This is a compilation of report medical transition changes, collected from testimonials of trans women from various discussion forums and chat rooms, backed up by my own experiences.

Note that this is a list of possible changes. There is no guarentee that a person on HRT will experience all of these. As always, your milage may vary.

Changes connected to reduction of Testosterone:

  • Reduction in general body odor and change in the smell of ones sweat. Many report gaining a sweet smell.
  • Skin softens and becomes thinner.
@kellenmace
kellenmace / extras.php
Created March 23, 2017 19:40
Replacing the global $post object vs. not replacing it.
// Template part that DOES replace the global $post object:
?>
<div class="portfolio-items">
<?php global $post; ?>
<?php foreach ( wds_eight_get_portfolio_posts() as $post ) : ?>
<?php setup_postdata( $post ); ?>
@kellenmace
kellenmace / extras.php
Created March 23, 2017 19:34
Caching WP_Query posts
/**
* Get an array of all portfolio posts.
*
* @since 8.0.0
* @author Kellen Mace
* @return array $portfolio_posts Array of portfolio post WP_Post objects.
*/
function wds_eight_get_portfolio_posts() {
$portfolio_posts = get_transient( 'wds_portfolio_posts' );
@miya0001
miya0001 / cors-for-the-wordpress-rest-api.php
Last active January 31, 2023 07:42
CORS for the WordPress REST API
<?php
function my_customize_rest_cors() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: GET' );
header( 'Access-Control-Allow-Credentials: true' );
header( 'Access-Control-Expose-Headers: Link', false );

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@tomhazledine
tomhazledine / calculate_reading_time.php
Created November 16, 2016 08:30
Calculate Reading Time (for WordPress content)
<?php
/**
* READING TIME
*
* Calculate an approximate reading-time for a post.
*
* @param string $content The content to be measured.
* @return integer Reading-time in seconds.
*/
function reading_time( $content ) {
@efuller
efuller / array.md
Last active November 13, 2022 10:38
PHP Array isset and empty