Changeset 11466
- Timestamp:
- 01/24/2022 08:56:49 PM (3 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/.wp-env.json
r11060 r11466 1 1 { 2 "core": "WordPress/WordPress#master", 2 3 "themes": [ 3 4 ".", 4 5 "../wporg" 5 ] 6 ], 7 "mappings": { 8 "wp-content/mu-plugins": "./wporg-mu-plugins/mu-plugins", 9 "wp-content/mu-plugins/mu-plugins.php": "./mu-plugins.php" 10 }, 11 "config": { 12 "FEATURE_2021_GLOBAL_HEADER_FOOTER": true 13 } 6 14 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md
r11060 r11466 14 14 1. Build the parent theme WordPress.org theme. 15 15 16 1. `cd` into the parent theme directory at `../wporg` 16 1. `cd` into the parent theme directory at `../wporg` 17 17 (i.e. `wordpress.org/wordpress.org/public_html/wp-content/themes/pub/wporg`). 18 3. Install all the required `npm` packages.18 2. Install all the required `npm` packages. 19 19 ```bash 20 20 $ npm install … … 27 27 (i.e. `wordpress.org/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse`). 28 28 29 2. You can choose to set up a new environment automatically or work in an 29 2. Build the MU plugins. 30 31 1. Clone the `WordPress/wporg-mu-plugins` repo right into this directory. 32 It's `.gitignored` so it shouldn't affect anything. 33 ```bash 34 $ git clone https://github.com/WordPress/wporg-mu-plugins.git 35 ``` 36 2. `cd` into this directory at `./wporg-mu-plugins` 37 (i.e. `wordpress.org/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/wporg-mu-plugins`). 38 3. Install all the required `npm` packages. 39 ```bash 40 $ npm install 41 ``` 42 4. Build the theme assets. 43 ```bash 44 $ npm run build 45 ``` 46 5. `cd` back to the Openverse theme directory at `..` 47 (i.e. `wordpress.org/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse`). 48 49 3. You can choose to set up a new environment automatically or work in an 30 50 existing environment with manual setup. 31 51 … … 50 70 If you prefer a manual approach, you can also set up your own WordPress 51 71 instance and load both the `wporg` (parent) and `wporg-openverse` (child) 52 themes into the `wp-content/themes` directory. 72 themes into the `wp-content/themes` directory. You must also load the MU 73 plugins and activate them using the `mu-plugins.php` file. 53 74 54 3. Activate and customize the theme.75 4. Activate and customize the theme. 55 76 56 77 1. Log into `/wp-admin`. … … 59 80 and update the value in the 'Openverse embed' panel. 60 81 61 4. Test message passing.82 5. Test message passing. 62 83 63 84 1. Change the Openverse embed to -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/css/openverse.css
r11253 r11466 1 :root { 2 --header-height: 117px; 3 } 4 5 @media (min-width: 890px) { 6 :root { 7 --header-height: 104.453px; 8 } 9 } 10 11 1 12 #openverse_embed { 2 13 display: block; 3 14 4 15 width: 100%; 5 height: var(--openverse-embed-height, 100vh); /* This will be updated by JavaScript */16 height: calc(100vh - var(--header-height)); 6 17 7 18 border: none; -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/header.php
r11448 r11466 14 14 \WordPressdotorg\skip_to( '#content' ); 15 15 16 if ( FEATURE_2021_GLOBAL_HEADER_FOOTER ) { 17 echo do_blocks( '<!-- wp:wporg/global-header /-->' ); 18 } else { 19 get_template_part( 'header', 'wporg' ); 20 } 16 get_template_part( 'header', 'wporg' ); 17 ?> 21 18 22 ?>23 19 <div id="page" class="site"> 24 20 <div id="content" class="site-content"> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/js/iframe_nav.js
r11060 r11466 2 2 const { pathname: path, search: query } = window.location; // starts with / 3 3 4 let iframePath = path.replace(openverseSubpath, '').replace(/^\/$/, ''); // Remove Openverse site subpath 4 let iframePath = path 5 .toLocaleLowerCase() 6 .replace(openverseSubpath, '') 7 .replace(/^\/$/, ''); // Remove Openverse site subpath 5 8 iframePath = `${openverseUrl}${iframePath}${query}`; // Add domain and query 6 9 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/js/message.js
r11217 r11466 1 /**2 * Update the height of the nested `iframe` to match the height of the nested3 * element. This function sets the value of the `--openverse-embed-height` CSS4 * custom property (which is `100vh`, by default).5 *6 * @param {{ height: number }} value - the new dimensions of the iframe7 */8 function updateHeight(value) {9 const height = value.height;10 let heightProp;11 if (height) {12 heightProp = `${height}px`;13 } else {14 heightProp = '100vh';15 }16 document17 .documentElement18 .style19 .setProperty('--openverse-embed-height', heightProp);20 }21 22 1 /** 23 2 * Update the URL in the address bar when a page navigation occurs inside the … … 46 25 document.title = value.title; 47 26 } 27 } 28 29 /** 30 * Set the meta attributes on the top-level document based on the meta tags 31 * passed by the `iframe`. 32 * 33 * @param {{ 34 * meta: [{ 35 * name: string, 36 * content: string, 37 * }] 38 * }} value - the meta data data supplied by the `iframe` 39 */ 40 function updateMeta(value) { 41 value.meta.forEach((metaItem) => { 42 let metaTag = document.head.querySelector(`meta[name="${metaItem.name}"]`); 43 if (metaTag) { 44 // Update the tag, if it already exists 45 metaTag.content = metaItem.content; 46 } else { 47 // Create a new tag, otherwise 48 metaTag = document.createElement('meta'); 49 metaTag.name = metaItem.name; 50 metaTag.content = metaItem.content; 51 document.head.appendChild(metaTag); 52 } 53 }) 48 54 } 49 55 … … 96 102 let handler; 97 103 switch (data.type) { 98 case 'resize':99 handler = updateHeight;100 break;101 104 case 'urlChange': 102 105 handler = updatePath; 106 break; 107 case 'setMeta': 108 handler = updateMeta; 103 109 break; 104 110 case 'localeGet': -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/js/message_test.html
r11217 r11466 12 12 display: inline-block; 13 13 width: 5em; 14 } 15 16 .tip { 17 color: #555; 18 font-size: 0.875em; 19 margin-top: 2px; 20 } 21 22 .tip::before { 23 content: '💡' 14 24 } 15 25 </style> … … 67 77 }); 68 78 79 document.forms.setMeta.addEventListener('submit', (event) => { 80 event.preventDefault(); 81 82 const metaInput = document.getElementById('metaInput'); 83 const meta = JSON.parse(metaInput.value); 84 85 const message = { meta }; 86 sendMessage('setMeta', message); 87 }); 88 69 89 document.forms.localeGet.addEventListener('submit', (event) => { 70 90 event.preventDefault(); … … 90 110 <h1>Message exchange</h1> 91 111 92 <h2>Test resize</h2>93 <form name="resize">94 <div class="row">95 <label for="height">Height*:</label>96 <input97 id="height"98 type="number"99 placeholder="Height (px)"100 required/>101 <code>{number}</code>102 </div>103 <div class="row">104 <button type="submit">105 Send message106 </button>107 </div>108 </form>109 110 112 <h2>Test URL change</h2> 111 113 <form name="urlChange"> … … 118 120 required/> 119 121 <code>{string}</code> 122 <p class="tip">Start the path with a '/'.</p> 120 123 </div> 121 124 <div class="row"> … … 126 129 placeholder="Title"/> 127 130 <code>{string?}</code> 131 <p class="tip">Add the '- Openverse' suffix.</p> 132 </div> 133 <div class="row"> 134 <button type="submit"> 135 Send message 136 </button> 137 </div> 138 </form> 139 140 <h2>Test meta tag passing</h2> 141 <form name="setMeta"> 142 <div class="row"> 143 <label for="metaInput">Meta*:</label> 144 <textarea 145 id="metaInput" 146 type="text" 147 placeholder="Meta JSON" 148 cols="24" 149 rows="4" 150 required></textarea> 151 <code>JSON ~ [{name: string, content: string}]</code> 152 <p class="tip">Try a 'theme-color' meta tag if your browser supports it.</p> 128 153 </div> 129 154 <div class="row">
Note: See TracChangeset
for help on using the changeset viewer.