Random Post Plugin – Redirect URL to Post

Description

Redirigez vos visiteurs vers

  • une publication au hasard
  • votre dernière (la plus récente) publication
  • votre première (la plus ancienne) publication
  • la publication précédente ou suivante
  • ou une combinaison de conditions, par exemple une publication au hasard parmi vos 10 dernières publications, ou la dernière publication d’il y a au moins 3 mois, ou la dernière publication d’un auteur/autrice spécifique.

Fonctionnalités | Exemples | Documentation | Dernière publication du blog de développement

Une URL magique vous amène à la bonne publication

Cette extension fournit une URL (lien) qui vous amène directement à une publication en vue unique. Cette publication est déterminée par le paramètre de requête ?Redirect_to=… et d’autres paramètres facultatifs.

Bien que l’URL reste la même, sa cible change en fonction des publications disponibles au moment où un visiteur y arrive. Cela signifie que vous pouvez utiliser la même URL statique dans un menu, avec un bouton ou dans une Newsletter et l’extension trouve la bonne cible.

Saisir l’URL de votre site WordPress dans votre navigateur et ajoutez ?Redirect_to=… à la fin.

Les valeurs possibles pour redirect_to sont :

  • last ou latest – L’URL redirigera vers la plus récente publication.
  • first ou oldest – L’URL redirigera vers la plus ancienne publication.
  • random – L’URL redirigera vers une publication au hasard.
  • préc. ou précédent – L’URL redirigera vers la publication précédente (par date).
  • suivant – L’URL redirigera vers la prochaine publication (par date).
  • custom – La publication sera déterminée en fonction de l’ordre des paramètres obligatoires et de l’ordre des paramètres facultatifs.

Vous pouvez également limiter la portée des publications considérées par des paramètres de filtre supplémentaires, tels que &s=searchaword ou &cat=2, ou utiliser un décalage pour aller à la deuxième dernière ou à la publication avant la précédente. Le paramètre random combiné avec count et bias vous permet de choisir les dernières publications (ou les plus anciennes) avec une probabilité différente des autres.

Mise en cache

L’extension propose une mise en cache des résultats de la base de données.

Réglages et paramètres

Il n’y a pas de page de réglages dans l’administration. Vous configurez l’extension entièrement via les paramètres de requête dans l’URL.

Please find more information about parameters and troubleshooting on the plugin website.

Exemples d’URL

Remarque : remplacez « http://www.example.com/ » par votre propre site. Les espaces seront saisis comme « %20 ».

http://www.example.com/?redirect_to=latest – redirects to the latest post

http://www.example.com/?redirect_to=random&pk_campaign=random – redirects to a random post and tracks the visit

http://www.example.com/?redirect_to=prev – redirige vers la publication précédente

http://www.example.com/?redirect_to=random&each_once=rewind – redirige vers une publication au hasard, évitant les doublons, puis recommence

http://www.example.com/?redirect_to=prev&offset=1 – redirige vers la publication avant la publication précédente

http://www.example.com/?redirect_to=random&count=10 – redirige vers une publication au hasard parmi les 10 dernières publications

http://www.example.com/?redirect_to=random&count=10&bias=80 – redirects to a random post. The plugin picks one from the latest 10 with a probability of 80% and from the rest with a probability of 20%

http://www.example.com/?redirect_to=random&count=10&offset=1 – redirige vers une publication au hasard parmi les 10 publications qui suivent la dernière

http://www.example.com/?redirect_to=random&after=1%20month%20ago – redirige vers une publication au hasard parmi les publications qui ont moins d’un mois

http://www.example.com/?redirect_to=latest&exclude=4,7 – redirects to the latest post, excluding the posts with the IDs 4 and 7

http://www.example.com/?redirect_to=latest&offset=1 – redirige vers la deuxième dernière publication

http://www.example.com/?redirect_to=custom&orderby=comment_count&order=DESC – redirige vers la publication avec le plus de commentaires

http://www.example.com/?redirect_to=latest&s=iaido&default_redirect_to=12&cache=200 – redirects to the latest post that contains the word ‘iaido’ or, if nothing can be found, to the page or post with the ID 12; use a cache with a 200 second lifetime

Bouton

The plugin also provides a shortcode [redirect_to_post_button] to create a simple button. Some parameters are available.

A button that links to a random post is a great way to increase your visitors’ on-site engagement and therefore your SEO ranking!

(vidéo par WPBeginner)

Si vous trouvez cette extension utile, donnez-lui une note de 5 étoiles. Merci d’avance !

Installation

  1. Find the plugin in the list at the admin backend and click to install it. Or, upload the ZIP file through the admin backend. Or, upload the unzipped redirect-url-to-post folder to the /wp-content/plugins/ directory.
  2. Activez l’extension depuis le menu « Extensions » de WordPress.

Après la première activation, vous trouverez un écran avec quelques exemples d’URL pour votre blog.

FAQ

1. How to find out the cause if something doesn’t work?

The first thing you should try is to add &rutpdebug (or &rutpdebug=2 for advanced users) to the URL. This will show you more details about what is happening in the background. At the end you will see the URL of the resulting post without actually going there.

1. Que faire si plusieurs publications correspondent aux critères (ex. : deux ont le même nombre de commentaires) ?

There can be only one winner. The post that would be first in the list (as determined by WP) beats all others.

3. Le paramètre aléatoire redirige toujours vers la même publication

You probably use a caching plugin or service that also caches query strings. Try adding an exception for the string « redirect_to= ». If you use Cloudflare, you can try their Page Rules.

4. Quelle URL peut servir de base ?

Évidemment uniquement les URL du blog WordPress où cette extension est installée.

5. La publication est introuvable mais je suis sûr qu’elle existe et qu’elle est publique

La raison la plus courante est que cette publication appartient à un type de publication spécial. Essayez le paramètre « post_type », par exemple « post_type=product ».

6. Puis-je aider à traduire ?

Thank you! Please continue here.

Avis

Lire les 18 avis

Contributeurs/contributrices & développeurs/développeuses

« Random Post Plugin – Redirect URL to Post » est un logiciel libre. Les personnes suivantes ont contribué à cette extension.

Contributeurs

“Random Post Plugin – Redirect URL to Post” a été traduit dans 2 locales. Remerciez l’équipe de traduction pour ses contributions.

Traduisez « Random Post Plugin – Redirect URL to Post » dans votre langue.

Le développement vous intéresse ?

Parcourir le code, consulter le SVN dépôt, ou s’inscrire au journal de développement par RSS.

Journal

0.23.0

Features

  • The cache is automatically cleared when a post is updated
  • We don’t reveal the database table prefix in debugging

0.22.0

Features

  • Option to delete the cache (for a particular set of parameters) with cache=-1 (here too, the constant CHATTY_MANGO_RUTP_CACHE takes priority)

Other

  • Added the actual database request to the debugging output

0.21.0

Features

  • Paramter post_type can also be a comma-separated list

0.20.0

Features

  • New parameters: author__in, author__not_in, category__and, category__in, category__not_in, post__in, post__not_in, post_name__in, post_parent, post_parent__in, post_parent__not_in, tag__and, tag__in, tag__not_in, tag_slug__and, tag_slug__in. More information. Wherever WordPress requires an array, you submit the elements as comma-separated list: ...&tag__in=12,15.

0.19.1

Other

  • Added more debug messages for &rutpdebug

0.19.0

Features

  • Define own URL parameters that will be passed through by adding to your wp-config.php define( 'CHATTY_MANGO_RUTP_PASS_THROUGH', 'own1,own2' ); (comma-separated list) to allow …&own1=foo&own2=bar

0.18.3

Bug Fixes

  • Utilisation de la mémoire réduite lorsqu’il n’est pas nécessaire de récupérer des objets de publication de la base de données

0.18.2

Bug Fixes

  • Fixing parameter ignore_sticky_posts

0.18.1

Bug Fixes

  • Fixing bug introduced in last version (random with bias not working)

0.18.0

Features

  • New parameter lock to redirect a visitor always to the same post for a specified time. Use it with a time in seconds: ...&lock=86400. Particularly useful with random redirects. This works only in the same browser and if the visitor accepts and keeps cookies.

Other

  • Cookies (for each_once and lock) have now by default a domain-wide validity. Switch to separate cookies per directory with the parameter directory_cookie.
  • Please help translate!

Older Versions

The complete changelog is available here.