Skip to content

Instantly share code, notes, and snippets.

View csaborio001's full-sized avatar

Christian Saborio csaborio001

View GitHub Profile
@adczk
adczk / smartcrawl-remove-onpage-seo-by-post-type.php
Created June 16, 2023 08:43
SmartCrawl - remove SmartCrawl SEO "onpage seo" metabox from post editor by selected post types
<?php
/**
* Plugin Name: SmartCrawl - remove "onpage seo" by post type
* Description: SmartCrawl - remove SmartCrawl SEO "onpage seo" metabox from post editor by selected post types
* Author: adczk
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*
* USE A MU PLUGIN
/**
* Add Oxygen's global colors to Gutenberg's backend editor palette
*/
function pavenum_gutenberg_oxygen_palette() {
$gutenberg_colors = [];
$oxy_colors = oxy_get_global_colors();
foreach( $oxy_colors['colors'] as $oxy_color) {
$gutenberg_colors[] = [ 'name' => $oxy_color['name'], 'slug' => 'color-' . $oxy_color['id'], 'color' => $oxy_color['value'] ];
@ericakfranz
ericakfranz / envira-gallery-remove-media-button.php
Created September 3, 2017 04:09
Remove the Add Gallery button on post / page edit screen.
@rveitch
rveitch / sync_acf_post_title.php
Last active December 7, 2022 21:40
Update WordPress post title from an ACF field value on save. (Advanced Custom Fields)
<?php
/**
* Update Post Title from an ACF field value on post save.
*
* Triggers on save, edit or update of published posts.
* Works in "Quick Edit", but not bulk edit.
*/
function sync_acf_post_title($post_id, $post, $update) {
$acf_title = get_field('my_acf_field_name', $post_id); // NOTE: enter the name of the ACF field here
@anttiviljami
anttiviljami / wp-admin-modal-dialog.php
Last active May 22, 2024 13:05
WordPress admin modal dialog example
<?php
// enqueue these scripts and styles before admin_head
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though...
wp_enqueue_style( 'wp-jquery-ui-dialog' );
?>
<!-- The modal / dialog box, hidden somewhere near the footer -->
<div id="my-dialog" class="hidden" style="max-width:800px">
<h3>Dialog content</h3>
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p>
@champsupertramp
champsupertramp / currency_list
Last active July 15, 2024 14:06 — forked from MindaugasR/currency_list
World Currency list in PHP Array
array (
'ALL' => 'Albania Lek',
'AFN' => 'Afghanistan Afghani',
'ARS' => 'Argentina Peso',
'AWG' => 'Aruba Guilder',
'AUD' => 'Australia Dollar',
'AZN' => 'Azerbaijan New Manat',
'BSD' => 'Bahamas Dollar',
'BBD' => 'Barbados Dollar',
'BDT' => 'Bangladeshi taka',
@bitflower
bitflower / dl-file.php
Last active October 18, 2023 18:00 — forked from hakre/dl-file.php
File protection depending on ACF (Advanced custom fields) field.
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+
@wesrice
wesrice / random-repeater.php
Created February 27, 2012 16:02
Return a random row of data from an ACF repeater field
<?php
// Get the repeater field
$repeater = get_field( 'repeater_field_name' );
// Get a random rows. Change the second parameter in array_rand() to how many rows you want.
$random_rows = array_rand( $repeater, 2 );
// Loop through the random rows if more than one is returned
if( is_array( $random_rows ) ){