This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WPML - Language selector | |
* Thierry Pigot | |
* | |
* return html | |
**/ | |
function tp_get_language_selector_flags() | |
{ | |
$languages = icl_get_languages('skip_missing=0'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Equal Height for html element */ | |
function equalHeight( group ) | |
{ | |
var tallest = 0; | |
var thisHeight = 0; | |
group.each(function() { | |
thisHeight = jQuery(this).height(); | |
if(thisHeight > tallest) { | |
tallest = thisHeight; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Thierry Pigot - A awesome plugin! | |
* Plugin URI: http://www.thierry-pigot.fr/tutoriel/722/traduire-header-plugin-wordpress/ | |
* Description: A brief description of the Plugin. | |
* Version:1.0 | |
* Author: Thierry Pigot | |
* Author URI: http://www.thierry-pigot.fr/ | |
* License: GPL2 | |
* Text Domain: tp-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
extract( shortcode_atts( array( | |
'wsp_exclude_pages' => trim(get_option('wsp_exclude_pages')), | |
'wsp_exclude_cpt_page' => get_option('wsp_exclude_cpt_page'), | |
'wsp_exclude_cpt_post' => get_option('wsp_exclude_cpt_post'), | |
'wsp_exclude_cpt_archive' => get_option('wsp_exclude_cpt_archive'), | |
'wsp_exclude_cpt_author' => get_option('wsp_exclude_cpt_author') | |
), $atts ) ); | |
// Exclude some pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Redirect non admin to front | |
**/ | |
add_action( 'admin_init', 'tp_demo_redirect_non_admin_users' ); | |
function tp_demo_redirect_non_admin_users() | |
{ | |
if ( ! current_user_can( 'manage_options' ) && '/wp-admin/admin-ajax.php' != $_SERVER['PHP_SELF'] ) { | |
wp_safe_redirect( home_url() ); | |
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hide adminbar to non admin | |
**/ | |
add_action('after_setup_theme', 'remove_admin_bar'); | |
function remove_admin_bar() | |
{ | |
if( ! current_user_can( 'manage_options' ) && !is_admin() && '/wp-admin/admin-ajax.php' != $_SERVER['PHP_SELF'] ) | |
{ | |
show_admin_bar(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('locale', 'tp_setLocale'); | |
function tp_setLocale($locale) { | |
if ( !is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'woocommerce_update_order_review' ) { | |
return 'it_IT'; | |
} | |
return $locale; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'] != '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_search_query( $query ) { | |
if( is_admin() && $query->is_main_query() && $query->query['post_type'] === 'revendeurs' && isset($query->query_vars['s']) ) | |
{ | |
$custom_fields = array( | |
// put all the meta fields you want to search for here | |
"raison_sociale", | |
); | |
$searchterm = $query->query_vars['s']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<style type="text/css"> | |
body {font-family: verdana, arial; font-size: 62.5%; margin: 0 auto; width: 80%;background-color: #f5f5f5;} | |
#container {background-color: #fff;padding:10px;margin:20px 0;} | |
h1{font-size: 3em;} | |
h2{font-size: 2em;} |
OlderNewer