<div class="controls">
<label>
Permalink structure
<select id="permalink-structure">
<option value="pretty">Pretty permalinks</option>
<option value="plain">Plain permalinks</option>
</select>
</label>
<label>
Long URLs
<select id="long-url">
<option value="multiline" selected>Multiline (about.php)</option>
<option value="fade">Fade</option>
<option value="clamp-fade">Clamp and fade</option>
</select>
</label>
<div class="controls__field">
<label>
Language test
<select id="random-language" aria-describedby="random-language-note">
<option value="random" data-locale="en">LTR English (EN) – random</option>
<option value="yadrichchhik" data-locale="hi">LTR Mid Length (HI) – yadrichchhik</option>
<option value="ngokungacwangciswanga" data-locale="xh">LTR Longest Found (XH) – ngokungacwangciswanga</option>
<option value="zufaelliger-beitrag-aus-dem-ganzen-webseitenarchiv" data-locale="de">LTR Stress Test – zufaelliger-beitrag-aus-dem-ganzen-webseitenarchiv</option>
<option value="akrai" data-locale="he" data-dir="rtl">RTL Shortest Found (HE) – akrai</option>
<option value="tasadofi" data-locale="fa" data-dir="rtl">RTL Mid Length (FA) – tasadofi</option>
<option value="bey-tarteeb" data-locale="sd" data-dir="rtl">RTL Longest Found (SD) – bey-tarteeb</option>
<option value="mohtava-ye-tasadofi-az-bayegani-ye-kamel-e-vebsayt" data-locale="fa" data-dir="rtl">RTL Stress Test – mohtava-ye-tasadofi-az-bayegani-ye-kamel-e-vebsayt</option>
</select>
</label>
<p class="controls__note" id="random-language-note">The slugs and about page text are machine translations for this demo, not the official translations from translate.wordpress.org.</p>
</div>
</div>
<div class="about__container" lang="en" dir="ltr">
<div class="about__section has-2-columns">
<div class="column is-vertically-aligned-center is-left-padding-zero">
<div class="about__image about__image-random" aria-hidden="true">
<img src="https://peterwilson.cc/content/uploads/2026/11/72-about-feature-image-v2.webp" alt="" width="900" height="900" />
<span class="about__image-random-url">
<span class="about__image-random-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path fill="currentColor" d="M10 17.389H8.444a5.194 5.194 0 1 1 0-10.389H10v1.5H8.444a3.69 3.69 0 0 0-3.694 3.694 3.695 3.695 0 0 0 3.694 3.695H10zM14 7h1.556a5.2 5.2 0 0 1 3.673 1.522 5.19 5.19 0 0 1 0 7.346 5.2 5.2 0 0 1-3.673 1.522H14v-1.5h1.556a3.695 3.695 0 1 0 0-7.39H14zm-4.5 6h5v-1.5h-5z" />
</svg>
</span>
<span class="about__image-random-text" dir="ltr">/random</span>
</span>
</div>
</div>
<div class="column is-vertically-aligned-center is-right-padding-zero">
<h3>Discover posts differently</h3>
<p>
<strong>One link, a different post every time.</strong><br />
WordPress 7.2 adds a <a class="about__random-link" href="https://example.com/random/" dir="ltr">/random</a> address to your site. Visit it and you land on a randomly chosen post, giving readers a playful way to explore your archive and rediscover writing that deserves a second look.
</p>
</div>
</div>
</div>
/* About page background and wp-admin's font, from about.css and common.css. */
:root {
background: #fff;
}
body {
color: #3c434a;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-size: 13px;
line-height: 1.4;
}
strong {
font-weight: 600;
}
/* Demo controls, above the about page section. */
.controls {
display: flex;
flex-wrap: wrap;
gap: 1rem 1.5rem;
align-items: start;
max-width: 1000px;
margin: 0 auto;
}
.controls select {
max-width: 100%;
}
.controls label,
.controls__field {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.controls__field {
flex: 1 1 16rem;
}
/* wp-admin's .description text colour. */
.controls__note {
margin: 0;
color: #646970;
font-size: 0.8125rem;
}
/*
* About page styles, from about.css.
*
* Physical left and right values that rtlcss flips in about-rtl.css are logical
* properties here, as the demo switches dir="rtl" on the container instead.
*/
.about__container {
--text: #1e1e1e;
--accent-1: #3858e9;
--border-radius: 0.5rem;
--gap: 2rem;
max-width: 1000px;
margin: 24px auto;
line-height: 1.4;
color: var(--text);
}
.about__container .is-vertically-aligned-center {
align-self: center;
}
.about__section {
margin: 0;
font-size: 1.125rem;
line-height: 1.55;
}
.about__section .column {
padding: var(--gap);
}
.about__section .column.is-left-padding-zero {
padding-inline-start: 0;
}
.about__section .column.is-right-padding-zero {
padding-inline-end: 0;
}
.about__section .column p:first-of-type {
margin-top: 0;
}
.about__section .column p:last-of-type {
margin-bottom: 0;
}
.about__section.has-2-columns {
display: grid;
grid-template-columns: 1fr 1fr;
}
.about__container h3 {
margin-top: 0;
margin-bottom: calc(0.5 * var(--gap));
font-size: 1.625rem;
font-weight: 700;
line-height: 1.4;
text-wrap: pretty;
color: inherit;
}
.about__container h3:lang(en) {
text-wrap: balance;
}
.about__container p {
text-wrap: pretty;
font-size: inherit;
line-height: inherit;
}
.about__section a {
color: var(--accent-1);
text-decoration: underline;
}
.about__section a:hover,
.about__section a:active,
.about__section a:focus {
color: var(--accent-1);
text-decoration: none;
}
/* wp-admin's link focus ring, from common.css. */
.about__section a:focus {
border-radius: 2px;
box-shadow: 0 0 0 1.5px #3858e9;
outline: 2px solid transparent;
}
.about__container img {
vertical-align: middle;
}
.about__container .about__image {
margin: 0;
}
.about__container .about__image img {
max-width: 100%;
width: 100%;
height: auto;
border-radius: var(--border-radius);
}
.about__container .about__image svg {
vertical-align: middle;
}
/* The URL pill, as in about.css. */
.about__container .about__image-random {
position: relative;
container-type: inline-size;
}
.about__container .about__image-random-url {
position: absolute;
top: 24.8889cqw;
left: 24.8889%;
box-sizing: border-box;
display: flex;
align-items: center;
gap: 2.6667cqw;
max-width: 70%;
padding-block: 2.6667cqw;
padding-inline: 2.6667cqw 4.4444cqw;
border-radius: 6.2222cqw;
background: #fff;
color: #1e1e1e;
font-family: Inter, Roboto, "Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif;
font-size: 5.3333cqw;
line-height: 1.25;
}
.about__container[dir="rtl"] .about__image-random-url {
left: auto;
right: 7.1111%;
}
.about__container .about__image-random-icon {
display: flex;
flex: none;
align-items: center;
justify-content: center;
width: 7.1111cqw;
height: 7.1111cqw;
border-radius: 50%;
background: #e6e2d7;
}
.about__container .about__image-random-icon svg {
height: 5.3333cqw;
}
/*
* Long URLs shrink to fit, from the character count in --random-url-length.
*
* The text has 53.1111cqw at the pill's max-width (70%, less the padding, icon
* and gap), and the widest slugs average about 0.56em a character, so the font
* size is 53.1111cqw / 0.56 / length. It stops shrinking at 3.5cqw (about 16px
* on the 450px design).
*
* URLs that are still too long stay on one line and are cut off. The text is
* always left to right, so the cut is always on the right.
*/
.about__container .about__image-random-text {
min-width: 0;
font-size: clamp(3.5cqw, calc(95cqw / var(--random-url-length, 1)), 5.3333cqw);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
/*
* Fade instead of an ellipsis. The scroll timeline is only active while the
* text overflows, so short URLs are not faded.
*/
@supports (animation-timeline: scroll()) {
.about__container .about__image-random-text {
text-overflow: clip;
animation: about-random-text-fade linear both;
animation-timeline: scroll(self inline);
}
}
@keyframes about-random-text-fade {
from,
to {
mask-image: linear-gradient(to right, #000 calc(100% - 2em), transparent);
}
}
/*
* Demo only: the Long URLs control. The rules above are the proposed clamp and
* fade; these switch to the other options, including about.php's multiline.
*/
/* Fade: full size text, cut off and faded. */
.about__container[data-long-url="fade"] .about__image-random-text {
font-size: 5.3333cqw;
}
/* Multiline: full size text that wraps, as in about.php. */
.about__container[data-long-url="multiline"] .about__image-random-text {
font-size: 5.3333cqw;
overflow: visible;
white-space: normal;
overflow-wrap: anywhere;
text-align: left;
animation: none;
}
.about__container[data-long-url="multiline"][dir="rtl"] .about__image-random-text {
text-align: right;
}
/* Small screens: one column, with the text above the image. */
@media screen and (max-width: 600px) {
.about__section.has-2-columns {
grid-template-columns: 1fr;
margin-bottom: var(--gap);
}
.about__section.has-2-columns div:has(img) {
order: 1;
}
.about__section.has-2-columns div:not(:has(img)) {
order: 0;
}
.about__section.has-2-columns .column:nth-of-type(n) {
padding-top: calc(var(--gap) / 2);
padding-bottom: calc(var(--gap) / 2);
}
.about__section .column.is-left-padding-zero {
padding-inline-end: 0;
}
.about__section .column.is-right-padding-zero {
padding-inline-start: 0;
}
}
const HEADING = 'Discover posts differently';
const TAGLINE = 'One link, a different post every time.';
const TEXT = 'WordPress 7.2 adds a %s address to your site. Visit it and you land on a randomly chosen post, giving readers a playful way to explore your archive and rediscover writing that deserves a second look.';
// Machine translations of the about page strings, in order: heading, tagline, text.
const translations = {
de: [
'Beiträge neu entdecken',
'Ein Link, jedes Mal ein anderer Beitrag.',
'WordPress 7.2 fügt deiner Website die Adresse %s hinzu. Rufe sie auf und du landest auf einem zufällig ausgewählten Beitrag – eine spielerische Möglichkeit für Leser, dein Archiv zu erkunden und Texte wiederzuentdecken, die einen zweiten Blick verdienen.',
],
hi: [
'पोस्ट को नए तरीके से खोजें',
'एक लिंक, हर बार एक अलग पोस्ट।',
'WordPress 7.2 आपकी साइट में %s पता जोड़ता है। इस पर जाएँ और आप एक यादृच्छिक रूप से चुनी गई पोस्ट पर पहुँचेंगे, जिससे पाठक आपके संग्रह को मज़ेदार तरीके से खोज सकते हैं और ऐसे लेखन को फिर से खोज सकते हैं जो दोबारा देखने लायक है।',
],
he: [
'גלו פוסטים בדרך אחרת',
'קישור אחד, פוסט אחר בכל פעם.',
'וורדפרס 7.2 מוסיפה לאתר שלכם את הכתובת %s. היכנסו אליה ותגיעו לפוסט שנבחר באקראי, דרך משעשעת לקוראים לחקור את הארכיון שלכם ולגלות מחדש כתיבה שראויה למבט נוסף.',
],
fa: [
'نوشتهها را به شکلی متفاوت کشف کنید',
'یک پیوند، هر بار یک نوشتهٔ متفاوت.',
'وردپرس ۷.۲ نشانی %s را به سایت شما اضافه میکند. با رفتن به آن به یک نوشتهٔ تصادفی میرسید؛ راهی سرگرمکننده برای خوانندگان تا بایگانی شما را بگردند و نوشتههایی را که ارزش دوباره خواندن دارند دوباره کشف کنند.',
],
sd: [
'پوسٽون مختلف انداز ۾ ڳوليو',
'هڪ لنڪ، هر ڀيري هڪ مختلف پوسٽ.',
'ورڊپريس 7.2 توهان جي سائيٽ ۾ %s پتو شامل ڪري ٿو. ان تي وڃو ۽ توهان هڪ بي ترتيب چونڊيل پوسٽ تي پهچندا، جيڪا پڙهندڙن کي توهان جي آرڪائيو کي دلچسپ انداز ۾ ڏسڻ ۽ اهڙيون لکڻيون ٻيهر ڳولڻ جو موقعو ڏئي ٿي جيڪي ٻي نظر جي لائق آهن.',
],
xh: [
'Fumana izithuba ngendlela eyahlukileyo',
'Ikhonkco elinye, isithuba esahlukileyo qho.',
'I-WordPress 7.2 yongeza idilesi ethi %s kwisayithi yakho. Yityelele uze ufike kwisithuba esikhethwe ngokungacwangciswanga, nto leyo enika abafundi indlela emnandi yokuphonononga oovimba bakho kwaye bafumane kwakhona imibhalo efanelwe kukujongwa kwakhona.',
],
};
// Cut-down versions of wp.i18n's __() and sprintf(): the about page strings only use %s.
function getTranslator( locale ) {
const strings = translations[ locale ];
const index = [ HEADING, TAGLINE, TEXT ];
return ( text ) => strings?.[ index.indexOf( text ) ] ?? text;
}
function sprintf( format, ...args ) {
return format.replace( /%s/g, () => args.shift() );
}
const language = document.getElementById( 'random-language' );
const structure = document.getElementById( 'permalink-structure' );
const longUrl = document.getElementById( 'long-url' );
const container = document.querySelector( '.about__container' );
const pill = document.querySelector( '.about__image-random-url' );
const pillText = document.querySelector( '.about__image-random-text' );
const heading = container.querySelector( 'h3' );
const paragraph = container.querySelector( 'p' );
function escapeHtml( text ) {
const span = document.createElement( 'span' );
span.textContent = text;
return span.innerHTML;
}
// Matches about.php: the translated base for pretty permalinks, the query string otherwise.
// The language's direction sets the page layout; the URL text itself stays left to right.
function update() {
const option = language.selectedOptions[ 0 ];
const __ = getTranslator( option.dataset.locale );
const plain = 'plain' === structure.value;
// The word joiner stops Firefox wrapping after the slash, leaving it alone on a line.
const path = plain ? '/?random' : '/\u2060' + language.value;
const url = plain ? 'https://example.com/?random' : 'https://example.com/' + language.value + '/';
container.lang = option.dataset.locale;
container.dir = option.dataset.dir || 'ltr';
container.dataset.longUrl = longUrl.value;
pillText.textContent = path;
// The visible character count, without the word joiner, sets the pill's font size.
pill.style.setProperty( '--random-url-length', 1 + ( plain ? '?random' : language.value ).length );
heading.textContent = __( HEADING );
// As in about.php, the link markup is passed to the translated string with sprintf().
paragraph.innerHTML =
'<strong>' + escapeHtml( __( TAGLINE ) ) + '</strong><br />' +
sprintf(
escapeHtml( __( TEXT ) ),
'<a class="about__random-link" href="' + escapeHtml( url ) + '" dir="ltr">' + escapeHtml( path ) + '</a>'
);
}
language.addEventListener( 'change', update );
structure.addEventListener( 'change', update );
longUrl.addEventListener( 'change', update );
// The demo has no site to visit.
paragraph.addEventListener( 'click', ( event ) => {
if ( event.target.closest( 'a' ) ) {
event.preventDefault();
}
} );
update();