public function news_labels_field() { echo ' <fieldset id="xmlsf_news_labels"><legend class="screen-reader-text">' . __('Source labels', 'xml-sitemap-feed') . '</legend>' . sprintf(__('You can use the %1$s and %2$s tags to provide Google more information about the content of your articles.', 'xml-sitemap-feed'), '<access>', '<genres>') . ' <a href="https://support.google.com/news/publisher/answer/93992" target="_blank">' . __('More information…', 'xml-sitemap-feed') . '</a> <br><br>'; $options = parent::get_option('news_tags'); $prefix = parent::prefix(); // access tag $access = !empty($options['access']) ? $options['access'] : ''; $access_default = !empty($access['default']) ? $access['default'] : ''; $access_password = !empty($access['password']) ? $access['password'] : ''; echo ' <fieldset id="xmlsf_news_labels_access"><legend class="screen-reader-text"><access></legend> ' . sprintf(__('The %4$s tag specifies whether an article is available to all readers (%1$s), or only to those with a free (%2$s) or paid membership (%3$s) to your site.', 'xml-sitemap-feed'), translate('Public'), __('Registration', 'xml-sitemap-feed'), __('Subscription', 'xml-sitemap-feed'), '<strong><access></strong>') . ' ' . __('You can assign a different access level when writing a post.', 'xml-sitemap-feed') . ' <ul>'; echo ' <li><label>' . __('Tag normal posts as', 'xml-sitemap-feed') . ' <select name="' . $prefix . 'news_tags[access][default]" id="xmlsf_news_tags_access_default"> <option value="">' . translate('Public') . '</option> <option value="Registration" ' . selected("Registration" == $access_default, true, false) . '>' . __('Free registration', 'xml-sitemap-feed') . '</option> <option value="Subscription" ' . selected("Subscription" == $access_default, true, false) . '>' . __('Paid subscription', 'xml-sitemap-feed') . '</option> </select></label></li>'; echo ' <li><label>' . __('Tag Password Protected posts as', 'xml-sitemap-feed') . ' <select name="' . $prefix . 'news_tags[access][password]" id="xmlsf_news_tags_access_password"> <option value="Registration" ' . selected("Registration" == $access_password, true, false) . '>' . __('Free registration', 'xml-sitemap-feed') . '</option> <option value="Subscription" ' . selected("Subscription" == $access_password, true, false) . '>' . __('Paid subscription', 'xml-sitemap-feed') . '</option> </select></label></li>'; echo ' </ul> </fieldset>'; // genres tag $gn_genres = parent::gn_genres(); $genres = !empty($options['genres']) ? $options['genres'] : array(); $genres_default = !empty($genres['default']) ? (array) $genres['default'] : array(); echo ' <fieldset id="xmlsf_news_labels_genres"><legend class="screen-reader-text"><genres></legend> ' . sprintf(__('The %s tag specifies one or more properties for an article, namely, whether it is a press release, a blog post, an opinion, an op-ed piece, user-generated content, or satire.', 'xml-sitemap-feed'), '<strong><genres></strong>') . ' ' . __('You can assign different genres when writing a post.', 'xml-sitemap-feed'); echo ' <ul> <li><label>' . __('Default genre:', 'xml-sitemap-feed') . '<br><select multiple name="' . $prefix . 'news_tags[genres][default][]" id="xmlsf_news_tags_genres_default" size="' . count($gn_genres) . '">'; foreach ($gn_genres as $name) { echo ' <option value="' . $name . '" ' . selected(in_array($name, $genres_default), true, false) . '>' . $name . '</option>'; } echo ' </select></label></li> </ul> </fieldset> <p class="description">' . __('Use the Ctrl/Cmd key plus click to select more than one or to deselect.', 'xml-sitemap-feed') . ' ' . sprintf(__('Read more about source labels on %s', 'xml-sitemap-feed'), '<a href="https://support.google.com/news/publisher/answer/4582731" target="_blank">' . __('What does each source label mean?', 'xml-sitemap-feed') . '</a>') . '</p> </fieldset>'; // keywords $keywords = !empty($options['keywords']) ? $options['keywords'] : array(); $keywords_from = !empty($keywords['from']) ? $keywords['from'] : ''; echo ' <fieldset id="xmlsf_news_keywords"><legend class="screen-reader-text"><keywords></legend> ' . sprintf(__('The %s tag is used to help classify the articles you submit to Google News by <strong>topic</strong>.', 'xml-sitemap-feed'), '<strong><keywords></strong>') . ' <ul> <li><label>' . sprintf(__('Use %s for topics.', 'xml-sitemap-feed'), ' <select name="' . $prefix . 'news_tags[keywords][from]" id="xmlsf_news_tags_keywords_from"> <option value="">' . translate('None') . '</option> <option value="category" ' . selected("category" == $keywords_from, true, false) . '>' . translate('Categories') . '</option> <option value="post_tag" ' . selected("post_tag" == $keywords_from, true, false) . '>' . translate('Tags') . '</option> </select>') . '</label></li>'; if ("category" != $keywords_from) { echo ' <li><label>' . __('Default topic(s):', 'xml-sitemap-feed') . ' <input type="text" name="' . $prefix . 'news_tags[keywords][default]" id="xmlsf_news_tags_keywords_default" value="'; echo !empty($keywords['default']) ? $keywords['default'] : ''; echo '" class="regular-text"></label> <span class="description">' . __('Separate with a comma.', 'xml-sitemap-feed') . '</span></li>'; } echo ' </ul> <p class="description">' . __('Keywords may be drawn from, but are not limited to, the list of <a href="https://support.google.com/news/publisher/answer/116037" target="_blank">existing Google News keywords</a>.', 'xml-sitemap-feed') . '</p> </fieldset>'; }
public function news_labels_field() { echo ' <fieldset id="xmlsf_news_labels"><legend class="screen-reader-text">' . __('Source labels', 'xml-sitemap-feed') . '</legend>' . __('You can use the <access> and <genres> tags to provide Google more information about the content of your articles.', 'xml-sitemap-feed') . ' <a href="https://support.google.com/news/publisher/answer/93992" target="_blank">' . __('More information…', 'xml-sitemap-feed') . '</a> <br><br>'; $options = parent::get_option('news_tags'); $prefix = parent::prefix(); // access tag $access = !empty($options['access']) ? $options['access'] : ''; $access_default = !empty($access['default']) ? $access['default'] : ''; $access_password = !empty($access['password']) ? $access['password'] : ''; echo ' <fieldset id="xmlsf_news_access"><legend class="screen-reader-text">' . __('Access (<access> tag)', 'xml-sitemap-feed') . '</legend> ' . sprintf(__('The <access> tag specifies whether an article is available to all readers (%1$s), or only to those with a free (%2$s) or paid membership (%3$s) to your site.', 'xml-sitemap-feed'), translate('Public'), __('Registration', 'xml-sitemap-feed'), __('Subscription', 'xml-sitemap-feed')) . ' <ul>'; echo ' <li><label>' . __('Tag normal posts as', 'xml-sitemap-feed') . ' <select name="' . $prefix . 'news_tags[access][default]" id="xmlsf_news_tags_access_default"> <option value="">' . translate('Public') . '</option> <option value="Registration" ' . selected("Registration" == $access_default, true, false) . '>' . __('Registration', 'xml-sitemap-feed') . '</option> <option value="Subscription" ' . selected("Subscription" == $access_default, true, false) . '>' . __('Subscription', 'xml-sitemap-feed') . '</option> </select></label></li>'; echo ' <li><label>' . __('Tag Password Protected posts as', 'xml-sitemap-feed') . ' <select name="' . $prefix . 'news_tags[access][password]" id="xmlsf_news_tags_access_password"> <option value="Registration" ' . selected("Registration" == $access_password, true, false) . '>' . __('Registration', 'xml-sitemap-feed') . '</option> <option value="Subscription" ' . selected("Subscription" == $access_password, true, false) . '>' . __('Subscription', 'xml-sitemap-feed') . '</option> </select></label></li>'; echo ' </ul> </fieldset>'; // genres tag $gn_genres = parent::gn_genres(); $genres = !empty($options['genres']) ? $options['genres'] : array(); $genres_default = !empty($genres['default']) ? (array) $genres['default'] : array(); $count = count($gn_genres); echo ' <fieldset id="xmlsf_news_genres"><legend class="screen-reader-text">' . __('Genres (<genres> tag)', 'xml-sitemap-feed') . '</legend> ' . __('The <genres> tag specifies one or more properties for an article, namely, whether it is a press release, a blog post, an opinion, an op-ed piece, user-generated content, or satire.', 'xml-sitemap-feed') . ' ' . __('You can assign more genres when writing a post.', 'xml-sitemap-feed'); echo '<input type="hidden" name="' . $prefix . 'news_tags[genres][active]" value="'; echo !empty($genres['active']) ? $genres['active'] : ''; echo '" />'; /* echo ' <p><label><input type="checkbox" name="'.$prefix.'news_tags[genres][active]" id="xmlsf_news_tags_genres" value="1"'. checked( !empty($genres['active']), true, false).' /> ' .__('Use Google News genres','xml-sitemap-feed').'</label> </p>'; */ echo ' <ul> <li><label>' . __('Default genre:', 'xml-sitemap-feed') . '<br><select multiple name="' . $prefix . 'news_tags[genres][default][]" id="xmlsf_news_tags_genres_default" size="' . $count . '">'; foreach ($gn_genres as $slug => $name) { echo ' <option value="' . $name . '" ' . selected(in_array($name, $genres_default), true, false) . '>' . $name . '</option>'; } echo ' </select></label></li> </ul> </fieldset> <p class="description">' . __('Use the Ctrl/Cmd key plus click to select more than one or to deselect.', 'xml-sitemap-feed') . ' ' . sprintf(__('Read more about source labels on %s', 'xml-sitemap-feed'), '<a href="https://support.google.com/news/publisher/answer/4582731" target="_blank">' . __('What does each source label mean?', 'xml-sitemap-feed') . '</a>') . '</p> </fieldset>'; }