Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Dragan Todorovic danyj

💭
I may be slow to respond.
View GitHub Profile
@danyj
danyj / ThzelGetElementSettings.php
Created May 17, 2019
Pull any Elementor options outside of Elementor
View ThzelGetElementSettings.php
/**
* @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 / yjsg.site.js
Created Mar 14, 2019
yjsg.site tooltip check
View yjsg.site.js
/**
* @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;
View thz_opengraph.php
<?php
function thz_opengraph() {
if (defined('WPSEO_VERSION')) {
// if Yoast
if (get_post_type() == 'docs') {
$og_img = 'CUSTOM IMAGE IF DOCS';
@danyj
danyj / script.js
Created Mar 4, 2019
Creatus Sections Slider Horizontal Demo
View script.js
$('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 / admin.js
Created Nov 24, 2018
Add info about WordPress featured image
View admin.js
(function($) {
$(document).ready(function() {
$('<span class="featured-img-info">Use an image 500x500px or larger</span>').appendTo('#postimagediv');
});
})(jQuery);
@danyj
danyj / thz_cpt_items_single_view_redirect.php
Created Nov 16, 2018
Register WordPress custom post type and tax, where single items view is redirected to 404 page but item archives are still accessible.
View thz_cpt_items_single_view_redirect.php
<?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}' ),
@danyj
danyj / thz_disable_gutenberg.php
Created Oct 25, 2018
Disable Gutenberg globally or for specific post types for WordPress 5.0 and UP
View thz_disable_gutenberg.php
<?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 / gist:797e36ddaceac64cffc7481717b6aa25
Last active Oct 15, 2018
Creatus WordPress Theme open popup on posts title click
View gist:797e36ddaceac64cffc7481717b6aa25
<script type="text/javascript">
(function($) {
$(document).ready(function($) {
$('.thz-grid-item-title').on('click',function(e){
e.preventDefault();
$(this).parents('.thz-grid-item-in').find('.thz-hover-icon').trigger('click');
});
});
View gist:9345fa171152c3f851117256caf93a5c
<?php
/**
* @package Thz Framework
* @author Themezly
* @websites http://www.themezly.com | http://www.youjoomla.com | http://www.yjsimplegrid.com
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // No direct access
}
View gist:009783f1513f342d318d73c993e2a36a
/**
* GA
*/
function _thz_action_add_ga(){
$GAcode = 'XX-XXXXXX-X'; // change with your GA tracking code
echo '<script async src="https://www.googletagmanager.com/gtag/js?id=UA-63305981-2"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(\'js\', new Date()); gtag(\'config\', \''.$GAcode.'\'); </script>';
}
add_action('wp_footer', '_thz_action_add_ga');
You can’t perform that action at this time.