Skip to content

Instantly share code, notes, and snippets.

View ablamohamedamine's full-sized avatar

Mohamed Amine Abla ablamohamedamine

View GitHub Profile
@vielhuber
vielhuber / Component.vue
Last active January 17, 2023 21:29
global helpers helper functions #vue
<template>
<div :test="$helpers.foo1()" :test2="bar()"></div>
</template>
<script>
import { bar } from '@/helpers/utils';
</script>
<?php
/**
*
* You can find the complete tutorial for this here:
* https://pluginrepublic.com/woocommerce-custom-fields
*
* Alternatively, check out the plugin
* https://pluginrepublic.com/wordpress-plugins/woocommerce-product-add-ons-ultimate/
*
@wreulicke
wreulicke / vue.patched.js
Last active November 16, 2022 15:25
After resolved, error component is rendered because of timeout.
/*!
* Vue.js v2.3.2
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.Vue = factory());
}(this, (function () { 'use strict';
@champsupertramp
champsupertramp / Ultimate Member - User meta shortcodes
Last active December 8, 2024 04:32
Ultimate Member - User meta shortcodes
/**
* Returns a user meta value
* Usage [um_user user_id="" meta_key="" ] // leave user_id empty if you want to retrive the current user's meta value.
* meta_key is the field name that you've set in the UM form builder
* You can modify the return meta_value with filter hook 'um_user_shortcode_filter__{$meta_key}'
*/
function um_user_shortcode( $atts ) {
$atts = extract( shortcode_atts( array(
'user_id' => get_current_user_id(),
'meta_key' => '',
@tripflex
tripflex / functions.php
Last active April 29, 2025 14:57
How to add additional email addresses when email is sent to WordPress admin_email option value
<?php
/**
*
* WARNING: this only checks if the email is being sent to the same email as admin_email option.
* If for some reason another email is sent to that same email address, but it's not meant as an "admin email"
* this filter will still add those additional emails, just something to keep in mind.
*/
add_filter( 'wp_mail', 'my_custom_to_admin_emails' );
@magnific0
magnific0 / wp_usermeta.md
Last active February 6, 2025 02:30
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 columns (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 fields 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).

<?php
/*-----------------------------------------------------------------------------------*/
/* Register theme options with polylang for language translations
/*-----------------------------------------------------------------------------------*/
array_map(function($option) {
if (!in_array($option['type'], array('textarea','text'))) {
return;
}
$val = get_option($option['id']) ?: $option['std'];
@madalinignisca
madalinignisca / wordpress-default.css
Created May 13, 2013 13:07
Default WordPress classes for using with CSS
/**
* Default Body Class Styles
*/
.rtl {}
.home {}
.blog {}
.archive {}
.date {}
.search {}
@netsi1964
netsi1964 / variousJS.js
Created March 13, 2013 20:50
Javascript: various javascript
function camelCase(selector) {
var cc = '';
[].forEach.call(document.querySelector(selector).value.split(' '), function(e) {
cc+=e.substr(0,1).toUpperCase()+e.substr(1,200).toLowerCase();
});
return cc;
}
@bradp
bradp / gist:4999343
Last active September 5, 2022 20:36
WordPress function to convert address to Lat/Long
<?php
function brrad_geocode($street_address,$city,$state){
$street_address = str_replace(" ", "+", $street_address); //google doesn't like spaces in urls, but who does?
$city = str_replace(" ", "+", $city);
$state = str_replace(" ", "+", $state);
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=$street_address,+$city,+$state&sensor=false";
$google_api_response = wp_remote_get( $url );