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
);
@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 / 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');
@temsool
temsool / disable accordion
Created October 14, 2018 11:26
disable/enable accordion widget functionality by JS ELEMENTOR
$( '.elementor-tab-title' ).prop('onfocus', null).off( 'focus' );
@temsool
temsool / wpautop.php
Created October 15, 2018 19:34
Enable wpautop wordpress elementor
<?php
add_action( 'elementor/widget/render_content', function( $content, $widget ) {
if ( 'text-editor' === $widget->get_name() ) {
$content =wpautop($content);
}
return $content;
}, 10, 2 );
@temsool
temsool / elementor-portfolio.php
Created October 30, 2018 14:37
portfolio dynamic hover caption post title
<?php
add_action('elementor/widget/render_content', function( $content, $widget ) {
$settings = $widget->get_settings();
if (strpos($settings['_css_classes'], "portfolio-image") !== false) {
$caption = get_the_title(get_the_ID());
$link=get_permalink(get_the_ID());
$content .= '<a class="portfolio-hover" target="_blank" href="'.$link.'">' . $caption . '</a>';
}
return $content;