Skip to content

Instantly share code, notes, and snippets.

View DimaMinka's full-sized avatar
💻
CDK Computers - Modern Web Development

Dima Minka DimaMinka

💻
CDK Computers - Modern Web Development
View GitHub Profile
<?php
add_action( 'init', 'mysqlfix', -1 );
function mysqlfix() {
global $wpdb;
# Removed ONLY_FULL_GROUP_BY
$wpdb->set_sql_mode(['TRADITIONAL']);
}
echo test1
@DimaMinka
DimaMinka / act-settings-builder.php
Created September 25, 2019 09:11
Advanced Custom Fields Seetings with ACF Builder
<?php
/**
* Module name: Custom Settings
*
* @package ACF
* @see README.md for details
*/
use StoutLogic\AcfBuilder\FieldsBuilder;
@DimaMinka
DimaMinka / yoast_meta_thumb.php
Created July 5, 2019 17:17
Add meta thumbnail from the Facebook metabox field or from customizer logo field
/** Add meta thumbnail from the Facebook metabox field or from customizer logo field */
if ( ! function_exists( 'wpseo_meta_thumb' ) ) {
function wpseo_meta_thumb() {
$thumb_url = '';
if ( is_singular() && get_post_meta( get_the_ID(), '_yoast_wpseo_opengraph-image', 1 ) ) {
$thumb_url = get_post_meta( get_the_ID(), '_yoast_wpseo_opengraph-image', 1 );
} else {
$custom_logo_id = get_theme_mod( 'custom_logo' );
$image = wp_get_attachment_image_src( $custom_logo_id , 'thumbnail' );
$thumb_url = $image[0];
@DimaMinka
DimaMinka / tag-manager-body.php
Created May 13, 2019 21:11
Wordpress body class tag manager insert
<?php
add_filter( 'body_class', function ( $classes ) {
return array_merge(
$classes,
array( '">
<iframe src="//www.googletagmanager.com/ns.html?id=XXX-XXXXXX" height="0" width="0" style="display:none;visibility:hidden"></iframe>
<input type="hidden' // Important to handle the closing of the body element
)
);
@DimaMinka
DimaMinka / CDK GEO Redirect.php
Created March 11, 2019 08:44
simple redirect via CloudFlare country detection
/**
* Plugin Name: CDK GEO Redirect
* Description: Detect country via CloudFlare and redirect to same lang website version
* Plugin URI: https://cdk.co.il
* Author: cdk.co.il
* Version: 0.0.1
* Author URI: https://dimaminka.com
*
* Text Domain: cdk
*
#!/bin/bash
clear;
NOW=$(date +"%Y-%m-%d_%H-%M-%S_%z")
SPACE_NAME=global-uploads
DIGITAL_OCEAN_REGION=sfo2
AUTH_KEY=
AUTH_SECRET=
echo "******************************************************************************"
echo "BEGIN: $NOW"
echo "------------------------------------------------------------------------------"
@DimaMinka
DimaMinka / COMPOSER_AUTH_bitbucket.sh
Created January 3, 2019 20:45
COMPOSER_AUTH for bitbucket
export COMPOSER_AUTH='{"bitbucket-oauth":{"bitbucket.org":{"consumer-key":"","consumer-secret":""}}}'
@DimaMinka
DimaMinka / wp-image-placeholder.php
Created November 27, 2018 19:57 — forked from mihdan/wp-image-placeholder.php
Заменяет битые ссылки на кратинки в WordPress на заглушки. Удобно, например на тестовом сайте, чтобы не переносить фотки с боевого.
<?php
/**
* Plugin Name: Mihdan: Image Placeholder
*/
namespace Mihdan_Image_Placeholder;
$images = array(
// Обычные
'https://placeimg.com/640/480/animals',
@DimaMinka
DimaMinka / cherry-path-fix.php
Last active January 13, 2019 06:54
Cherry core url fix for bedrock app path
/**
* cherry_core_base_url fix for Bedrock path
*/
add_filter('cherry_core_base_url', function ($url) {
return str_replace(WP_CONTENT_DIR, '/../app', $url);
});