Skip to content

Instantly share code, notes, and snippets.

View jennybeaumont's full-sized avatar

Jenny Beaumont jennybeaumont

View GitHub Profile
@jjeaton
jjeaton / .gitignore
Created August 5, 2015 01:54
WordPress root .gitignore. Ignore everything and then opt-in (exclude from the ignore) for your custom code.
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@thierrypigot
thierrypigot / admin-search-filter.php
Created November 19, 2014 17:11
Dans l'admin, étendre la recherche des Custom Post Type aux métas, en plus du titre et de la description.
<?php
/*
* Dans cet exemple mon Custom Post Type est "revendeurs"
*/
add_filter('posts_join', 'revendeurs_search_join' );
function revendeurs_search_join ($join){
global $pagenow, $wpdb;
// I want the filter only when performing a search on edit page of Custom Post Type named "revendeurs"
if ( is_admin() && $pagenow=='edit.php' && $_GET['post_type']=='revendeurs' && $_GET['s'] != '')
@willybahuaud
willybahuaud / translate-taxonomy-slug.php
Last active February 13, 2020 18:38
Translate Taxonomy base slug wpml
<?php
add_action( 'init', 'register_my_taxo' );
function register_my_taxo() {
register_taxonomy( 'immo_cat', 'immobilier', array(
'hierarchical' => false,
'label' => 'Type de biens',
// je déclare le slug de taxo de manière à pouvoir le traduire
'rewrite' => array( 'slug' => icl_t('nebula', 'property-type-slug', 'type-bien-immobilier' ) ),
) );
}
@jjeaton
jjeaton / functions.php
Created May 5, 2013 20:06
Remove current_page_parent class from Blog menu item when using custom post types and add class for the post type menu item. Hardcodes the menu-item title for each.
<?php
add_filter( 'nav_menu_css_class', 'je_portfolio_menu_item_classes', 10, 2 );
/**
* Add css classes to Portfolio CPT menu item, remove from Blog item
*
* Enables menu classes for CPTs.
* Pretty fragile, as it depends on the item titles for each menu item, change as required
*
* @param array $classes CSS classes for the menu item