Skip to content

Instantly share code, notes, and snippets.

View netzgestaltung's full-sized avatar
🏠
Working from home

netzgestaltung

🏠
Working from home
View GitHub Profile
@damiencarbery
damiencarbery / how-not-to-use-wp-filter.php
Last active September 15, 2022 21:52
Use $wp_filter global to view functions attached to actions and filters
<?php
/*
Plugin Name: wp_filter functions
Plugin URI: http://www.damiencarbery.com/2017/06/list-functions-attached-to-an-action/
Description: List functions attached to all actions and filters. DON'T DO IT!
Author: Damien Carbery
Version: 0.1
*/
add_action( 'wp_head', 'wp_filter_the_wrong_way' );
@r-a-y
r-a-y / bp-page-title.php
Created June 13, 2016 05:53
Use page title as set in admin area on BP directory pages.
/**
* Use page title for BP directory pages.
*/
function my_set_bp_page_title() {
// Check to see if current reset post is a BP directory; if not, bail.
if ( false == in_array( $GLOBALS['post']->ID, bp_core_get_directory_page_ids() ) ) {
return;
}
// Use WP page title for the_title().
@zerosignalproductions
zerosignalproductions / admin.js
Last active November 21, 2018 17:16
Insert an image into the wordpress editor always wrapped in a figure tag. The javascript is used to remove the figure element from the editor if the delete button is used. Note that the inline edit does not work with this code.
(function($) {
$(document).ready(function() {
$('body').on('mousedown', '#wp_delimgbtn', function(e) {
var editor = tinyMCE.activeEditor,
element = editor.selection.getNode();
if(element.tagName !== 'FIGURE') {
$(element).parents('figure').remove();
}
});
@greglinch
greglinch / the_slug.php
Created December 5, 2012 04:28
create the_slug() function for WordPress
function the_slug($echo=true){
$slug = basename(get_permalink());
do_action('before_slug', $slug);
$slug = apply_filters('slug_filter', $slug);
if( $echo ) echo $slug;
do_action('after_slug', $slug);
return $slug;
}
// credit: http://www.tcbarrett.com/2011/09/wordpress-the_slug-get-post-slug-function/
@jaredatch
jaredatch / gist:3764391
Last active November 8, 2019 09:48
Redirect taxonomy to use archive template
<?php
/**
* Redirect taxonomy to use custom post type archive template
*
* @author Jared Atchison
* @link http://jaredatchison.com/code/
* @param string $template
* @return string
*/
function ja_template_redirect( $template ) {
@MatthewEppelsheimer
MatthewEppelsheimer / country-shortcode.php
Last active February 27, 2023 11:44
WP Contact Form 7 shortcode with list of Countries
<?php
/*
Localizations:
- [Spanish](https://gist.github.com/MatthewEppelsheimer/1498955#gistcomment-3317461) props @chdgp
UPDATED: 2020-03-09
@sbp
sbp / OpenSans.css
Created August 1, 2011 13:11
CSS for Open Sans
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 400;
src: local('Open Sans Italic'), local('Open-Sans-Italic'),
url('OpenSans-Italic.woff') format('woff'),
url('OpenSans-Italic.ttf') format('truetype');
}
@font-face {