Skip to content

Instantly share code, notes, and snippets.

🚀

Pascal Martineau lewebsimple

🚀
Block or report user

Report or block lewebsimple

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lewebsimple
lewebsimple / custom-server.js
Created Aug 11, 2019
Nuxt custom server listen override
View custom-server.js
import { Listener } from '@nuxt/server'
export default function () {
this.nuxt.server.listen = async (port, host, socket) => {
await this.nuxt.ready()
const listener = new Listener({
port: isNaN(parseInt(port)) ? this.options.server.port : port,
host: host || this.options.server.host,
socket: socket || this.options.server.socket,
@lewebsimple
lewebsimple / acf-dynamic-role.php
Created Aug 10, 2017
ACF role-based conditions on user new / edit forms
View acf-dynamic-role.php
<?php
// Change default role dynamically on role selection change
add_action( 'acf/input/admin_head', 'acf_dynamic_default_role' );
function acf_dynamic_default_role() {
global $pagenow;
if ( $pagenow == 'user-new.php' ) {
?>
<script>
@lewebsimple
lewebsimple / functions.php
Created Mar 23, 2017
WPML + ACF synchronization
View functions.php
function sync_field_meta( $post_id, $post, $update ) {
$post_type = get_post_type($post_id);
// use this if u have muti custom post type
$posts_type = array('your_custom_post_type1', 'your_custom_post_type2', 'your_custom_post_type3', 'your_custom_post_type4');
if( ! in_array($post_type, $posts_type)) return;
$en = apply_filters( 'wpml_object_id', $post_id, 'any', FALSE, 'en' );
$fr = apply_filters( 'wpml_object_id', $post_id, 'any', FALSE, 'fr' );
@lewebsimple
lewebsimple / dropdown-hover.js
Created Mar 20, 2017
[Bootstrap 4] Dropdown navbar menu on hover
View dropdown-hover.js
// Dropdown navbar menu on hover
$('.dropdown-menu', this).css('margin-top', 0);
$('.dropdown').hover(function () {
$('.dropdown-toggle', this).trigger('click').toggleClass("disabled");
});
You can’t perform that action at this time.