Skip to content

Instantly share code, notes, and snippets.

View dexit's full-sized avatar
🎯
Focusing

Rihards Mantejs dexit

🎯
Focusing
View GitHub Profile
<?php
/**
* prevent Elementor sections and containers from rendering on frontend if they are set to hide in all 3 responsive settings
*/
function do_not_render_hidden_sections( $should_render, $section ) {
// skip check if we are and editing
if ( is_admin() ) { return $should_render; }
@dexit
dexit / elementor_font_color.php
Created July 25, 2025 10:13 — forked from mehrshaddarzi/elementor_font_color.php
Add Default Global font and Color in Eleemntor plugin when new Active Theme
<?php
function set_elementor_global_colors_once() {
if ( ! get_option('my_theme_elementor_colors_set') ) {
$global_settings = \Elementor\Plugin::$instance->kits_manager->get_active_kit();
$global_settings->set_settings([
'system_colors' => [
'primary-color' => [
'title' => __('Primary Color', 'your-textdomain'),
'color' => '#1e73be',
@dexit
dexit / elementor-html-lazy-render.php
Created July 25, 2025 10:13 — forked from anthony9981/elementor-html-lazy-render.php
Lazy HTML Render for Elementor
<?php
function add_lazy_render_to_elementor_sections($element, $section_id, $args)
{
if (in_array($element->get_name(), ['section', 'container'])) {
if (!$element->get_controls('hiroman_lazy_render')) {
$element->start_controls_section('flying_press', [
'tab' => \Elementor\Controls_Manager::TAB_ADVANCED,
'label' => esc_html__('Lazy Render HTML', 'hiroman'),
]);
@dexit
dexit / shortcode_image_tag.php
Created July 25, 2025 10:11 — forked from finalwebsites/shortcode_image_tag.php
Add the shortcode option to dynamic tags for background images in Elementor
<?php
// place the snippet inside the functions.php file from your WordPress child theme
use Elementor\Controls_Manager;
add_action( 'elementor/dynamic_tags/register_tags', function( $dynamic_tags ) {
class Custom_Image_Tag extends Elementor\Core\DynamicTags\Data_Tag {
public function get_name() {
return 'shortcode-image';
}
@dexit
dexit / functions.php
Created July 25, 2025 10:11 — forked from cvl01/functions.php
Remove Elementor Pro search box settings query param
<?php
add_action('elementor_pro/search/before_input', function ($module) {
$module->remove_render_attribute('widget_props', 'name');
$module->remove_render_attribute('widget_props', 'value');
});
@dexit
dexit / custom.js
Created July 25, 2025 10:09 — forked from hmowais/custom.js
Add Sticky Header class in Elementor
jQuery( document ).ready(function($) {
jQuery(window).scroll(function($){
if ($(this).scrollTop() > 80) {
$('header.elementor-section').addClass('StickyHeader');
} else {
$('header.elementor-section').removeClass('StickyHeader');
}
});
});
@dexit
dexit / functions.php
Created July 25, 2025 10:08 — forked from hmowais/functions.php
Multiple Featured Images
<?php
// http://lifeonlars.com/wordpress/how-to-add-multiple-featured-images-in-wordpress/
// https://wp-qa.com/how-to-add-multiple-featured-image-upload-button-without-plugin-for-wordpress
// add these code in functions.php after add_theme_support( 'post-thumbnails' );
add_theme_support( 'post-thumbnails' );
add_image_size( 'case-image', 1371, 893, true );
add_image_size( 'ipad-image', 2383, 1867, true );
add_image_size( 'feature-image', 960, 500, true );
@dexit
dexit / functions.php
Created July 25, 2025 10:08 — forked from hmowais/functions.php
Add Taxonomy Image to Custom Post Type
<?php
//Add image field in taxonomy page
add_action( 'our_portfolio_category_add_form_fields', 'add_custom_taxonomy_image', 10, 2 );
function add_custom_taxonomy_image ( $taxonomy ) {
?>
<div class="form-field term-group">
<label for="image_id"><?php _e('Image', 'taxt-domain'); ?></label>
<input type="hidden" id="image_id" name="image_id" class="custom_media_url" value="">
@dexit
dexit / custom.js
Created July 25, 2025 10:08 — forked from hmowais/custom.js
Add Class in Section on Scroll
jQuery( document ).ready(function($) {
var sections = $('.animateiT'),
nav = $('.jump-left'),
nav_height = nav.outerHeight();
$(window).on('scroll', function() {
var cur_pos = $(this).scrollTop();
sections.each(function() {
var top = $(this).offset().top - 300;
var bottom = top + $(this).outerHeight();
if (cur_pos >= top && cur_pos <= bottom) {
@dexit
dexit / functions.php
Created July 25, 2025 10:08 — forked from hmowais/functions.php
Post Sync to other website with REST API
<?php
// Website 1
/* API for Post Sync */
function send_post_to_campus($post_id) {
if (wp_is_post_revision($post_id)) {
error_log('Skipping post revision ID: ' . $post_id);
return;