Skip to content

Instantly share code, notes, and snippets.

View Jimmylet's full-sized avatar

Jimmy Letecheur Jimmylet

View GitHub Profile
## ADD ACF
### install in bedrock
https://roots.io/guides/using-acf-builder-with-sage/
## ADD SAGE DIRECTIVES
### install in sage
https://github.com/Log1x/sage-directives
## ADD SVG
### install in sage
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class Role
{
/**
/* In functions.php, paste this code (replace YOUR_THEME_NAME by your theme name) */
/* Use this code with the plugin Theme and plugin translation for Polylang */
if (class_exists('Polylang_Theme_Translation')) {
class Sage_Polylang_Theme_Translation extends Polylang_Theme_Translation
{
/**
* Constructor.
*/
/* In sage/resources/assets/build/webpack.config.js */
/*new webpack.LoaderOptionsPlugin({
test: /\.js$/,
options: {
eslint: { failOnWarning: false, failOnError: true },
},
}),*/
/*new StyleLintPlugin({
failOnError: !config.enabled.watcher,
/* Add these lines to /sage/respirces/functions.php */
/* Generate custom menu array */
function b_get_menu_id( $location )
{
$a = get_nav_menu_locations();
if (isset($a[$location])) return $a[$location];
return false;
}
function b_get_menu_items( $location )
/* Add these lines to /sage/app/filters.php */
/**
* Use a custom vue for search form in Wordpress when call function get_search_form()
* Create also a view searchform in "partials" for make the form.
*
*/
add_filter('get_search_form', function () {
return \App\template( 'partials.searchform' );
});
<?php
//get the taxonomy terms of custom post type
$customTaxonomyTerms = wp_get_object_terms( $post->ID, 'category', ['fields' => 'ids'] );
//query arguments
$args = [
'post_type' => 'customer',
'post_status' => 'publish',
'posts_per_page' => 3,
// Disable guttenberg for entire wordpress website
add_filter('use_block_editor_for_post', '__return_false', 10);
add_filter('use_block_editor_for_post_type', '__return_false', 10);
/* REMOVE EMOJIS */
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
/* Activer compression GZIP dans le .htaccess */
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE "application/atom+xml" \
"application/javascript" \