Skip to content

Instantly share code, notes, and snippets.

View soyket's full-sized avatar
🎯
Focusing

Soyket Chowdhury soyket

🎯
Focusing
View GitHub Profile
@soyket
soyket / functions.php.php
Created July 13, 2023 21:37 — forked from blogjunkie/functions.php.php
Add custom fonts to Elementor from your theme
<?php // Don't include this line
/**
* Add new font group (Custom) to the top of the list
*/
add_filter( 'elementor/fonts/groups', function( $font_groups ) {
$new_font_group = array( 'custom' => __( 'Custom' ) );
return array_merge( $new_font_group, $font_groups );
} );
@soyket
soyket / elementor-custom-fonts.php
Created July 13, 2023 21:37 — forked from JoelEadeDesign/elementor-custom-fonts.php
Add theme fonts to Elementor' Style Font Family Select Menus
<?php
/**
* Elementor Custom Fonts
* Source: https://merianos.wordpress.com/2017/09/22/elementor-register-custom-font-family-in-the-fonts-control/
*/
function modify_controls( $controls_registry ) {
// First we get the fonts setting of the font control
$fonts = $controls_registry->get_control( 'font' )->get_settings( 'options' );
// Then we append the custom font family in the list of the fonts we retrieved in the previous step
@soyket
soyket / custom-css.php
Created April 24, 2023 14:54 — forked from iqbalrony/custom-css.php
How to add custom css control with elementor free version.
<?php
use Elementor\Controls_Manager;
use Elementor\Element_Base;
use Elementor\Core\Files\CSS\Post;
use Elementor\Core\DynamicTags\Dynamic_CSS;
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
@soyket
soyket / reverse wpautop
Created April 6, 2022 17:02
if you need to reverse the effect of wpautop you can use this function. you might need to do some modification in your usecase.
function reverse_wpautop( $string = '' ) {
/* return if string is empty */
if ( trim( $string ) === '' )
return '';
/* remove all new lines &amp; <p> tags */
$string = str_replace( array( "\n", "<p>" ), "", $string );
/* replace <br /> with \r */
@soyket
soyket / facet.html
Created January 24, 2021 08:20 — forked from djrmom/facet.html
facetwp reset button in elementor
<!--
Add elmentor button widget
Use link to #
Set class in advanced to .facetwp-reset-btn https://d.pr/i/b05YIM
Add following js, it can be added in an elementor html code widget (https://d.pr/i/Lat8Z4)
if you don't have a theme/plugin setting or custom code you are using
-->
<script>
(function($) {
$(document).on('click', '.facetwp-reset-btn', function(e) {
@soyket
soyket / custom-hooks.php
Created January 24, 2021 08:20 — forked from djrmom/custom-hooks.php
facetwp elementor cards elementor-has-item-raio class
<?php
/** re-adds elementor-has-item-radio afer refresh **/
add_action( 'wp_head', function() { ?>
<script>
(function($) {
$(document).on('facetwp-loaded', function() {
$('.facetwp-template .elementor-posts-container').addClass('elementor-has-item-ratio');
});
})(jQuery);
</script>
<?php
namespace Aepro;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
@soyket
soyket / code.php
Created April 8, 2020 18:18 — forked from dtbaker/code.php
Add a custom control to an existing Elementor widget
// This example will add a custom "select" drop down to the "Image Box"
// This will change the class="" on the rendered image box so we can style the Image Box differently
// based on the selected option from the editor.
// The class will be "my-image-box-style-blue" or "my-image-box-style-green" based on the selected option.
add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) {
if( $section->get_name() == 'image-box' && $section_id == 'section_image' ){
// we are at the end of the "section_image" area of the "image-box"
$section->add_control(
@soyket
soyket / custom-icon-add-to-elementor.php
Created July 11, 2019 09:51 — forked from iqbalrony/custom-icon-add-to-elementor.php
Adding custom icon to icon control in Elementor.
<?php
/**
* Adding custom icon to icon control in Elementor
*/
function modify_icon_controls($controls_registry) {
//3696 material design icon classes
$material_design_icons_cls = 'mdi mdi-access-point, mdi mdi-access-point-network, mdi mdi-access-point-network-off, mdi mdi-account, mdi mdi-account-alert, mdi mdi-account-alert-outline, mdi mdi-account-arrow-left, mdi mdi-account-arrow-left-outline, mdi mdi-account-arrow-right, mdi mdi-account-arrow-right-outline, mdi mdi-account-badge, mdi mdi-account-badge-alert, mdi mdi-account-badge-alert-outline, mdi mdi-account-badge-horizontal, mdi mdi-account-badge-horizontal-outline, mdi mdi-account-badge-outline, mdi mdi-account-box, mdi mdi-account-box-multiple, mdi mdi-account-box-outline, mdi mdi-account-card-details, mdi mdi-account-card-details-outline, mdi mdi-account-check, mdi mdi-account-check-outline, mdi mdi-account-child, mdi mdi-account-child-circle, mdi mdi-account-circle, mdi mdi-account-circle-outline, mdi mdi-account-clock, mdi mdi-account-clock-
@soyket
soyket / functions.php
Created May 28, 2018 08:17 — forked from wpbean/functions.php
Elementor adding new control
<?php
add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) {
if( $section->get_name() == 'section' && $section_id == 'section_layout' ){
$section->add_control(
'wpb_section_padding',
[
'label' => _x( 'Section Padding (top & bottom)', 'Section Control', 'wpb-plugins' ),
'type' => Elementor\Controls_Manager::SELECT,