'Original (full size)' ); $cfsp_registered = function_exists( 'wp_get_registered_image_subsizes' ) ? wp_get_registered_image_subsizes() : array(); foreach ( get_intermediate_image_sizes() as $cfsp_size ) { $cfsp_label = ucwords( str_replace( array( '-', '_' ), ' ', $cfsp_size ) ); if ( isset( $cfsp_registered[ $cfsp_size ] ) ) { $cfsp_dim = $cfsp_registered[ $cfsp_size ]; $cfsp_label .= sprintf( ' (%sx%s)', $cfsp_dim['width'] ? $cfsp_dim['width'] : 'auto', $cfsp_dim['height'] ? $cfsp_dim['height'] : 'auto' ); } $cfsp_sizes[ $cfsp_size ] = $cfsp_label; } CFSP_UI::card_start( 'Related posts at build time', 'Related posts are worked out while exporting and written into each post as plain links and images. Nothing loads from WordPress in the browser, and search engines can see them.' ); CFSP_UI::toggle( 'related_enabled', 'Build related posts into every post' ); if ( $cfsp_jetpack ) { CFSP_UI::notice( 'Jetpack Related Posts is active. On the static site it can\'t load its list, so Static Push fills Jetpack\'s own box instead. Its headline and styling stay exactly as they are now.', 'info', array( 'show_if' => 'related_enabled' ) ); } CFSP_UI::card_end(); /* ---------------------------------------------------------------- Matching */ CFSP_UI::card_start( 'Matching', 'How related posts are chosen.', array( 'show_if' => 'related_enabled' ) ); CFSP_UI::tags( 'related_post_types', 'Show on', CFSP_Settings::post_type_options(), array( 'help' => 'Content types that get a related posts box. Pages such as a privacy policy or contact page usually shouldn\'t, so only Posts are selected by default.' ) ); CFSP_UI::select( 'related_match', 'Match on', array( 'both' => 'Tags or categories (tags count more)', 'tags' => 'Tags only', 'categories' => 'Categories only', ), array( 'help' => 'Posts sharing more tags and categories rank higher; ties go to the newest post.' ) ); CFSP_UI::input( 'related_count', 'Posts to show', array( 'type' => 'number', 'min' => 1, 'max' => 12 ) ); CFSP_UI::select( 'related_fill', 'When fewer are found', array( 'latest' => 'Fill with the latest posts', 'none' => 'Show only the related posts found', ), array( 'help' => 'For posts that share a category or tag with only a few others (or with none). Related posts found by matching always come first; the latest posts fill the remaining places.' ) ); CFSP_UI::toggle( 'related_skip_default_cat', 'Ignore the default category', array( 'help' => 'Sharing "Uncategorized" (or whatever your default category is) doesn\'t make posts related.' ) ); CFSP_UI::input( 'related_refresh', 'Refresh neighbours on publish', array( 'type' => 'number', 'min' => 0, 'max' => 50, 'help' => 'When a post is published or edited, also re-export this many of its closest posts so their related lists include it. 0 turns this off; a weekly Scheduled rebuild (Automation) refreshes everything.', ) ); ?>
Paste a post address (WordPress or static) or a post ID to see which posts it would show. Uses the saved settings.
{url} {title} {image} {image_url} {date} {category} {excerpt}',
)
);
CFSP_UI::textarea(
'related_wrapper_template',
'Wrapper template',
array(
'rows' => 3,
'show_if' => 'related_design=custom',
'placeholder' => '',
'help' => 'Placeholders: {headline} {items}. Added after the post content.',
)
);
CFSP_UI::notice( 'Related posts are added when pages are exported. Run a Full site push after turning this on or changing the design. If a page cache serves stale pages to the exporter, clear it first.', 'tip' );
CFSP_UI::card_end();