AirV's Blog

Just another blog

Test galerie Picassa / Picasna

Test du plugin Picasna pour WordPress qui permet de visualiser une galerie Picassa

Picasna Instructions


Migration des bases de données WordPress

From http://www.tipstechtricks.com

Change Siteurl & Homeurl

WordPress stores the absolute path of the site URL and home URL in the database. Therefore, if you transfer your WordPress site from the localhost to your server, your site will not load online. This is because the absolute path URL is still pointing to your localhost. You will need to change the site URL and the home URL in order for the site to work.
Solution:
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsiteurl.com','http://www.newsiteurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';

Change GUID

After you have migrated your blog from the localhost to your server or from another domain to a new domain, you will need to fix the URLs for the GUID field in wp_posts table. This is crucial because GUID is used to translate your post or page slug to the correct article absolute path if it is entered wrongly.
Solution:
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.oldsiteurl.com','http://www.newsiteurl.com');

Change URL in Content

WordPress uses absolute path in the URL link instead of a relative path in the URL link when storing them in the database. Within the content of each post record, it stores all the old URLs referencing the old source. Therefore you will need to change all these URLs to the new domain location.
Solution:
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.oldsiteurl.com','http://www.newsiteurl.com');

Change Image Path Only

If you decide to use Amazon CloudFront as your Content Delivery Network (CDN) to offload the delivery of images from your server. After your have created your CNAME record, you can use the query below to change all the image paths in WordPress to load all your images from Amazon CloudFront.
Solution:
UPDATE wp_posts SET post_content = REPLACE (post_content, 'src="http://www.oldsiteurl.com','src="http://yourcdn.newsiteurl.com');
You will also need to update the GUID for Image Attachment with the following query:
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.oldsiteurl.com','http://yourcdn.newsiteurl.com') WHERE post_type = 'attachment';

Update Post Meta

Updating Post Meta works almost the same way as updating the URL in post content. If you have stored extra URL data for each post, you can use the follow query to change all of them.
Solution:
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value,'http://www.oldsiteurl.com','http://www.newsiteurl.com');

Change Default « Admin » Username

Every default WordPress installation will create an account with a default Admin username. This is wide spread knowledge, everyone who uses WordPress knows this. However, this can be a security issue because a hacker can brutal force your WordPress admin panel. If you can change your default “Admin” username, you will give your WordPress admin panel additional security.
Solution:
UPDATE wp_users SET user_login = 'Your New Username' WHERE user_login = 'Admin';

Reset Password

Ever wanted to reset your password in WordPress, but cannot seem to use the reset password section whatever the reason?
Solution:
UPDATE wp_users SET user_pass = MD5( 'new_password' ) WHERE user_login = 'your-username';

Assign all articles by Author B to Author A

If you want to transfer the articles under Author B to merge with those under Author A, it will be very time consuming if you do it article by article. With the following SQL query, you can easily go through all the records and assign articles by Author B to go under Author A.
You will first need to obtain the author ID of both authors by going to your Author & User page in your WordPress admin panel. Click on the author’s name to view their profile. At the address bar, look for « user_id« . That is the author ID information we require.
Solution:
UPDATE wp_posts SET post_author = 'new-author-id' WHERE post_author = 'old-author-id';

Delete Revision

When you are editing an article in WordPress, there will be many revision copies being saved. This is a waste of resources because excessive revision records can increase the burden of the database. Over time, when you have thousands of entries, your database will have grown significantly. This will increase loop iterations, data retrieval and will affect the page loading time.
Solution:
DELETE a,b,c FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'
Source from: Lester chan
Note: Bear in mind that all revisions from each post will be deleted, including all of its meta data.

Delete Post Meta

Installing or removing plugins is a very common task for WordPress. Some of the plugins make use of the post meta to store data pertaining to the plugin. After you have removed the plugin, those data are still left inside the post_meta table, which will no longer be needed. Run the following query to clean up the unused post meta value. This will help to speed up and reduce the size of your database.
Solution:
DELETE FROM wp_postmeta WHERE meta_key = 'your-meta-key';

Export all Comment Emails with no Duplicate

Over a period of time, your blog will have received many comments. These comments will include the email addresses left by the commenter. You can retrieve all these emails for your mailing list without any duplicate.
Solution:
SELECT DISTINCT comment_author_email FROM wp_comments;
Once you have the result, under Query results operations, select export to export all the emails in phpMyAdmin.

Delete all Pingback

Popular articles receive plenty of pingback. When this happens, the size of your database increases. In order to reduce size of the database, you can try removing all the pingbacks.
Solution:
DELETE FROM wp_comments WHERE comment_type = 'pingback';

Delete all Spam Comments

If you have plenty of spam comments, going through each page to delete spam can be tedious and frustrating. With the following SQL query, even if you have to face deleting 500 over spam comments, it will be a breeze.
Solution:
DELETE FROM wp_comments WHERE comment_approved = 'spam';
  • 0 = Comment Awaiting Moderation
  • 1 = Approved Comment
  • spam = Comment marked as Spam

Identify Unused Tags

In a WordPress database, if you run a query to delete old posts manually from MySQL, the old tags will remain and appear in your tag cloud/listing. This query allows you to identify the unused tags.
Solution:
SELECT * From wp_terms wt
INNER JOIN wp_term_taxonomy wtt ON wt.term_id=wtt.term_id WHERE wtt.taxonomy='post_tag' ANDwtt.count=0;

Test plugin Facebook

I was looking for ways to integrate my WordPress blog with my Facebook account…

OpenStreetMap WP Plugin

N’ayant toujours pas résolu le problème d’affichage des fichiers gpx avec le plugin XML Google Maps alors que les fichiers kml fonctionnnent très bien, j’ai donc testé le plugin OpenStreetMap

Procédure d’installation du plugin

  • Install WordPress OSM plugin
  • Upload your geo logger file (gpx or kml)
  • Choose the section and zoomlevel with the shortcode generator at OSM plugin settings page.
  • Add the OpenStreetMap shortcode in your post page adding the argument: gpx_file=”Address of gpx file”
  • Add the argument: marker_file=”Address of txt file”

Pas de soucis avec le fichier kml

Par contre avec le fichier gpx… impossible d’afficher conjointement le tracé et le marqueur…. tantôt ça marche puis sans rien faire plus rien 🙁

Syntaxe

[*osm_map lat= »47.515″ long= »-2.844″ zoom= »13″ width= »600″ height= »450″
gpx_file= »http://rozec.legtux.org/map/cap/10/07/20100702.gpx »
marker_file= »http://rozec.legtux.org/map/cap/10/07/20100702.txt »]

[*osm_map lat= »47.515″ long= »-2.844″ zoom= »13″ width= »600″ height= »450″ kml_file= »http://rozec.legtux.org/map/cap/10/07/20100702.kml » marker_file= »http://rozec.legtux.org/map/cap/10/07/20100702.txt » ]

* <= remove this star in the shortcode
Note: gpx file has to be on your own domain!

Documentation
Documentation 2

Mise à jour WordPress 3

Si la mise à jour de WordPress 3 n’a pas posé de problème… il n’en a pas été de même lorsque j’ai voulu tester la fonction multisite. Ainsi les permaliens n’avait plus la même syntaxe et qui plus est le codage des accents ne se faisait plus correctement.

Il m’a fallu opérer à cœur ouvert en travaillant au niveau des tables de la base de données pour rectifier les accents :

  • copie de sauvegarde de la table (onglet opération)
    • tables concernées :
      wp-comments
      wp-posts
      wp-terms
      wp-links
  • export de la table au format sql
  • copier coller du résultat de l’export dans un éditeur de texte (gedit)
  • enregistrement du fichier au format UTF8
  • modification du fichier avec la commande sed (unix)

rozec@pcbare:~/Bureau$ sed -i « s/è/è/g » export
rozec@pcbare:~/Bureau$ sed -i « s/â/â/g » export
rozec@pcbare:~/Bureau$ sed -i « s/Ã/à/g » export
rozec@pcbare:~/Bureau$ sed -i « s/Â//g » export
rozec@pcbare:~/Bureau$ sed -i « s/î/î/g » export
rozec@pcbare:~/Bureau$ sed -i « s/é/é/g » export
rozec@pcbare:~/Bureau$ sed -i « s/à«/ë/g » export
rozec@pcbare:~/Bureau$ sed -i « s/€/€/g » export
rozec@pcbare:~/Bureau$ sed -i « s/à®/î/g » export
rozec@pcbare:~/Bureau$ sed -i « s/à§/ç/g » export

  • modifier la structure de la table en UTF8
  • vider la table
  • importer le fichier modifier format UTF8

Message d’erreur
« Vous n’avez pas les droits suffisants pour accéder à cette page… »
Recherche infructueuse sur le net… en fait le problème se situe au niveau de la table wp_options. J’ai donc gardé la table de la nouvelle installation.

Modification de l’UID de l’auteur
UPDATE wp_posts SET post_author = ‘new-author-id’ WHERE post_author = ‘old-author-id’;

Plus d’infos sur les commandes mysql sur le site suivant

Bordure – Gravatar

Pour enlever la bordure des images avec le thème Andreas, il suffit de modifier le code suivant dans le fichier style.css :

.entry img{
border: 1px solid #333;

par

.entry img{
border: 0px solid #333;

Et pour faire plaisir à Zip le code à ajouter dans le fichier comment.php pour faire apparaitre son gravatar :

if ( !empty( $comment->comment_author_email ) ) {
em>$md5 = md5( $comment->comment_author_email );
$default = urlencode( ‘http://use.perl.org/images/pix.gif’ );
echo « <img style=’float: right; margin-left: 10px;’ src=’http://www.gravatar.com/avatar.php?gravatar_id=$md5&amp;size=60&amp;default=$default’ alt=” /> »;
}
?>

juste avant l’instruction :

<?php comment_text() ?>

NextGEN Gallery

Update

2018/04/11

2011/11/12

  • Avec la version 1.9 impossible de faire fonctionner le slideshow style piclens qui fonctionne parfaitement avec la version 1.7.2 (qui tournait sur herve.rozc.free.fr)

Installation

Test du plugin WordPress NextGEN Gallery
Voir aussi le blog d’alexrabe.de et les exemples

[ nggallery id=2 template=galleryview images=0 ]
Avec l’option template=galleryview on obtient un messaged’erreur : Rendering of template gallery-galleryview.php failed
Le template est à placer dans le répertoire :
From : http://nextgen-gallery.com/templates/
« …
Custom templates are PHP files that can be stored in the folder nggallery, inside your theme directory. NextGEN gallery look up always first into this folder if there are the vaild template file. For example, if you are using the default WordPress theme then you can store a template file at :

/wp-content/themes/default/nggallery/gallery-sample1.php

To use now this template in a post or page you insert the tag:

[ nggallery id=x template=sample1 ]
… »

no images were found

[ nggallery id=2 template=carousel images=7 ]

no images were found

———————————————

[ singlepic template=galleryview id=x w=320 h=240 mode=watermark ]

no images were found

———————————————

[ imagebrowser id=x template=exif ]

no images were found

———————————————

[ slideshow id=x w=width h=height ]

no images were found

—————————————–

 

———————————————

[ slideshow id=x w=width h=height ]

no images were found

—————————————–

 

 

[ album id=x template=extend |compact ]

no images were found

———————————————

[ monoslideshow id=y w=450 h=350 ]

[monoslideshow id=2 w=450 h=350]

Clker.com clip art

Clker.com clip art est un plugin permettant de rechercher et télécharger des images depuis le site clker.com

XML Google Maps

Un plugin wordpress, que dis-je un excellent plugin : XML google maps permet d’afficher les informations des fichiers gpx en provenance d’un Forerunner par exemple.

Le site de l’auteur :

http://www.matusz.ch/blog/projekte/xml-google-maps-wordpress-plugin-en/

Un exemple :
gpx
kml
Ca fonctionne avec le format kml mais soucis avec le format gpx

Signalement de bug WordPress

Lors de la mise à jour de mon blog de WordPress 2.5 à 2.6 j’ai eu une mauvaise surprise. Les images ne fonctionnait pas, car il allait les chercher dans le répertoire par défaut (/wp-content/uploads/) au lieu de suivre la valeur que j’ai mise pour stocker les fichiers.

Après une recherche sur Internet je suis tombé sur le blog de Azur Dev.

Cela m’a permis de découvrir l’outil de signalement de bug: WordPress Trac.

Page suivante »