Skip to content

Instantly share code, notes, and snippets.

View temsool's full-sized avatar
🏠
Working from home

Mira temsool

🏠
Working from home
View GitHub Profile
@temsool
temsool / margin-padding.less
Last active November 21, 2015 09:09 — forked from mucsher/margin-padding.less
Function Less: Margin and Padding Utilities Class
// Define Style Margin - Padding
.marginAndPadding(@iterations)
{
.p0 {padding: 0px;}
.pT0{padding-top: 0px;}
.pR0{padding-right: 0px;}
.pB0{padding-bottom: 0px;}
.pL0{padding-left: 0px;}
.m0 {margin: 0px;}
@temsool
temsool / put-attachment-shortcode
Created September 22, 2018 10:27
Put attachment via shortcode in WordPress
function put_attachment_image($atts) {
$atts = shortcode_atts(
array(
'id' => '1',
'title' => get_the_title($atts['id']),
'alt' => get_the_title($atts['id']),
'class' => '',
'size' => 'full',
), $atts
);
<?php
if ( !function_exists( 'ch_hide_column_elementor_controls' ) ) {
add_action( 'elementor/element/before_section_end' , 'ch_hide_column_elementor_controls', 10, 3 );
function ch_hide_column_elementor_controls( $section, $section_id, $args ) {
if( $section_id == 'section_advanced' ) :
$section->add_control(
'hide_desktop_column',
[
'label' => __( 'Hide On Desktop', 'elementor' ),
@temsool
temsool / dequeue-fontawesome-elementor.php
Last active April 15, 2021 07:58
How dequeue fontawesome elementor
<?php
add_action( 'wp_print_styles', 'dequeue_font_awesome_style' );
function dequeue_font_awesome_style() {
wp_dequeue_style( 'font-awesome' );
wp_deregister_style( 'font-awesome' );
}
?>
@temsool
temsool / lineawesome-elementor.php
Created September 27, 2018 14:09
Replace LineAwesome with Fontawesome for specific widgets
<?php
add_action('elementor/widget/render_content', function( $content, $widget ) {
$settings = $widget->get_settings();
if (strpos($settings['_css_classes'],"lineawesome")!==false) {
$content= str_replace('fa', 'la', $content);
}
/* Add Image Stretch Option Control to the Image Gallery Widget */
add_action( 'elementor/element/before_section_end', function( $element, $section_id, $args ) {
/** @var \Elementor\Element_Base $element */
if ( 'image-gallery' === $element->get_name() && 'section_gallery' === $section_id ) {
$element->add_control(
'image_stretch',
[
'label' => __( 'Image Stretch', 'elementor' ),
'type' => \Elementor\Controls_Manager::SELECT,
@temsool
temsool / Image ratio on featured image widget elementor.php
Created October 4, 2018 19:57
Image ratio on featured image widget elementor
@temsool
temsool / schema.php
Created October 5, 2018 21:13
Schema.org addtions for better SEO - Function for WordPress
/**
* Schema.org addtions for better SEO
* @param string Type of the element
* @return string HTML Attribute
*/
function get_schema_markup($type, $echo = false) {
if (empty($type)) return false;
@temsool
temsool / elementor gravatar fix.php
Created October 9, 2018 09:45
elementor gravatar fix
<?php
add_filter('get_avatar_url', function( $url, $id_or_email, $args ) {
if (is_email($id_or_email)) {
$user = get_user_by('email', $id_or_email);
$user_id = $user->ID;
} else {
$user_id = $id_or_email;
}
if (has_wp_user_avatar($user_id)) {
return get_wp_user_avatar_src($user_id, 'writer-avatar');