Skip to content

Instantly share code, notes, and snippets.

View danyj's full-sized avatar
💭
I may be slow to respond.

Dragan Todorovic danyj

💭
I may be slow to respond.
View GitHub Profile
@danyj
danyj / admin.js
Created November 24, 2018 19:16
Add info about WordPress featured image
(function($) {
$(document).ready(function() {
$('<span class="featured-img-info">Use an image 500x500px or larger</span>').appendTo('#postimagediv');
});
})(jQuery);
@danyj
danyj / script.js
Created March 4, 2019 12:08
Creatus Sections Slider Horizontal Demo
$('body').on('mousewheel DOMMouseScroll', function(e){
if(typeof e.originalEvent.detail == 'number' && e.originalEvent.detail !== 0) {
if(e.originalEvent.detail > 0) {
console.log('Down');
$('.thz-sections-slider .slick-next').trigger('click');
} else if(e.originalEvent.detail < 0){
console.log('Up');
$('.thz-sections-slider .slick-prev').trigger('click');
}
} else if (typeof e.originalEvent.wheelDelta == 'number') {
@danyj
danyj / thz_opengraph.php
Created March 12, 2019 12:10
thz_opengraph
<?php
function thz_opengraph() {
if (defined('WPSEO_VERSION')) {
// if Yoast
if (get_post_type() == 'docs') {
$og_img = 'CUSTOM IMAGE IF DOCS';
@danyj
danyj / yjsg.site.js
Created March 14, 2019 12:34
yjsg.site tooltip check
/**
* @package YJSG Framework
* @copyright Copyright(C) since 2007 Youjoomla.com. All Rights Reserved.
* @author YouJoomla
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
* @websites http://www.youjoomla.com | http://www.yjsimplegrid.com
*/
;window.onerror = function(msg, url, line, col, error) {
var extra = !col ? '' : '\ncolumn: ' + col;
extra += !error ? '' : '\nerror: ' + error;
@danyj
danyj / ThzelGetElementSettings.php
Created May 17, 2019 11:41
Pull any Elementor options outside of Elementor
/**
* @package Thz Framework
* @author Themezly
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
* @websites http://www.themezly.com | http://www.youjoomla.com | http://www.yjsimplegrid.com
*/
class ThzelGetElementSettings {
@danyj
danyj / thz_disable_gutenberg.php
Created October 25, 2018 09:15
Disable Gutenberg globally or for specific post types for WordPress 5.0 and UP
<?php
/*
* Disable Gutenberg globally
* use this if you prefer one-liner
* add_filter('use_block_editor_for_post', '__return_false');
*/
function _thz_filter_disable_block_editor(){
return false;
}
add_filter( 'use_block_editor_for_post', '_thz_filter_disable_block_editor' );
@danyj
danyj / thz_cpt_items_single_view_redirect.php
Created November 16, 2018 22:21
Register WordPress custom post type and tax, where single items view is redirected to 404 page but item archives are still accessible.
<?php
// post type
function cpt_items_register() {
$cpt_labels = array(
'name' => _x( 'Items', 'Post Type General Name', '{domain}' ),
'singular_name' => _x( 'Item', 'Post Type Singular Name', '{domain}' ),
'menu_name' => esc_html__( 'Items', '{domain}' ),
'name_admin_bar' => esc_html__( 'Page Block', '{domain}' ),