|
@@ -142,6 +142,50 @@ function bookmarks_all() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/*============================================
|
|
|
|
|
+ Desk block-migration shortcodes
|
|
|
|
|
+ Wrap the echoing helpers (and the inline "Recently Edited" loop from
|
|
|
|
|
+ page-desk.php) so they can be dropped into block content.
|
|
|
|
|
+==============================================*/
|
|
|
|
|
+function dw_til_shortcode() {
|
|
|
|
|
+ ob_start();
|
|
|
|
|
+ pull_til();
|
|
|
|
|
+ return ob_get_clean();
|
|
|
|
|
+}
|
|
|
|
|
+add_shortcode( 'dw_til', 'dw_til_shortcode' );
|
|
|
|
|
+
|
|
|
|
|
+function dw_bookmarks_shortcode() {
|
|
|
|
|
+ ob_start();
|
|
|
|
|
+ bookmarks_pull();
|
|
|
|
|
+ return ob_get_clean();
|
|
|
|
|
+}
|
|
|
|
|
+add_shortcode( 'dw_bookmarks', 'dw_bookmarks_shortcode' );
|
|
|
|
|
+
|
|
|
|
|
+function dw_recently_edited_shortcode() {
|
|
|
|
|
+ $sticky = get_option( 'sticky_posts' );
|
|
|
|
|
+ if ( empty( $sticky ) ) {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ $posts = get_posts( array(
|
|
|
|
|
+ 'post_type' => 'post',
|
|
|
|
|
+ 'orderby' => 'modified',
|
|
|
|
|
+ 'posts_per_page' => 5,
|
|
|
|
|
+ 'post__in' => $sticky,
|
|
|
|
|
+ ) );
|
|
|
|
|
+ if ( ! $posts ) {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ $out = '<ul>';
|
|
|
|
|
+ foreach ( $posts as $p ) {
|
|
|
|
|
+ $out .= '<li style="color:#777">'
|
|
|
|
|
+ . get_the_modified_date( 'y/m/d', $p ) . ' ( ' . get_the_date( 'y/m/d', $p ) . ' ) - '
|
|
|
|
|
+ . '<a href="' . esc_url( get_permalink( $p ) ) . '">' . esc_html( get_the_title( $p ) ) . '</a></li>';
|
|
|
|
|
+ }
|
|
|
|
|
+ $out .= '</ul>';
|
|
|
|
|
+ return $out;
|
|
|
|
|
+}
|
|
|
|
|
+add_shortcode( 'dw_recently_edited', 'dw_recently_edited_shortcode' );
|
|
|
|
|
+
|
|
|
function now() {
|
|
function now() {
|
|
|
require_once('lib/html_dom.php');
|
|
require_once('lib/html_dom.php');
|
|
|
$url = 'https://davidawindham.com/til/lists/now';
|
|
$url = 'https://davidawindham.com/til/lists/now';
|