Skip to content

Instantly share code, notes, and snippets.

View Niq1982's full-sized avatar

Niku Hietanen Niq1982

View GitHub Profile
@TeemuSuoranta
TeemuSuoranta / fix-acf-menu-fields-to-polylang.php
Created March 11, 2021 13:51
Fix ACF menu location rules to work on all Polylang locales
<?php
/**
* Fix ACF menu location rules to work on all Polylang locales
*
* Polylang registers localized variations to menu locations and by default
* ACF cannot hook to all of them unless they are manually all picked.
* Polylang separates location with three undescores (eaxmple: primary___en).
*
* This hook automatically applies all menu location rules to all languages.
* Works for both nav_menu and nav_menu_item related fields.
@danielck
danielck / migrate-comments.php
Created May 12, 2017 10:58
WP-CLI script to migrate comment likes from Comments Rating Pro to WP Ulike
<?php
/*
Plugin Name: Migrate comment likes
Version: 0.1
Description: Migrate comment likes from WP Comment Rating Pro to Ulike
Author: Daniel Koskinen / Zeeland Family
Author URI: http://wordpress.zeelandfamily.fi/
*/
if ( defined( 'WP_CLI' ) && WP_CLI ) {
/**
* Add support for correct UTF8 orderby for post_title (äöå)
*
* @param string $orderby ordering clause for query
*
* @return string ordering clause for query
*/
add_filter('posts_orderby', function($orderby) use ($wpdb) {
if(strstr($orderby, 'post_title')) {
( function( $ ) {
// ******************************
// * facebook.js
// *
// * @author Digitoimisto Dude Oy
// * @version 03.11.2016
// ******************************
$(document).ready(function() {
@jplhomer
jplhomer / disable-comments.sh
Created February 25, 2015 16:38
Disable all comments/pings in WordPress with WP-CLI
$ wp post list --format=ids | xargs wp post update --comment_status=closed
# Output:
# Success: Updated post 2514.
# Success: Updated post 2511.
# Success: Updated post 2504.
# Success: Updated post 2499.
# Success: Updated post 2441.
# etc...