<![CDATA[Teknotit Snipet Manager tarfst: Snippets: wordpress]]>http://snipet.teknotit.com/index.php <![CDATA[Affectation et comparaison]]> if ( false === ( $results = get_transient( 'transient_key_name' ) ) ) { $results = ...; // Do the slow query to get the results here // 60 * 60 is the expiration in seconds - in this case, 3600 seconds (1 hour) set_transient( 'transient_key_name', $results, 60 * 60 ); }]]> Thu, 17 May 2018 03:38:19 +0000 <![CDATA[parametre url admin wordpress]]> array( 'message', 'updated', 'settings-updated', 'saved', 'activated', 'activate', 'deactivate', 'locked', 'skipped', 'deleted', 'trashed', 'untrashed', );]]> Sun, 13 Mar 2016 16:44:08 +0000 <![CDATA[Ajout d'un admin worpress via FTP]]> function add_admin_acct(){ $login = 'admin'; $passw = 'passe'; $email = 'tarfst@gmail.com'; if ( !username_exists( $login ) && !email_exists( $email ) ) { $user_id = wp_create_user( $login, $passw, $email ); $user = new WP_User( $user_id ); $user->set_role( 'administrator' ); } } add_action('init','add_admin_acct'); ]]> Fri, 10 Jul 2015 05:49:59 +0000 <![CDATA[Wordpress RSS]]> Personnaliser le flux RSS – WordPress]]> Thu, 11 Dec 2014 04:58:54 +0000 <![CDATA[How to rewrite URI of custom post type]]> add_filter('post_type_link', 'wpse33551_post_type_link', 1, 3); function wpse33551_post_type_link( $link, $post = 0 ){ if ( $post->post_type == 'product' ){ return home_url( 'product/' . $post->ID ); } else { return $link; } } add_action( 'init', 'wpse33551_rewrites_init' ); function wpse33551_rewrites_init(){ add_rewrite_rule( 'product/([0-9]+)?$', 'index.php?post_type=product&p=$matches[1]', 'top' ); }]]> Thu, 20 Nov 2014 19:04:12 +0000 <![CDATA[disable autosave wordpress]]> function disableAutoSave(){ wp_deregister_script('autosave'); } add_action( 'wp_print_scripts', 'disableAutoSave');]]> Mon, 03 Nov 2014 13:34:24 +0000 <![CDATA[List hooked functions]]> function list_hooked_functions($tag=false){ global $wp_filter; if ($tag) { $hook[$tag]=$wp_filter[$tag]; if (!is_array($hook[$tag])) { trigger_error("Nothing found for '$tag' hook", E_USER_WARNING); return; } } else { $hook=$wp_filter; ksort($hook); } echo '<pre>'; foreach($hook as $tag => $priority){ echo "<br />>>>>>t<strong>$tag</strong><br />"; ksort($priority); foreach($priority as $priority => $function){ echo $priority; foreach($function as $name => $properties) echo "t$name<br />"; } } echo '</pre>'; return; }]]> Wed, 22 Oct 2014 20:12:09 +0000 <![CDATA[Nettoyer la section Head wordpress]]> // functions.php // Remove links to the extra feeds (e.g. category feeds) remove_action( 'wp_head', 'feed_links_extra', 3 ); // Remove links to the general feeds (e.g. posts and comments) remove_action( 'wp_head', 'feed_links', 2 ); // Remove link to the RSD service endpoint, EditURI link remove_action( 'wp_head', 'rsd_link' ); // Remove link to the Windows Live Writer manifest file remove_action( 'wp_head', 'wlwmanifest_link' ); // Remove index link remove_action( 'wp_head', 'index_rel_link' ); // Remove prev link remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // Remove start link remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // Display relational links for adjacent posts remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); // Remove XHTML generator showing WP version remove_action( 'wp_head', 'wp_generator' ); remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 ); remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 );]]> Fri, 17 Oct 2014 06:19:16 +0200