Skip to content

Instantly share code, notes, and snippets.

View lincolnlemos's full-sized avatar

Lincoln Lemos lincolnlemos

View GitHub Profile
@tylerlwsmith
tylerlwsmith / acf-google-maps.php
Created April 11, 2018 11:08
JavaScript-free implementation of Google Maps with WordPress Advanced Custom Fields
<?php
/**
* Set constants for Google Maps JS API key--used for ACF's backend map--and Google Maps
* Embed API Key, used for generating maps on the site front end.
*
* @link https://developers.google.com/maps/documentation/javascript/get-api-key
* @link https://developers.google.com/maps/documentation/embed/get-api-key
*/
const GOOGLE_MAPS_JS_API_KEY = 'MAPS-JS-API-KEY';
@ollietreend
ollietreend / acf-php-to-json.php
Last active April 22, 2024 11:12
Convert Advanced Custom Fields Pro configuration from PHP to JSON.
<?php
/**
* Plugin Name: Convert ACF PHP to JSON
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON.
*/
namespace ConvertAcfPhpToJson;
/**
* Add submenu item under 'Custom Fields'
@keesiemeijer
keesiemeijer / setup-phpunit.sh
Last active December 8, 2023 11:02
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, curl wget, rsync, git, subversion and composer.
#
# WordPress is installed in the `/tmp/wordpress` directory for use by PHPUnit.
# The WordPress test suite is installed in the `/tmp/wordpress-tests-lib` directory.
@cjmosure
cjmosure / functions.php
Last active June 12, 2019 10:11
WP-PageNavi - Bootstrap 4
<?php
/**
* Clean up pagination
*/
add_filter( 'wp_pagenavi', __NAMESPACE__ . '\\gc_pagination', 10, 2 );
function gc_pagination($html) {
$out = '';
$out = str_replace('<div','',$html);
$out = str_replace('class=\'wp-pagenavi\'>','',$out);
@Jany-M
Jany-M / wp_ics.php
Last active September 19, 2023 03:15 — forked from jakebellacera/ICS.php
[WP] Generate a downloadable .ics file from any WordPress post or custom post type
<?php
/*
For a better understanding of ics requirements and time formats
please check https://gist.github.com/jakebellacera/635416
*/
// UTILS
// Check if string is a timestamp
@omurphy27
omurphy27 / bootstrap collapse accordion with ACF repeater loop.php
Last active December 3, 2019 14:39
bootstrap collapse accordion with ACF repeater loop.php
<?php if( have_rows('faqs') ): ?>
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<?php $i=1; while ( have_rows('faqs') ) : the_row(); ?>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading-<?php echo $i; ?>">
<h2 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse-<?php echo $i; ?>" aria-expanded="true" aria-controls="collapseOne">
<?php the_sub_field('question'); ?>
</a>
</h2>
@calliaweb
calliaweb / modify-tinymce-editor-to-remove-h1.php
Last active August 3, 2023 16:00
Modify TinyMCE editor to remove H1
<?php
// Do NOT include the opening php tag above
add_filter('tiny_mce_before_init', 'tiny_mce_remove_unused_formats' );
/*
* Modify TinyMCE editor to remove H1.
*/
function tiny_mce_remove_unused_formats($init) {
// Add block format elements you want to show in dropdown
$init['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Address=address;Pre=pre';
@bueltge
bueltge / gist:757903
Created December 28, 2010 23:27
This WordPress Plugin demonstrates how you can build your own plugin pages using the WordPress provided draggable metaboxes, requires WordPress 2.7 version, supports WordPress 2.8 changed boxing layout engine
<?php
/*
Plugin Name: HowTo Plugin
Plugin URI:
Description: This Plugin demonstrates how you can build your own plugin pages using the WordPress provided draggable metaboxes, requires WordPress 2.7 version, supports WordPress 2.8 changed boxing layout engine
Author: Heiko, Frank
Author URI: http://bueltge.de
Version: 0.1
License: