Skip to content

Instantly share code, notes, and snippets.

View thierrypigot's full-sized avatar

Thierry Pigot thierrypigot

View GitHub Profile
@thierrypigot
thierrypigot / WP admin
Last active August 22, 2016 16:09
Bookmark to go in the WordPress Admin. Add a new Bookmark and copy this in the URL field ;)
javascript:( function(){ with(window.open('http://'+window.location.host+'/wp-admin','_blank')){ document.close(); } })()
@thierrypigot
thierrypigot / scripts.js
Last active July 6, 2023 19:26
[Beaver Builder] Highlight menu links on a One Page with anchor links and sections detection on scroll
(function($){
$(document).ready(function(){
/**
* This part handles the highlighting functionality.
* We use the scroll functionality again, some array creation and
* manipulation, class adding and class removing, and conditional testing
*/
var aChildren = $("header ul.menu li").children(); // find the a children of the list items
@thierrypigot
thierrypigot / tp_toolbox.php
Created October 3, 2016 18:41
Functions WordPress.
<?php
/**
* Display taxonomy selection as radios
*
* @param WP_Post $post
* @param array $box
*/
if( !function_exists('tp_taxonomy_radio_meta_box') ) {
function tp_taxonomy_radio_meta_box($post, $box) {
@thierrypigot
thierrypigot / tp_toolbox.php
Last active June 10, 2020 16:45
WordPress: Register taxonomy hack WordPress. In the register_taxonomy function, add : $args = array( 'meta_box_cb' => 'tp_taxonomy_radio_meta_box' );
<?php
/**
* Display taxonomy selection as radios
*
* @param WP_Post $post
* @param array $box
*/
if( !function_exists('wearewp_taxonomy_radio_meta_box') ) {
function wearewp_taxonomy_radio_meta_box($post, $box) {
<?php get_header(); ?>
<?php $hierarchical_keywords = get_query_var( 'hierarchical_keywords' ); ?>
<div class="fl-archive container">
<div class="row">
<?php FLTheme::sidebar('left'); ?>
<div class="fl-content <?php FLTheme::content_class(); ?>" itemscope="itemscope" itemtype="http://schema.org/Blog">
@thierrypigot
thierrypigot / functions.php
Last active February 18, 2018 22:45
Get all entries for WordPress attachments on attachment archive page
<?php
add_filter( 'register_post_type_args', 'tp_change_attachment_post_type_args', 10, 2 );
function tp_change_attachment_post_type_args($args, $post_type){
if( 'attachment' == $post_type ){
$args['has_archive'] = true;
$args['rewrite'] = array( 'slug' => 'media' );
}
return $args;
}
@thierrypigot
thierrypigot / acf-polylang.php
Created January 5, 2017 20:31
Add polylang support to ACF fields group
<?php
add_filter('pll_get_post_types', 'wearewp_add_acf_pll', 10, 2);
function wearewp_add_acf_pll( $post_types, $is_settings ) {
$post_types[] = 'acf-field-group';
return $post_types;
}
@thierrypigot
thierrypigot / install-wp.sh
Last active March 20, 2025 17:42
Local by flywheel - Custom WordPress install script
#!/usr/bin/env bash
while ! mysqladmin ping --silent; do
sleep 1
done
if mysql -e "SELECT USER(),CURRENT_USER();" -proot 2> /dev/null
then
echo "mysql password: root"
mysql -e "DROP DATABASE IF EXISTS local; CREATE DATABASE local;" -proot
@thierrypigot
thierrypigot / functions.php
Last active August 13, 2017 15:48
Add custom google font to Beaver Builder theme
<?php
// Add this function in the functions.php of your theme
add_filter( 'fl_theme_google_fonts', 'wearewp_theme_google_fonts' );
function wearewp_theme_google_fonts( $google ){
// Add a font from https://fonts.google.com/ : font name => font size (100, 200...)
$google['Saira'] = array(
"100",
"200",
"400",
@thierrypigot
thierrypigot / joke.php
Last active September 16, 2017 08:27
WordCamp Marseille 2017 - Les contenus personnalisés dans WordPress - Fichier d'exemple
<?php
/*
Plugin Name: Jokes
Plugin URI: https://www.wearewp.pro
Description: Manage jokes
Author: WeAre[WP]
Author URI: https://www.wearewp.pro
Text Domain: waw-joke
Domain Path: /languages/
Version: 1.0