Skip to content

Instantly share code, notes, and snippets.

View FacundoGamond's full-sized avatar

Facundo Gamond FacundoGamond

View GitHub Profile
@FerFuego
FerFuego / custom_trim_excerpt.php
Last active February 5, 2021 18:32
Trim text, strip shortcodes and excerpt return - Wordpress
/**
* Trim text, strip shortcodes and excerpt return
*
* @param Int $post - Post ID (optional)
* @param String $text - Text or get_the_conten() (optional)
* @param Int $words - Number of words to return
*
* @return string - "Ex: This is my text trim and..."
*
* Use: echo custom_trim_excerpt($post_id, '', 20 );
@hereswhatidid
hereswhatidid / custom-acf-wysiwyg-css.php
Last active September 27, 2022 15:27
Applies defined CSS classes to the ACF WYSIWYG editor so that you can individually style them.
<?php
function hwid_acf_admin_footer() {
?>
<script>
( function( $) {
acf.add_filter( 'wysiwyg_tinymce_settings', function( mceInit, id ) {
// grab the classes defined within the field admin and put them in an array
var classes = $( '#' + id ).closest( '.acf-field-wysiwyg' ).attr( 'class' );