Skip to content

Instantly share code, notes, and snippets.

View norewp's full-sized avatar

Zulfikar Nore norewp

View GitHub Profile
@norewp
norewp / single-elementor_library.php
Created February 21, 2018 11:05 — forked from pingram3541/single-elementor_library.php
Used in theme functions.php - set Elementor Library post type to use built-in Canvas template by default
/* ---------------------------------------------------------------------------
* Force Elementor Library to use Canvas Template
* - this gist file name can also be used in your theme to override the template instead of this
* --------------------------------------------------------------------------- */
function get_elementor_library_post_type_template( $single_template ) {
global $post;
if ($post->post_type == 'elementor_library') {
$single_template = dirname( __FILE__ ) . '/../../plugins/elementor/includes/page-templates/canvas.php';
}
<?php
return [
'&#xE84D;' => '3d_rotation',
'&#xE190;' => 'access_alarm',
'&#xE191;' => 'access_alarms',
'&#xE192;' => 'access_time',
'&#xE84E;' => 'accessibility',
'&#xE84F;' => 'account_balance',
'&#xE850;' => 'account_balance_wallet',
<?php
return [
'&#xf26e;' => 'fa-500px',
'&#xf2b9;' => 'fa-address-book',
'&#xf2ba;' => 'fa-address-book-o',
'&#xf2bb;' => 'fa-address-card',
'&#xf2bc;' => 'fa-address-card-o',
'&#xf042;' => 'fa-adjust',
'&#xf170;' => 'fa-adn',
@norewp
norewp / functions.php
Created January 10, 2018 23:45 — forked from lukecav/functions.php
Disable Elementor overview dashboard widget in WordPress
function disable_elementor_dashboard_overview_widget() {
remove_meta_box( 'e-dashboard-overview', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'disable_elementor_dashboard_overview_widget', 40);
@norewp
norewp / opineo-review.php
Last active January 2, 2018 16:38
Add Opineo code as a shortcode for use with WordPress
<?php
function opineo_review_func( $atts ) {
return readfile("https://www.opineo.pl/shop/latest.php?s=52913&w=500&n=4&secured=1");
}
add_shortcode( 'opineo', 'opineo_review_func' );
// Usage [opineo] in any shortcode supporting widget or content area
@norewp
norewp / elementor-accordion-closed.php
Last active April 17, 2018 10:59
Keep Accordions closed on page load
<?php
function elementor_accordion_closed() { ?>
<script>
jQuery(document).ready(function() {
jQuery( '.elementor-accordion .elementor-tab-title' ).removeClass( 'elementor-active' );
jQuery( '.elementor-accordion .elementor-tab-content' ).css( 'display', 'none' );
});
</script>
<?php }
@norewp
norewp / vid-bg-mob.css
Last active December 9, 2017 21:39
Render background video on mobile view
/*
* In the section which you have the video background add something like el-show-video-mobile to the CSS ID field
*
* Then apply this CSS rule in the Custom CSS box and you should have the background video showing on mobile
*
* NOTE: The class elementor-hidden-phone is hardcoded in Elementor Section's rendered output & this hack only overrides the CSS rule set on it.
*/
@media (max-width: 767px) {
body:not(.elementor-editor-active) #el-show-video-mobile > .elementor-background-video-container.elementor-hidden-phone {
<?php
function nore_home_logo() {
$centered_logo = '';
$handle = 'nore-style';
$custom_logo_id = get_theme_mod( 'custom_logo' );
$logo_render = wp_get_attachment_image_src( $custom_logo_id , 'full' );
$centered_logo .= 'header .main-navigation ul > li.my-site-logo a {background-image: url(' . esc_url( $logo_render[0] ) . ');}';
@norewp
norewp / elementor-canvas-scripts.php
Last active July 21, 2022 21:06
Custom scripts only on the Elementor Canvas template
<?php // You probably don't need to add this opening PHP tag!
function my_custom_canvas_scripts() {
$classes = get_body_class();
if ( in_array( 'page-template-elementor_canvas', $classes ) ) { ?>
<script type="text/javascript">
<!--[Custom Script]><!-->
//(function($) { //Uncomment this for no conflict jQuery
// Add your script here
@norewp
norewp / elementorcssinhead.php
Created October 16, 2017 19:47 — forked from nicomollet/elementorcssinhead.php
Load Elementor styles on all pages in the head to avoid CSS files being loaded in the footer
<?php
/**
* Load Elementor styles on all pages in the head to avoid CSS files being loaded in the footer
*/
function elementor_css_in_head(){
if(class_exists('\Elementor\Plugin')){
$elementor = \Elementor\Plugin::instance();
$elementor->frontend->enqueue_styles();
}
if(class_exists('\ElementorPro\Plugin')){