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 | |
/** | |
* Escape by preserving the newlines : <br /> | |
* By applying wp_kses on a textarea | |
* | |
* @param $string | |
* | |
* @return mixed | |
* @author Maxime CULEA | |
*/ |
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 | |
if ( ! function_exists( 'get_field' ) ) { | |
add_action( 'template_redirect', 'template_redirect_warning_missing_acf', 0 ); | |
function template_redirect_warning_missing_acf() { | |
wp_die( sprintf( 'This theme can\'t work without ACF plugin. <a href="%s">Please login to admin</a>, and activate it !', wp_login_url() ) ); | |
} | |
} |
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 | |
/** | |
* Get the given post_id excerpt | |
* @param $post_id | |
* | |
* @return string | |
* @author Maxime CULEA | |
*/ | |
public static function get_the_excerpt( $post_id ) { | |
$post = get_post( $post_id ); |
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 | |
/** | |
* Generate tiny url | |
* | |
* @author Maxime Culea | |
* | |
* @param string $post_id | |
* | |
* @return string | |
*/ |
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 class BEA_ACF_Customizer_Plugin { | |
/** | |
* Register hooks | |
*/ | |
public function __construct() { | |
add_filter( 'acf/fields/relationship/query/name=space_port_page', array( __CLASS__, 'space_port_page' ), 10, 3 ); | |
add_filter( 'acf/fields/relationship/query/name=timeline_page', array( __CLASS__, 'timeline_page' ), 10, 3 ); | |
} |
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_filter( 'user_has_cap', 'bea_add_edit_comment', 10, 4 ); | |
/** | |
* Allow users to edit their own comments | |
* | |
* @param array $allcaps An array of all the user's capabilities. | |
* @param array $caps Actual capabilities for meta capability. | |
* @param array $args Optional parameters passed to has_cap(), typically object ID. | |
* @param \WP_User $user The user object. | |
* |
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 | |
/** | |
* Change post type single slug | |
*/ | |
add_filter( 'register_post_type_args', 'bea_edit_page', 20, 2 ); | |
function bea_edit_page( $args, $post_type ) { | |
if ( 'page' !== $post_type ) { | |
return $args; | |
} |
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
/** | |
* Easily delete locotranslate backup po/mo, while originals are gitted. | |
* No need to keep them. | |
* | |
* @author Maxime CULEA | |
*/ | |
find ./ -type f -name "*.po~" -exec git clean -df {} + | |
find ./ -type f -name "*.mo~" -exec git clean -df {} + | |
find ./ -type f -name "*.pot~" -exec git clean -df {} + | |
find ./ -type f -name "*.json" -exec rm -rf {} + |
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
wp core language list --field=language | xargs -n 1 wp core language install |
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 | |
/** | |
* Load the theme textdomain | |
* | |
* @author Maxime CULEA | |
*/ | |
public static function mc_load_theme_textdomain() { | |
load_theme_textdomain( self::textdomain, get_template_directory() . '/languages' ); | |
} | |
add_filter( 'acf/settings/export_textdomain', 'mc_load_theme_textdomain' ); |
OlderNewer