This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyTheme | |
{ | |
private function actionAfterSetup($function) | |
{ | |
add_action('after_setup_theme', function() use ($function) { | |
$function(); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- wp:paragraph --> | |
<p><a href="https://gist.github.com/bph/335ddef358bb41efdcd159cbc76f582e">https://gist.github.com/bph/335ddef358bb41efdcd159cbc76f582e</a></p> | |
<!-- /wp:paragraph --> | |
<!-- wp:heading {"className":"eplus-oOhLNH"} --> | |
<h2 class="eplus-oOhLNH">Common Blocks / Formatting / Layout Elements / Widgets and Embeds</h2> | |
<!-- /wp:heading --> | |
<!-- wp:list {"className":"eplus-eI3gin"} --> | |
<ul class="eplus-eI3gin"><li><a href="#images">Images</a> (Single image, cover image, gallery </li><li><a href="#quotes">Pull Quote / Quote</a></li><li><a href="#verse">Verse</a></li><li><a href="#buttons">Buttons</a></li><li><a href="#socialicons" data-type="internal" data-id="#socialicons">Social Icons</a></li><li><a href="#columns">Columns </a> Text (only) columns / Columns experimental</li><li><a href="#cover" data-type="internal" data-id="#cover">Cover</a> with CAT + button</li><li><a href="#paragraphs">Paragraph</a> </li><li><a href="#audio">Audio</a> </li><li><a href="#video">Video</a></li><li><a href="#w |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Polylang Language API functions tester - WordPress | |
* Github: https://gist.github.com/icetee/fbbfef5534fead58611e | |
* | |
*/ | |
function ex_pll_the_languages($arg = '') { | |
if ( function_exists('pll_the_languages') ) { | |
return pll_the_languages($arg); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Allow to remove method for an hook when, it's a class method used and class don't have variable, but you know the class name :) | |
* source: https://github.com/herewithme/wp-filters-extras | |
* More: http://wordpress.stackexchange.com/questions/57079/how-to-remove-a-filter-that-is-an-anonymous-object | |
*/ | |
function remove_filters_for_anonymous_class( $hook_name = '', $class_name ='', $method_name = '', $priority = 0 ) { | |
global $wp_filter; | |
// Take only filters on right hook name and priority | |
if ( !isset($wp_filter[$hook_name][$priority]) || !is_array($wp_filter[$hook_name][$priority]) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('DOMContentLoaded', function(event) { | |
var $ = jQuery; | |
if (!$('body').hasClass('wp-admin')) { | |
$(window).on('loads scroll', function() { | |
var element = $('.counter'); | |
var top_of_element = element.offset().top; | |
var bottom_of_element = element.offset().top + element.outerHeight(); | |
var bottom_of_screen = $(window).scrollTop() + $(window).innerHeight(); | |
var top_of_screen = $(window).scrollTop(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add a products per-page select dropdown to archive - above shop productloop | |
add_action( 'woocommerce_before_shop_loop', 'pro_selectbox', 30 ); | |
function pro_selectbox() { | |
$per_page = filter_input(INPUT_GET, 'perpage', FILTER_SANITIZE_NUMBER_INT); | |
$orderby_options = array( | |
'16' => '16', | |
'32' => '32', | |
'64' => '64', | |
'96' => '96' | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_shortcode( 'randomizer_product_category_tag_attribute', 'randomizer_product_category_tag_attribute_func' ); | |
function randomizer_product_category_tag_attribute_func( ){ | |
$attribute = get_field('attributy', 'attributes'); | |
$taxonomy = array(); | |
$id = array(); | |
if(!empty($attribute)){ | |
foreach ($attribute as $term) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( | |
'acf/input/admin_footer', | |
static function () { | |
?> | |
<script type="text/javascript"> | |
(function ($) { | |
acf | |
.add_filter( | |
'wysiwyg_tinymce_settings', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Modify Tiny_MCE init | |
add_filter('tiny_mce_before_init', 'tmy_modify_tinyMCE4', 10, 2 ); | |
/** | |
* Filter TinyMCE4 Init args. | |
*/ | |
function tmy_modify_tinyMCE4( $mceInit, $editor_id ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Use ACF image field as avatar | |
* @author Mike Hemberger - Thank you, Mike :) | |
* @link http://thestizmedia.com/acf-pro-simple-local-avatars/ | |
* @uses ACF Pro image field (tested return value set as Array ) | |
*/ | |
add_filter('get_avatar', 'tsm_acf_profile_avatar', 10, 5); | |
function tsm_acf_profile_avatar( $avatar, $id_or_email, $size, $default, $alt ) { |