Skip to content

Instantly share code, notes, and snippets.

View mjot's full-sized avatar

Martin Jäcke mjot

View GitHub Profile
@frankiejarrett
frankiejarrett / unautop-func.php
Last active April 6, 2022 16:57
Inverse behavior to the wpautop() function found in WordPress
<?php
/**
* Replaces paragraph elements with double line-breaks.
*
* This is the inverse behavior of the wpautop() function
* found in WordPress which converts double line-breaks to
* paragraphs. Handy when you want to undo whatever it did.
*
* @see wpautop()
@carlodaniele
carlodaniele / food-example-plugin.php
Last active August 22, 2021 09:00
An example plugin for WPMU DEV readers
<?php
/**
* @package Food_example_plugin
* @version 1.0
*/
/*
Plugin Name: Food example plugin
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin for WPMU DEV readers
Author: Carlo Daniele
@vielhuber
vielhuber / script.js
Last active September 22, 2017 23:12
change hover to click in Advanced Menu #shopware
$(document).ready(function() {
$('.navigation-main .navigation--entry').off();
$('.navigation-main .navigation--entry').click(function() {
if( $(this).hasClass('is--hovered') ) {
$(this).removeClass('is--hovered');
$('.advanced-menu .menu--is-active').removeClass('menu--is-active');
return false;
}
else {
$(this).siblings('.is--hovered').removeClass('is--hovered');
@jameslaws
jameslaws / get_form_id_name.php
Created November 18, 2015 13:59
Ninja Forms - Get all form IDs and Names
<?php
$forms = Ninja_Forms()->form()->get_forms();
foreach ( $forms as $form ) {
$form_id = $form->get_id();
$form_name = $form->get_setting( 'title' );
// Do more stuff
}
@shyim
shyim / Gulpfile.js
Last active November 27, 2018 11:05
Gulp Shopware with browser-sync
function basename(path) {
return path.split('/').reverse()[0];
}
var gulp = require('gulp'),
less = require('gulp-less'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
path = require('path'),
fs = require('fs'),
@wpmark
wpmark / cpt-archive-show-all-posts.php
Last active June 8, 2018 06:13
Pre Get Posts to Show All Posts for Custom Post Type Archive
<?php
function wpmark_alter_team_archive_template_query( $query ) {
/* only proceed on the front end */
if( is_admin() ) {
return;
}
/* only on the person post archive for the main query */
if ( $query->is_post_type_archive( 'wpmark_person' ) && $query->is_main_query() ) {
@joech4n
joech4n / Configure Postfix for Gmail SMTP in Mac OSX.md
Last active November 22, 2024 18:59 — forked from larrybotha/readme.markdown
Configure Postfix for Gmail SMTP in Mac OSX
@billerickson
billerickson / functions.php
Created August 17, 2014 23:06
Using flexible content from ACF without ACF functions.
<?php
$rows = get_post_meta( get_the_ID(), 'be_content', true );
foreach( $rows as $count => $row ) {
switch ( $row ) {
case 'type_1':
$content = get_post_meta( get_the_ID(), 'be_content_' . $count . '_field_name', true );
echo '<div class="type-one">' . wpautop( $content ) . '</div>;
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active November 27, 2024 13:36
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.