Skip to content

Instantly share code, notes, and snippets.

View theodorocaliari's full-sized avatar
💻

Theodoro Caliari theodorocaliari

💻
View GitHub Profile
<?php
/**
* Count number of widgets in a sidebar
* Used to add classes to widget areas so widgets can be displayed one, two, three or four per row
*/
function slbd_count_widgets( $sidebar_id ) {
// If loading from front page, consult $_wp_sidebars_widgets rather than options
// to see if wp_convert_widget_settings() has made manipulations in memory.
global $_wp_sidebars_widgets;
<?php
/**
* Get posts and group by taxonomy terms.
* @param string $posts Post type to get.
* @param string $terms Taxonomy to group by.
* @param integer $count How many post to show per taxonomy term.
*/
function list_posts_by_term( $posts, $terms, $count = -1 ) {
$tax_terms = get_terms( $terms, 'orderby=name');
foreach ( $tax_terms as $term ) {
@theodorocaliari
theodorocaliari / #Customize WordPress Admin Menu for Users.md
Last active August 29, 2015 14:03 — forked from fjarrett/gist:5224398
Customize Wordpress Admin Menu for Users

Hide metaboxes in WordPress Dashboard

<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
<?php
add_filter( 'option_active_plugins', 'activate_local_plugins' );
/**
* Add our local plugins to the list of active plugins.
*/
function activate_local_plugins( $plugins ) {
if ( '127.0.0.1' == $_SERVER['SERVER_ADDR'] ) {
$local_plugins = array(
'wordpress-beta-tester/wp-beta-tester.php',
'wordpress-importer/wordpress-importer.php',
<?php
/* Removes Wordpress Default Gallery css
------------------------------------------------------------ */
add_filter( 'use_default_gallery_style', '__return_false' );

Remove WordPress generator meta tag

Capitalise titles in WordPress