Changeset 3450875
- Timestamp:
- 01/31/2026 07:50:19 AM (2 months ago)
- Location:
- microposts
- Files:
-
- 9 added
- 2 edited
-
tags/1.5.0 (added)
-
tags/1.5.0/LICENSE.txt (added)
-
tags/1.5.0/assets (added)
-
tags/1.5.0/assets/mp-feed.js (added)
-
tags/1.5.0/assets/mp-style.css (added)
-
tags/1.5.0/microposts.php (added)
-
tags/1.5.0/readme.txt (added)
-
tags/1.5.0/templates (added)
-
tags/1.5.0/templates/single-micropost.php (added)
-
trunk/microposts.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
microposts/trunk/microposts.php
r3442296 r3450875 3 3 * Plugin Name: Microposts - Microblogging post type 4 4 * Description: Adds a Twitter-like microblog (micropost) post type with a feed, infinite scroll, hashtags, and limited editor. 5 * Version: 1. 4.05 * Version: 1.5.0 6 6 * Author: Creotec Limited - Michael Gbadebo 7 7 * Author URI: https://creotec.com … … 197 197 'type' => 'string', 198 198 'sanitize_callback' => function( $value ) { 199 $allowed = array( 'theme', 'p lugin' );199 $allowed = array( 'theme', 'page', 'plugin' ); 200 200 return in_array( $value, $allowed, true ) ? $value : 'plugin'; 201 201 }, … … 212 212 $theme_file = locate_template( array( 'single-micropost.php' ) ); 213 213 $has_theme_tpl = ! empty( $theme_file ); 214 $page_tpl_file = locate_template( array( 'page.php' ) ); 215 $has_page_tpl = ! empty( $page_tpl_file ); 214 216 $active_theme = wp_get_theme(); 215 217 $is_child = is_child_theme(); … … 223 225 <tr><th>Characters per excerpt</th><td><input type="number" name="creomicro_excerpt_chars" value="<?php echo esc_attr( $chars ); ?>" min="10" max="1000" /></td></tr> 224 226 <tr><th>Microposts per page</th><td><input type="number" name="creomicro_per_page" value="<?php echo esc_attr( $per ); ?>" min="1" max="20" /></td></tr> 225 <tr><th>Single Micropost Template</th><td> 226 <select name="creomicro_single_template_choice"><option value="theme" <?php selected( $tpl_choice, 'theme' ); ?> <?php disabled( ! $has_theme_tpl ); ?>>Use theme's template</option><option value="plugin" <?php selected( $tpl_choice, 'plugin' ); ?>>Use plugin's default template</option></select> 227 <?php if ( $has_theme_tpl ): ?> 228 <p style="margin-top:6px;color:#008000">Template found at: <code><?php echo esc_html( str_replace( ABSPATH, '', $theme_file ) ); ?></code></p> 229 <?php $overwrite_url = wp_nonce_url( admin_url( 'admin-post.php?action=creomicro_copy_template_to_theme&overwrite=1' ), 'creomicro_copy_template_to_theme' ); ?> 230 <button type="button" class="button button-primary" onclick="if(confirm('Replace template?')){ window.location.href='<?php echo esc_js( $overwrite_url ); ?>'; }" style="margin-top:10px;">Replace existing template</button> 231 <?php else: ?> 232 <p style="margin-top:6px;color:#a00">No <code>single-micropost.php</code> found in your <?php echo $is_child ? 'child theme' : 'theme'; ?> (<strong><?php echo esc_html( $active_theme->get( 'Name' ) ); ?></strong>).</p> 233 <?php $copy_url = wp_nonce_url( admin_url( 'admin-post.php?action=creomicro_copy_template_to_theme' ), 'creomicro_copy_template_to_theme' ); ?> 234 <button type="button" class="button button-secondary" onclick="if(confirm('Copy plugin template to theme?')){ window.location.href='<?php echo esc_js( $copy_url ); ?>'; }">Copy default template</button> 235 <p class="description">The file will be created at: <code><?php echo esc_html( str_replace( ABSPATH, '', $target_path ) ); ?></code></p> 236 <?php endif; ?> 237 </td></tr> 227 228 <tr><th>Single Micropost Template</th><td> 229 <select id="creomicro_single_template_choice" name="creomicro_single_template_choice"> 230 <option value="theme" <?php selected( $tpl_choice, 'theme' ); ?>> 231 Use theme's single-micropost.php template 232 </option> 233 <option value="page" <?php selected( $tpl_choice, 'page' ); ?> <?php disabled( ! $has_page_tpl ); ?>> 234 Use theme's page.php template 235 </option> 236 <option value="plugin" <?php selected( $tpl_choice, 'plugin' ); ?>> 237 Use plugin's default template 238 </option> 239 </select> 240 241 <div class="creomicro-tpl-msg" data-choice="theme" style="display:none;"> 242 <?php if ( $has_theme_tpl ): ?> 243 <p style="margin-top:6px;color:#008000"> 244 Single micropost template found at: 245 <code><?php echo esc_html( str_replace( ABSPATH, '', $theme_file ) ); ?></code> 246 </p> 247 <?php $overwrite_url = wp_nonce_url( admin_url( 'admin-post.php?action=creomicro_copy_template_to_theme&overwrite=1' ), 'creomicro_copy_template_to_theme' ); ?> 248 <button type="button" class="button button-primary" 249 onclick="if(confirm('Replace template?')){ window.location.href='<?php echo esc_js( $overwrite_url ); ?>'; }" 250 style="margin-top:10px;"> 251 Replace existing single micropost template 252 </button> 253 <?php else: ?> 254 <p style="margin-top:6px;color:#a00"> 255 No <code>single-micropost.php</code> found in your <?php echo $is_child ? 'child theme' : 'theme'; ?> 256 (<strong><?php echo esc_html( $active_theme->get( 'Name' ) ); ?></strong>). 257 </p> 258 <?php $copy_url = wp_nonce_url( admin_url( 'admin-post.php?action=creomicro_copy_template_to_theme' ), 'creomicro_copy_template_to_theme' ); ?> 259 <button type="button" class="button button-secondary" 260 onclick="if(confirm('Copy plugin template to theme?')){ window.location.href='<?php echo esc_js( $copy_url ); ?>'; }"> 261 Copy default single micropost template 262 </button> 263 <p class="description"> 264 The file will be created at: 265 <code><?php echo esc_html( str_replace( ABSPATH, '', $target_path ) ); ?></code> 266 </p> 267 <?php endif; ?> 268 </div> 269 270 <div class="creomicro-tpl-msg" data-choice="page" style="display:none;"> 271 <?php if ( $has_page_tpl ): ?> 272 <p style="margin-top:6px;color:#008000"> 273 Using page template: 274 <code><?php echo esc_html( str_replace( ABSPATH, '', $page_tpl_file ) ); ?></code> 275 </p> 276 <?php else: ?> 277 <p style="margin-top:6px;color:#a00"> 278 No <code>page.php</code> found in your <?php echo $is_child ? 'child theme' : 'theme'; ?> 279 (<strong><?php echo esc_html( $active_theme->get( 'Name' ) ); ?></strong>). 280 Falling back to plugin template. 281 </p> 282 <?php endif; ?> 283 </div> 284 285 <div class="creomicro-tpl-msg" data-choice="plugin" style="display:none;"> 286 <p style="margin-top:6px;color:#008000"> 287 Using plugin template: 288 <code><?php echo esc_html( str_replace( ABSPATH, '', CREOMICRO_PLUGIN_DIR . 'templates/single-micropost.php' ) ); ?></code> 289 </p> 290 </div> 291 292 <script> 293 document.addEventListener('DOMContentLoaded', function () { 294 const select = document.getElementById('creomicro_single_template_choice'); 295 const blocks = document.querySelectorAll('.creomicro-tpl-msg'); 296 297 function toggleTplMessages() { 298 const val = select.value; 299 blocks.forEach(b => { 300 b.style.display = (b.getAttribute('data-choice') === val) ? 'block' : 'none'; 301 }); 302 } 303 304 toggleTplMessages(); 305 select.addEventListener('change', toggleTplMessages); 306 }); 307 </script> 308 </td></tr> 309 238 310 <tr><th><?php esc_html_e('Enable comments on Microposts','microposts'); ?></th><td> 239 311 <label> … … 593 665 $choice = get_option( 'creomicro_single_template_choice', 'plugin' ); 594 666 $theme_file = locate_template( array( 'single-micropost.php' ) ); 667 $page_file = locate_template( array( 'page.php' ) ); 595 668 $plugin_file = CREOMICRO_PLUGIN_DIR . 'templates/single-micropost.php'; 596 if ( $choice === 'theme' && $theme_file ) return $theme_file; 597 if ( $choice === 'theme' && ! $theme_file ) return $plugin_file; 598 if ( $choice === 'plugin' ) return $plugin_file; 669 670 if ( $choice === 'theme' ) { 671 return $theme_file ? $theme_file : $plugin_file; 672 } 673 674 if ( $choice === 'page' ) { 675 if ( $page_file ) return $page_file; 676 $fallback = locate_template( array( 'singular.php', 'index.php' ) ); 677 return $fallback ? $fallback : $plugin_file; 678 } 679 680 681 return $plugin_file; 599 682 } 600 683 return $template; -
microposts/trunk/readme.txt
r3442296 r3450875 4 4 Requires at least: 5.8 5 5 Tested up to: 6.9 6 Stable tag: 1. 4.06 Stable tag: 1.5.0 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 Donate link: https://sowandnurture.com/ 9 10 10 11 Create a Twitter-style (X-style) microblog on your WordPress site with hashtags, AJAX feed, infinite scroll, and automatic title generation. … … 41 42 5. Display your feed in a post or page using [creomicro_list] shortcode with date and tags filtering, sorting, and customisable no result message. 42 43 6. Enable or disable native WordPress comments on Microposts. 43 7. Add (and modify) the single-micropost template file to your theme folder (under **Settings > Microposts**) 44 8. That's it - your microblog is live! 44 7. Add (and modify) the single-micropost template file to your theme folder (under **Settings > Microposts**). 45 8. Set what template to use to display single micropost (under **Settings > Microposts**). 46 9. That's it - your microblog is live! 45 47 46 48 == Shortcodes == … … 78 80 Yes! Typing '#example' in your content automatically links it to the relevant micropost tag. 79 81 82 = I get "micropost/page not found" error when I try to view single micropost = 83 This is a Permalink issue. To fix, go to Settings -> Permalinks -> click Save Changes button. 84 80 85 = How does the infinite scroll work? = 81 86 Microposts uses AJAX to load new posts dynamically as the reader scrolls. … … 109 114 110 115 == Changelog == 116 117 = 1.5.0 = 118 *Release Date - 31 January 2026* 119 120 * Added support for using a theme's page.php file to display single micropost - great for none coders. 111 121 112 122 = 1.4.0 =
Note: See TracChangeset
for help on using the changeset viewer.