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
import domReady from '@roots/sage/client/dom-ready'; | |
+import {custom} from "@scripts/custom.js"; | |
/** | |
* Application entrypoint | |
*/ | |
domReady(async () => { | |
// application code | |
- | |
+ //custom(); |
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 | |
/* | |
Plugin Name: Posts FE | |
Description: Posts FE | |
Version: 1.0 | |
*/ | |
// Enregistrement du shortcode pour le formulaire | |
add_shortcode('mon_formulaire', 'mon_formulaire_shortcode'); |
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
In Style style.css add | |
Text Domain: ahmedsite | |
ahmedsite : the name of the theme | |
In functions.php | |
add_action('init', function() { | |
pll_register_string('ahmedsite', 'We are Testing Here'); |
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 | |
// directory | |
$directory=__DIR__ . '\gif'; | |
function replace_extension($filename, $extension) { | |
if (($pos = strrpos($filename , '.')) !== false) { | |
$filename = substr($filename, 0, $pos); | |
} | |
return $filename . '.' . $extension; |
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
add_action('wp_enqueue_scripts', 'customize_cf7_dequeue'); | |
function customize_cf7_enqueue($content) | |
{ | |
if (has_shortcode($content, 'contact-form-7') && function_exists('wpcf7_enqueue_styles')) { | |
$content = '<link href="' . esc_url(wpcf7_plugin_url('includes/css/styles.css') . '?ver=' . WPCF7_VERSION) . '" rel="stylesheet" type="text/css">' . | |
$content; | |
wpcf7_enqueue_scripts(); | |
} | |
return $content; |
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
/** | |
* Callback function that returns true if the current page is a WooCommerce page or false if otherwise. | |
* | |
* @return boolean true for WC pages and false for non WC pages | |
*/ | |
function is_wc_page() { | |
return class_exists( 'WooCommerce' ) && ( is_woocommerce() || is_cart() || is_checkout() || is_account_page() ); | |
} | |
add_action( 'template_redirect', 'conditionally_remove_wc_assets' ); |
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
if ( !is_user_logged_in() ) { | |
function sanitize_output($buffer) { | |
$search = array( | |
'/\>[^\S ]+/s', // strip whitespaces after tags, except space | |
'/[^\S ]+\</s', // strip whitespaces before tags, except space | |
'/(\s)+/s' // shorten multiple whitespace sequences | |
); | |
$replace = array( | |
'>', | |
'<', |
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
## VARVY_SCRIPT | |
<script type="text/javascript"> | |
function downloadJSAtOnload() { | |
var element = document.createElement("script"); | |
element.src = "defer.js"; | |
document.body.appendChild(element); | |
} | |
if (window.addEventListener) | |
window.addEventListener("load", downloadJSAtOnload, false); | |
else if (window.attachEvent) |
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
* Use Defer in javascript (Load Js scripts in order) | |
* Load Js in the Footer | |
* Use Tiny Png for optimizing images (useful in static and quasi static websites) | |
* Use CloudFlare | |
* Use LiteSpeedCache Server | |
* Use Litespeed Cache Plugin (Wordpress) | |
* Tools to Test Speed |
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 FieldName MetaBox | |
abstract class FieldName_Meta_Box { | |
/** | |
* Set up and add the meta box. | |
*/ | |
public static function add() { | |
$screens = [ 'posttypename' ]; |
NewerOlder