Discuss your project

Category

Wordpress

23 articles Page 2

WordPress: Add a favicon to the admin

No real interest in adding a favicon to the WordPress admin area, but a client may request it, which has already happened: function favicon(){ echo '<link rel="shortcut icon" href="',get_template_directory_uri(),'/images/favicon.ico" />',"\n"; } add_action('admin_head','favicon');

WordPress: Remove WPML's Paid Translation Boxes

When you install WPML to manage translations, it automatically adds prompts for paid translations on the post editing page. To remove them, a simple way is to delete the box from the DOM.Insert the following code into your functions.php file: add_action( 'admin_footer', 'wpmlRemoveBox_hook' ); function wpmlRemoveBox_hook( $hook_suffix ) { ?> <script type="text/javascript"> jQuery( document ).ready(function() { jQuery('.icl_cyan_box').remove(); jQuery('#cpt_info_box').re...

WordPress: Configure the Color Picker of a Custom Field Type

To set up the default colors for the color picker of custom type fields, simply add a JavaScript snippet to override the default configuration.In your functions.php file, add the following code, and configure the palette as you wish: add_action( 'admin_footer', 'backgroundColor_hook' ); function backgroundColor_hook( $hook_suffix ) { ?> <script type="text/javascript"> jQuery( document ).ready(function() { jQuery('.js-types-colorpicker').each(function(){ jQuery(this).wpC...

WordPress: Set Up Default Theme Information

To associate a screenshot and add credits for a theme on the WordPress theme selection page, simply add a file named « screenshot.jpg » and place it at the root of the theme. For the credits, just add the following code to the style.css file at the root of the theme and include the following header: @charset "utf-8"; /* Theme Name: Le nom de mon theme Theme URI: http://ledomainedutheme.com/cequetuveux/ Author: partITech Author URI: http://www.partitech.com Version: 1.0 */

WordPress: Set Up an Options Page in the Admin

This example allows the addition of an options page for a WordPress theme. The file should be named theme-options.php and must be placed in the functions directory of your theme. This example is taken from the Pubicis-Verbe project. <?php add_action('admin_menu','verbe_menu_page'); function verbe_menu_page(){ add_theme_page('Verbe Theme Options', 'Theme Option', 'manage_options', 'verbe-theme-option', 'verbe_setting_page'); } add_action('admin_init', 'verbe_register_setting'); fu...

WordPress: Configure TinyMCE

Overriding the default TinyMCE configuration:To insert into the functions.php function myformatTinyMCE($in) { $in['remove_linebreaks']=false; $in['gecko_spellcheck']=false; $in['keep_styles']=true; $in['accessibility_focus']=true; $in['tabfocus_elements']='major-publishing-actions'; $in['media_strict']=false; $in['paste_remove_styles']=false; $in['paste_remove_spans']=false; $in['paste_strip_class_attributes']='none'; $in['paste_text_use_dialog']=true; $in['wpeditimage_disable_captions']=tru...

WordPress: Add a Taxonomy Manually

Example of manual addition of a taxonomy (without going through the configuration).To be placed in the functions.php file: /** * Manual add new Field to taxonomy or you can use plugin "taxonomy manager" * * BEGIN */ // A callback function to add a custom field to our "expertise" taxonomy function expertise_taxonomy_custom_fields($tag) { // Check for existing taxonomy meta for the term you're editing $t_id = $tag->term_id; // Get the ID of the term you're editing $term_meta = get_optio...

WordPress: Remove update notifications

Place in the functions.php file: $func = function ($a) { global $wp_version; return (object) array( 'last_checked' => time(), 'version_checked' => $wp_version, ); }; add_filter('pre_site_transient_update_core', $func); add_filter('pre_site_transient_update_plugins', $func); add_filter('pre_site_transient_update_themes', $func);

WordPress: Remove Default Elements from the Header

In some cases, we need to remove all the default meta tags from WordPress templates. To do this, simply add the following code to your functions.php file remove_action('wp_head', 'wp_print_styles', 8); remove_action('wp_head', 'wp_print_head_scripts', 9); remove_action('wp_head', 'feed_links_extra', 3); remove_action('wp_head', 'feed_links', 2); remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'index_rel_link'); remove_action('wp_he...