Skip to content

Instantly share code, notes, and snippets.

View TudorSfatosu's full-sized avatar
☢️

Chris Tudor TudorSfatosu

☢️
View GitHub Profile
<?php
/*
* -----------------------------------------------------------------------------
* Advanced Custom Fields Modifications
* -----------------------------------------------------------------------------
*/
// Only the style is working, the script is not, it might introduce bugs, but it less likely as the scroll is always active in the textarea.
function PREFIX_apply_acf_modifications() {
?>
// Helpers - TO DELETE IN PROD -- Tudor
body.single-post::before {
position: fixed;
right: 0;
bottom: 0;
padding: 5px 10px;
background-color: rgba(0, 0, 0, 0.7);
color: #fff;
font-size: 12px;
z-index: 9999;
@TudorSfatosu
TudorSfatosu / mutliple-layers-blending-mode.html
Last active May 2, 2023 09:43
Creating mutliple layers blending mode #html
<!DOCTYPE html>
<html>
<head>
<title>Background Image Example</title>
<style>
.image-container {
background-image: url(triangle.png), linear-gradient(to bottom, #422039b8, #422039b8), url(bg.jpg);
background-blend-mode: soft-light, multiply, normal;
background-size: contain, auto, cover;
background-repeat: no-repeat, no-repeat, no-repeat;
@TudorSfatosu
TudorSfatosu / duplicate-custom-posts-works.php
Last active May 18, 2023 15:45
Duplicate custom post in Wordpress
<?php
// @snippet Duplicate posts and pages without plugins
// @author Misha Rudrastyh
// @url https://rudrastyh.com/wordpress/duplicate-post.html
// Add the duplicate link to action list for post_row_actions
// for "post" and custom post types
add_filter( 'post_row_actions', 'rd_duplicate_post_link', 10, 2 );
// for "page" post type
@TudorSfatosu
TudorSfatosu / disabling-acf-field-editing.php
Created May 2, 2023 09:05
Disabling the editing of an ACF field
<?php
// Disabling the editing of an ACF field
add_filter('acf/load_field', 'my_acf_load_field');
function my_acf_load_field($field) {
// Check if the field is named "event_id"
if ($field['name'] == 'event_id') {
// Set the "readonly" attribute to true
$field['readonly'] = true;
}
@TudorSfatosu
TudorSfatosu / acf-blocks.php
Created October 12, 2022 12:00 — forked from n7studios/acf-blocks.php
Advanced Custom Fields: Registering Custom Gutenberg Blocks
<?php
/**
* Plugin Name: Advanced Custom Fields: Gutenberg Blocks
* Plugin URI: https://www.n7studios.co.uk
* Version: 1.0.0
* Author: n7 Studios
* Author URI: https://www.n7studios.co.uk
* Description: Example code to register Advanced Custom Field Groups as Blocks. Requires ACF 5.8+
*/