Skip to content

Instantly share code, notes, and snippets.

View yehudaTiram's full-sized avatar

Yehuda Tiram yehudaTiram

View GitHub Profile
/*
* Tired of typing a search term in my cooking blog just to find that I typed in Latin keys instead of Hebrew. See here https://yehuda-tiram.com/
* This code will replace every Latin character in WordPress search textbox with its Hebrew equivalent.
* The const hash can be changed to any language as needed.
* The search textbox element document.getElementsByName('s') can be changed to anything else.
*/
add_action('wp_footer', 'atr_latin_to_hebrew_key');
function atr_latin_to_hebrew_key()
{
?>
@yehudaTiram
yehudaTiram / wp_usermeta.md
Created August 19, 2021 09:44 — forked from KostasKrv/wp_usermeta.md
Show and Edit User Meta in Wordpress

#Show and Edit User Meta in Wordpress

Description

This simple procedure will allow you to:

  1. Display user meta fields under in the user list as additional columsn (Users > All Users).
  2. Display these fields on user profiles.
  3. Edit these fields under user edit.

This method works completely without plugins and involves just some functions and hooks in functions.php. Plugins like "User Meta Display" achieve this to some level, but treat custom meta fiedlds completely different from the regular fields. They are shown and edited in seperate environment and fail to show the meta data is a table list. This method integrates custom user meta along with regular user (meta).

@yehudaTiram
yehudaTiram / search_replace_jpg_dnn.php
Last active March 17, 2020 14:18
Replace the file name in IMG SRC in any size of text OR just file name with Wordpress correct file name
<h2>קבלו רעיונות ליום כיף לעובדים לעונת האביב והקיץ בצפון</h2>
<h3>יום כיף לעובדים: שטח בירה ומה שבניהם <strong>15515</strong></h3>
<div>
<div>
נצא ליום כיף לעובדים באזור סובב כנרת ודרום הגולן, בתכנית מבחר פעילות גיבוש וכיף הכוללות: ארוחת בוקר מפנקת, טיול שטח בנהיגה עצמית, טיול מים כייפי ומרענן בשמורה נפלאה, סיור וטעימות בירה בוטיק מתוצרת מקומית בגולן ולסיום ארוחת צהריים מפנקת במסעדת בשרים בגולן.
<img src="/wp-content/uploads/2020/02/יום-גיבוש-לעובדים-בירה-בשר-וטיול-שטח.jpg" alt="יום גיבוש לעובדים- בירה מים ושמיים" />
</div>
@yehudaTiram
yehudaTiram / Super simple background image slideshow.css
Created June 23, 2018 22:55 — forked from mhulse/Super simple background image slideshow.css
Super simple jQuery background-image random slideshow (using CSS3 for the transition and gets the image paths via HTML5 `data` attribute).
[data-slides] {
background-image: url(../../uploads/banner1.jpg); /* Default image. */
background-repeat: no-repeat;
background-position: center top;
background-size: cover;
transition: background-image 1s linear;
}
/* Use additional CSS to control the `height` of `[data-slides]`, like so: */
(function ($) {
'use strict';
/*
background slider
*/
$('#background-slider1').attr('data-slides1', '["http://site.com/wp-content/uploads/2018//05/32-1.jpg","http://site.com/wp-content/uploads/2018//05/33-1.jpg","http://site.com/wp-content/uploads/2018//05/38-1.jpg","http://site.com/wp-content/uploads/2018//05/39-1.jpg","http://site.com/wp-content/uploads/2018//05/26-1.jpg","http://site.com/wp-content/uploads/2018//05/16-1.jpg","http://site.com/wp-content/uploads/2018//05/56-1.jpg"]');
var slide1 = $("[data-slides1]"),
count = 0,
slides1 = slide1.data("slides1"),
len = slides1.length,
@yehudaTiram
yehudaTiram / gist:9f4006c885c9d65edd01873262db4c7b
Last active April 9, 2018 06:10
Using filters to change ATR Woo Global Price Options plugin display of price options list in single product page
/* https://wordpress.org/plugins/atr-woo-global-price-options/ */
/* You can use this filters to change the display of the price options list */
/* Note the different filters for each part */
/* For the Header */
add_filter( 'atr_gpo_before_price_options', 'test_before_price_options', 20 );
function test_before_price_options(){
$price_options_header = '<div class="atr-price-options-wrap"><p class="gpo-before-price-options">THIS IS THE HEAD OF THE LIST</p>';
return $price_options_header;
}
@yehudaTiram
yehudaTiram / Theme X - Moving Product Image Thumbnails to bottom
Last active February 3, 2018 17:30
Theme X - Moving Product Image Thumbnails to bottom
/* Theme X - Moving Product Image Thumbnails to bottom */
.woocommerce .flex-control-nav.flex-control-thumbs {
position: relative;
width: 100%;
text-align: left;
padding-left: 0;
padding-right: 0;
}
.flex-control-nav.flex-control-thumbs img {
height: 4.5em;