View gist:bfbcac57ee963f3874268421b509409c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { get } from 'lodash'; | |
import { select, useSelect } from '@wordpress/data'; | |
const image = useSelect( () => select( 'core' ).getMedia( id ) ); | |
const thumbnail = get( image, [ 'media_details', 'sizes', 'medium', 'source_url' ] ); |
View gist:65c51612e73129191ae88d637b738d34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function get_tax_by_term($use_var) { | |
if ( ! $this->all_terms ) { | |
$this->all_terms = get_transient('all_terms_' . $this->post_type ); | |
if ( ! $this->all_terms ) { | |
$taxonomy_names = get_object_taxonomies( $this->post_type ); | |
$this->all_terms = []; | |
foreach ( $taxonomy_names as $taxonomy_name ) { | |
$terms = get_terms( [ | |
'taxonomy' => $taxonomy_name, |
View gist:bdacd363d575cbd963b010923aa1fb44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Do not edit this file | |
# It will be overwritten each time nginx-rc upgrade | |
# Editing this file manually might break RunCloud System | |
# If you think there is a bug, contact us at bug@runcloud.io | |
worker_processes auto; | |
worker_rlimit_nofile 65535; | |
user runcloud-www runcloud-www; | |
pid /run/nginx-rc.pid; | |
pcre_jit on; |
View gist:1ac870c84f51124e08cf54686630405d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################################### | |
# Rocket-Nginx | |
# | |
# Rocket-Nginx is a NGINX configuration to speedup your WordPress | |
# website with the cache plugin WP-Rocket (http://wp-rocket.me) | |
# | |
# Author: Maxime Jobin | |
# URL: https://github.com/maximejobin/rocket-nginx | |
# | |
# Tested with WP-Rocket version: 3.0.5.1 |
View gist:c81f10472cfdd403cf608068b0f054d7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// don't load directly | |
if (!defined('ABSPATH')) die('-1'); | |
class CreditznatokAddwiki | |
{ | |
private static $_instance; | |
static function getInstance() |
View gist:8693534c6375c93418e5135330fc72b8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function move_term_to_top( $orderby, $query_vars, $taxonomies ) { | |
if ( 'my_taxonomy' === reset( $taxonomies ) ) { | |
$orderby = "(CASE WHEN t.name = 'My Top Term' THEN 1 ELSE t.name END)"; | |
} | |
return $orderby; | |
} | |
add_filter( 'get_terms_orderby', 'move_term_to_top', 10, 3 ); |
View gist:92e89a3247b2cdf06f5e80e8af6eea7e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* SVG upload fix for wp 4.7.1 | |
* | |
* @link https://wordpress.org/support/topic/wp-4-7-1-kills-svg/page/4/ | |
* | |
*/ | |
add_filter('wp_check_filetype_and_ext', 'ignore_upload_ext', 10, 4); | |
function ignore_upload_ext($checked, $file, $filename, $mimes) | |
{ |
View gist:09dcb8488019cd57e4aa91eafd234c24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('wp_check_filetype_and_ext', 'ignore_upload_ext', 10, 4); | |
function ignore_upload_ext($checked, $file, $filename, $mimes){ | |
//we only need to worry if WP failed the first pass | |
if(!$checked['type']){ | |
//rebuild the type info | |
$wp_filetype = wp_check_filetype( $filename, $mimes ); | |
$ext = $wp_filetype['ext']; | |
$type = $wp_filetype['type']; | |
$proper_filename = $filename; |
View gist:9ac640e275a22ab0f9f8738704cc3727
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ru-RU"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Вводное ДЗ по курсу PHP</title> | |
</head> | |
<body> | |
<?php |