<?php /** * Template Name: Notícias */ $q_header = get_option('destaques-noticias'); $q_principal = DestaquesNoticias::getQuery('principal'); $q_atuais = new WP_Query(['posts_per_page' => 3]); $not_post_list_id; function _cat() { foreach (get_the_category() as $i => $category) { if ($i > 0) { echo ', '; } echo '#' . $category->cat_name; } } function _img_url() { if (has_post_thumbnail(get_the_ID())) { $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'single-post-thumbnail'); echo "background-image:url({$image[0]})"; } else { echo 'background:black'; } } function _date() { //as 00h00 dia 00/00/0000 the_time('d/m/Y');
<?php add_action('admin_menu', function () { DestaquesNoticias::register(); }); class DestaquesNoticias { const option_name = 'destaques-noticias'; protected static $idsCache = []; static function register() { add_submenu_page('edit.php', 'Destaques', 'Destaques', 'manage_options', 'noticias-destaques', [__CLASS__, 'renderPage']); } static function renderPage() { if (isset($_POST['destaques'])) { if (!get_option(self::option_name)) { add_option(self::option_name, $_POST['destaques'], '', 'no'); } else { update_option(self::option_name, $_POST['destaques']); } } $destaques = get_option(self::option_name, ['header' => '', 'principal' => '']); //, 'geral' => '' ?> <style> .destaques{ margin-bottom:20px; } .destaques label {