Skip to content

Instantly share code, notes, and snippets.

View glueckpress's full-sized avatar

Caspar Hübinger glueckpress

View GitHub Profile
@bueltge
bueltge / gist:2304293
Created April 4, 2012 18:01
Remove hierarchy on WordPress Category meta box
add_action( 'add_meta_boxes', 'do_my_meta_boxes' );
function do_my_meta_boxes( $post_type ) {
remove_meta_box( 'my_taxonomydiv', $post_type, 'side' );
add_meta_box( 'my_taxonomydiv', 'My Taxonomy', 'my_meta_box', $post_type, 'side' );
}
function my_meta_box( $post, $meta_box ) {
$taxonomy = 'my_taxonomy';
$tax = get_taxonomy( $taxonomy );
@bueltge
bueltge / example.php
Created April 21, 2012 21:24
WordPress Widget Order via CSS; Here is a simple filter to automatically add a class attribute like widget-order-1 to all widgets within sidebars
add_action( 'init', 'add_widget_order_class' );
function add_widget_order_class() {
global $wp_registered_sidebars, $wp_registered_widgets;
$sidebars = wp_get_sidebars_widgets();
if ( empty( $sidebars ) )
return;
foreach ( $sidebars as $sidebar_id => $widgets ) {
@thefuxia
thefuxia / remove-admin-bar-wp-menu.php
Last active August 5, 2017 08:15
Remove WP Menu From Tool Bar
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Remove WP Menu From Tool Bar
*/
add_action( 'add_admin_bar_menus', function(){
remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu' );
});
@kovshenin
kovshenin / something.php
Created July 10, 2012 07:17
Yes, you can use printf and sprintf in WordPress too!
<?php
// Dirty, easy to miss a ' or " or .
echo '<a href="' . get_permalink() . '" class="link">' . get_the_title() . '</a>';
// Clean, easier to read
printf( '<a href="%s" class="link">%s</a>', get_permalink(), get_the_title() );
// Almost as clean, and more secure, maybe a little paranoic :)
printf( '<a href="%s" class="link">%s</a>', esc_url( get_permalink() ), esc_html( get_the_title() ) );
@johnpbloch
johnpbloch / README.md
Created August 23, 2012 13:55
A bash script to make .pot files for WordPress plugins

Installation

To install, you need to have the WordPress i18n library on your computer. Check it out using SVN:

sudo svn co http://i18n.svn.wordpress.org/tools/trunk/ /usr/lib/wpi18n

You don't have to put the library in /usr/lib/wpi18n, but if you don't put it there, make sure to set the $WP_I18N_LIB environment variable in your .bashrc file (with no trailing slash):

export WP_I18N_LIB="/path/to/i18n/lib"

@israelcurtis
israelcurtis / gist:3798347
Created September 28, 2012 06:57
Use the get_post_field() function to get any of the wp_posts column fields #wordpress #php
<?php
echo get_post_field('post_content', $post_id); // retrieve content
echo get_post_field('post_name', $post_id); // retrieve the slug
?>
@2ndkauboy
2ndkauboy / _respond-to-ie.scss
Last active October 13, 2015 00:28
A simple mixin that takes a target size and adds a min-width media query and a IE fallback given by a variable for the content.
@mixin respond-to-ie($size){
@if $old-ie {
@content;
} @else {
@media all and (min-width: $size) {
@content;
}
}
}
@aarongustafson
aarongustafson / watchResize.js
Last active September 16, 2019 14:37
Efficient callback management for window.onresize
(function( window ){
window.watchResize = function( callback ){
var resizing;
callback.size = 0;
function done()
{
var curr_size = window.innerWidth;
clearTimeout( resizing );
resizing = null;
// only run on a true resize
@franz-josef-kaiser
franz-josef-kaiser / client_admin_notices.php
Last active August 30, 2019 13:04
Gibt für Kunden Notizen über Änderungen zu WordPress im Adminbereich aus.
<?php
/**
* Plugin Name: Info zu WP-Änderungen
* Description: Informiert Kunden über Änderungen im WordPress Core, der Sprachdatei, etc.
* Version: 15122012.1423
* Author: Franz Josef Kaiser <wecodemore@gmail.com>
* Author URI: https://plus.google.com/107110219316412982437/posts
* License: The MIT License (MIT)
* LicenseURI: http://www.opensource.org/licenses/mit-license.php
*/

Installation

To install, you need to have the WordPress i18n library on your computer. Check it out using SVN:

sudo svn co http://i18n.svn.wordpress.org/tools/trunk/ /usr/lib/wpi18n

You don't have to put the library in /usr/lib/wpi18n, but if you don't put it there, make sure to set the $WP_I18N_LIB environment variable in your .bashrc or .bash_profile file (with no trailing slash):

export WP_I18N_LIB="/path/to/i18n/lib"