';
echo $args['after_widget'];
}
function form($instance) {
$title = isset($instance['title']) ? $instance['title'] : 'Useful Links';
$links = isset($instance['links']) ? $instance['links'] : '';
echo '';
echo '';
}
function update($new, $old) {
return ['title' => sanitize_text_field($new['title']), 'links' => trim($new['links'])];
}
}
add_action('widgets_init', function () { register_widget('NewsMag_TextLinks_Widget'); });
/* Excerpt length + read-more */
add_filter('excerpt_length', function () { return 22; });
add_filter('excerpt_more', function () { return '…'; });
/* Helper: anh dai dien bai; bai chua co anh -> anh bia mac dinh cua site (option newsmag_default_thumb = attachment ID),
alt = tieu de bai. Khong co ca hai -> o placeholder nhu cu. */
function newsmag_thumb($size = 'large') {
if (has_post_thumbnail()) { the_post_thumbnail($size); return; }
$fid = (int) get_option('newsmag_default_thumb');
if ($fid && wp_attachment_is_image($fid)) { echo wp_get_attachment_image($fid, $size, false, ['alt' => get_the_title()]); return; }
echo '
Featured
';
}
/* Style cho khoi gioi thieu trang chu + tieu de hero (h2) */
add_action('wp_head', function () {
if (!is_front_page()) return;
echo '' . "\n";
}, 20);
/* Helper: category name of a post (first) */
function newsmag_cat($id = null) {
$c = get_the_category($id);
return $c ? $c[0]->name : 'News';
}
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/ruse-contor.sa.com/wp-content/themes/newsmag/functions.php:1) in /www/wwwroot/ruse-contor.sa.com/wp-content/mu-plugins/block-feeds.php on line 40
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/ruse-contor.sa.com/wp-content/themes/newsmag/functions.php:1) in /www/wwwroot/ruse-contor.sa.com/wp-content/mu-plugins/block-feeds.php on line 41
Feeds disabled.