This file contains 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 | |
/** | |
* Disable autodisplay after `the_content` | |
* @author Maxime Culea | |
*/ | |
function addtoany_disable_sharing_on_my_custom_post_type() { | |
return true; | |
} | |
add_filter( 'addtoany_sharing_disabled', 'addtoany_disable_sharing_on_my_custom_post_type' ); |
This file contains 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 | |
/** | |
* Deactivate almost all network options. | |
* @author Maxime Culea | |
*/ | |
add_filter( 'pre_site_option_state_modules', function () { | |
return [ | |
'class-Mlp_Cpt_Translator' => 'off', | |
'class-Mlp_Advanced_Translator' => 'off', | |
'class-Mlp_Alternative_Language_Title_Module' => 'off', |
This file contains 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 | |
/** | |
* Add default options for post type order. | |
* Custom cases with my post types, maybe use a filterable option. | |
* | |
* @author Maxime CULEA | |
*/ | |
add_filter( 'pto/get_options', function () { | |
return [ | |
'show_reorder_interfaces' => [ |
This file contains 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
$(window).scroll(function () { | |
// This is the div ( class="container-full site-info" ) not to overwrite | |
var footer_height = $(".container-full.site-info").outerHeight(); | |
// This it the button margin from bottom of the window | |
var margin_to_footer = 3; | |
// Dynamicly set the fixed bottom with the margin : | |
// - window height - ( footer div height + footermargin ) | |
// - just the footer margin |
This file contains 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 | |
// In one line, get the last day (date formatted in Y-m-d) of the previous current month | |
$last_day_of_previous_month = date( | |
'Y-m-d', | |
mktime( | |
0, | |
0, | |
0, | |
date( 'm' ) - 1, | |
date( 't', |
This file contains 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 | |
/** | |
* Check if is rest api or not | |
* | |
* @see : https://github.com/WP-API/WP-API/issues/926 | |
* | |
* @author Maxime CULEA | |
*/ | |
function mc_is_rest_api_request() { | |
return defined( 'REST_REQUEST' ) && REST_REQUEST; |
This file contains 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 | |
/** | |
* Set the IP address from the current visitor | |
* | |
* Maybe to be improved : | |
* @see https://github.com/BoiteAWeb/secupress/blob/master/inc/functions/ip.php#L5 | |
* | |
* @author Maxime CULEA | |
* | |
* @return string $ip |
This file contains 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 namespace BEA\CPT_Section; | |
/* | |
* /!\ Warnings /!\ | |
* - Only working with https://github.com/BeAPI/hm-rewrite class which must be loaded | |
* - PHP5.6+ | |
* - The custom "Post" class is loaded as model and used, so it would break your site if you don't delete the related code | |
* - There is a namesapce declared, you might not use it, so simply delete it | |
*/ |