Skip to content

Instantly share code, notes, and snippets.

View herewithme's full-sized avatar
🎯
Focusing

Amaury Balmer herewithme

🎯
Focusing
View GitHub Profile
@bjornjohansen
bjornjohansen / default.vcl
Created May 11, 2016 23:25
Varnish 4.0 VCL for WordPress
vcl 4.0;
import std;
import directors;
backend server1 { # Define one backend
.host = "localhost";
.port = "8080";
.max_connections = 300;
@VirtuBox
VirtuBox / wordpress-hack.md
Created November 6, 2019 14:45 — forked from andersevenrud/wordpress-hack.md
wordpress-hack.md

Wordpress is a very popular target for hackers. They normally get in with holes found in plugins, themes or in wordpress core.

Prevention methods

An up-to-date installation (including plugins and themes) is crutial!

Hardening Wordpress is sadly not a part of the standard installation documentation, but they have a guide available in the "codex": http://codex.wordpress.org/Hardening_WordPress

Removing unused plugins and users, setting htpasswd and/or ip-whitelisting in //wp-admin// also should be considered.

@andersevenrud
andersevenrud / wordpress-hack.md
Created March 5, 2016 19:37
wordpress-hack.md

Wordpress is a very popular target for hackers. They normally get in with holes found in plugins, themes or in wordpress core.

Prevention methods

An up-to-date installation (including plugins and themes) is crutial!

Hardening Wordpress is sadly not a part of the standard installation documentation, but they have a guide available in the "codex": http://codex.wordpress.org/Hardening_WordPress

Removing unused plugins and users, setting htpasswd and/or ip-whitelisting in //wp-admin// also should be considered.

<?php
// Set these dependant on your BB credentials
$username = 'username';
$password = 'password';
$branch = 'master';
// FTP Credentials
@ain
ain / log.php
Created February 23, 2012 19:47
tail functionality in PHP
<?php
// full path to text file
define("TEXT_FILE", "/home/www/default-error.log");
// number of lines to read from the end of file
define("LINES_COUNT", 10);
function read_file($file, $lines) {
//global $fsize;
@psaikali
psaikali / 0readme.md
Last active January 25, 2021 21:17
Créer un formulaire ACF "multi-étapes" : chaque groupe de champs (type "Groupe") est une étape du formulaire

Démonstration en vidéo

Explications

option

  • Créer un groupe de champs ACF et activer l'option "Multi-étapes"
  • Créer des champs de type "Groupe" et les remplir des sous-champs nécessaires. Chaque champ "Groupe" sera une étape à part entière dans le formulaire.
  • Insérer le formulaire front-end avec acf_form en ajoutant les 2 champs de types hidden (acf_multisteps_form & acf_multistep_current_step).
  • Enjoy !
@kylephillips
kylephillips / favorites-display.php
Last active October 14, 2022 19:33
Using the Favorites get_user_favorites() function to display favorited post data in a custom format
<?php
// Method 1: simple foreach loop
$favorites = get_user_favorites();
if ( isset($favorites) && !empty($favorites) ) :
foreach ( $favorites as $favorite ) :
// You'll have access to the post ID in this foreach loop, so you can use WP functions like get_the_title($favorite);
endforeach;
endif;
@hlashbrooke
hlashbrooke / class.php
Created February 28, 2014 08:37
A complete, versatile options page class for any WordPress plugin
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
class WordPress_Plugin_Template_Settings {
private $dir;
private $file;
private $assets_dir;
private $assets_url;
private $settings_base;
@floptwo
floptwo / php-cli_ovh_mutu.md
Last active April 25, 2023 08:40
OVH PHP-CLI

PHP-CLI (PHP en ligne de commande) sur les hébergements mutualisés OVH

More complete info here http://cluster015.ovh.net/infos/ (thanks to @42antoine)

(cli)

/usr/local/php5.3/bin/php => PHP 5.3.29 (cli) (built: Nov 21 2017 08:55:07)
/usr/local/php5.4/bin/php => PHP 5.4.45 (cli) (built: Nov 21 2017 08:35:51)
/usr/local/php5.5/bin/php => PHP 5.5.38 (cli) (built: Nov 21 2017 08:46:45)
@viktorbijlenga
viktorbijlenga / .htaccess
Last active September 21, 2023 22:41
load images from a different Wordpress enviroment
# place above all other rewrite rules if using a CMS or program that redirects all request to index.php file (e.g. WordPress, Drupal, Laravel, etc...)
# if a file or directory does not exist on the local host, 302 redirect the request to the production host so the browser doesn't cache the file in case you replace the file locally
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect WordPress uploads
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule wp-content/uploads/(.*)$ http://REPLACEWITHYOURDOMAIN.COM/wp-content/uploads/$1 [R=302,L,NC]
</IfModule>