Skip to content

Instantly share code, notes, and snippets.

/*
* Disable Gutenberg globally
*/
add_filter( 'use_block_editor_for_post', '__return_false' );
/*
* Disable Gutenberg for specific post types
*/
function disable_block_editor_cpt( $use_block_editor, $post_type ){
if( 'page' == $post_type || 'post' == $post_type){
@artikus11
artikus11 / functions.php
Created October 10, 2018 12:16
Изменение интервала автосохранения в Gutenberg
add_filter( 'block_editor_settings', function ($settings){
$settings['autosaveInterval'] = 60;
return $settings;
} );
//Supprimer les scripts et css de la page d'accueil
function remove_scripts_home() {
if (is_home()){
wp_dequeue_script( 'script_handle' );
wp_deregister_script( 'script_handle' );
}
}
add_action('wp_print_scripts', 'remove_scripts_home', 100);
@ebetancourt
ebetancourt / wp-disable-plugin-update.php
Last active March 29, 2024 13:03 — forked from rniswonger/wp-disable-plugin-update.php
WordPress - Disable specific plugin update check
<?php
// have to add that opening tag to get syntax highlighting... ¯\_(ツ)_/¯
/**
* Prevent update notification for plugin
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
* Place in theme functions.php or at bottom of wp-config.php
*/
function disable_plugin_updates( $value ) {
@Web1776
Web1776 / custom_acf_excerpt.php
Last active November 19, 2021 11:22
Generate excerpts from ACF field values if there is no post content
<?php
/*
* Generate excerpts from ACF field values if there is no post content
* @param string $post_excerpt The post excerpt.
* @param WP_Post $post Post object.
*/
function custom_acf_excerpt( $post_excerpt, $post ){
// Return the existing excerpt if it's not empty
if( !empty(trim($post_excerpt)) ){
@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
@danielmcclure
danielmcclure / page_builder.php
Created February 26, 2018 04:32
Remove Genesis Theme Page Structure for Full Page Display with Page Builders
<?php
/**
* Template Name: Blank Page Builder Template
*/
/** Exit if accessed directly */
if ( ! defined( 'ABSPATH' ) ) exit( 'Not Today' );
add_filter( 'body_class', 'js_add_landing_body_class' );
@polodev
polodev / laragon_website_listing
Created February 3, 2018 19:07
laragon_website_listing.txt
<?php
$dirs = array_filter(glob('*'), 'is_dir');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>all links</title>
<style>
body {
@lukecav
lukecav / functions.php
Last active April 3, 2024 23:20
Logout of WordPress without confirmation message
function getLogoutUrl($redirectUrl = ''){
if(!$redirectUrl) $redirectUrl = site_url();
$return = str_replace("&amp;", '&', wp_logout_url($redirectUrl));
return $return;
}
/**
* Bypass logout confirmation on nonce verification failure
*/
function logout_without_confirmation($action, $result){
@alexxxseo
alexxxseo / Ajax Login Form
Created June 14, 2017 19:07
Wordpress Ajax Login Form
<?php
// Wordpress Ajax Login Form
// Source: http://www.sutanaryan.com/custom-user-login-signin-using-ajax-wordpress/
//html
<div class="userLogin">
<?php
// check if the user already login