'ChatGPT search', 'ChatGPT-User' => 'ChatGPT, when a user asks it to read a page', 'GPTBot' => 'OpenAI model training', 'Claude-SearchBot' => 'Claude search', 'Claude-User' => 'Claude, when a user asks it to read a page', 'ClaudeBot' => 'Anthropic model training', 'PerplexityBot' => 'Perplexity search', 'Perplexity-User' => 'Perplexity, when a user asks it to read a page', 'Google-Extended' => 'Gemini use of Google\'s crawl', 'Applebot-Extended' => 'Apple Intelligence', ); /** * Register hooks. */ public static function init(): void { add_filter( 'robots_txt', array( __CLASS__, 'robots' ), 20, 2 ); add_action( 'parse_request', array( __CLASS__, 'maybe_llms' ), 0 ); add_action( 'wp_head', array( __CLASS__, 'markup' ), 20 ); add_action( 'admin_post_outercite_fixes', array( __CLASS__, 'handle_save' ) ); add_action( 'add_meta_boxes', array( __CLASS__, 'meta_box' ), 10, 2 ); add_action( 'save_post', array( __CLASS__, 'save_meta_box' ) ); add_action( 'save_post_page', array( __CLASS__, 'forget_llms' ) ); } /** * Stored settings. * * @return array */ public static function settings(): array { $saved = get_option( self::OPTION, array() ); return is_array( $saved ) ? $saved : array(); } // AI crawler access. /** * Is there a real robots.txt that WordPress's own cannot change? */ public static function robots_file_exists(): bool { return file_exists( self::root_file( 'robots.txt' ) ); } /** * The lines that let the AI crawlers in. */ public static function robots_lines(): string { $out = "# Outercite: let AI answer engines read this site\n"; foreach ( array_keys( self::CRAWLERS ) as $agent ) { $out .= 'User-agent: ' . $agent . "\nAllow: /\n\n"; } return $out; } /** * Add the lines to WordPress's robots.txt when the fix is on. * * @param string $output Robots.txt so far. * @param bool $is_public Whether the site allows search engines. */ public static function robots( $output, $is_public ): string { if ( empty( self::settings()['crawlers'] ) || ! $is_public ) { return (string) $output; } return rtrim( (string) $output ) . "\n\n" . self::robots_lines(); } /** * Which AI crawlers the site's robots.txt shuts out today. * * @return array{ok:bool,blocked:string[],error:string} */ public static function crawler_check(): array { if ( ! get_option( 'blog_public' ) ) { return array( 'ok' => true, 'blocked' => array_keys( self::CRAWLERS ), 'error' => __( 'Settings, Reading asks search engines not to index this site, which also shuts out AI crawlers.', 'outercite' ), ); } $groups = self::parse_robots( self::robots_text() ); $out = array(); foreach ( array_keys( self::CRAWLERS ) as $agent ) { $rules = $groups[ strtolower( $agent ) ] ?? ( $groups['*'] ?? array() ); if ( in_array( '/', $rules['disallow'] ?? array(), true ) && ! in_array( '/', $rules['allow'] ?? array(), true ) ) { $out[] = $agent; } } return array( 'ok' => true, 'blocked' => $out, 'error' => '', ); } /** * A file in the site's public root, which is not always where WordPress * itself is installed (WordPress in its own folder). * * @param string $name File name. */ private static function root_file( string $name ): string { if ( ! function_exists( 'get_home_path' ) ) { require_once ABSPATH . 'wp-admin/includes/file.php'; } return trailingslashit( get_home_path() ) . $name; } /** * The robots.txt crawlers get: the real file when there is one, otherwise * what WordPress itself serves, with every plugin's additions. */ public static function robots_text(): string { $file = self::root_file( 'robots.txt' ); if ( file_exists( $file ) && is_readable( $file ) ) { return (string) file_get_contents( $file ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- a local file. } $public = (bool) get_option( 'blog_public' ); $path = (string) wp_parse_url( site_url(), PHP_URL_PATH ); $text = "User-agent: *\n"; $text .= $public ? 'Disallow: ' . $path . "/wp-admin/\nAllow: " . $path . "/wp-admin/admin-ajax.php\n" : "Disallow: /\n"; return (string) apply_filters( 'robots_txt', $text, $public ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WordPress's own filter. } /** * Robots.txt groups: user agent to its Allow and Disallow paths. * * @param string $text Robots.txt. * @return array */ public static function parse_robots( string $text ): array { $groups = array(); $current = array(); $in_rule = false; foreach ( preg_split( '/\r\n|\r|\n/', $text ) as $line ) { $line = trim( (string) preg_replace( '/#.*$/', '', (string) $line ) ); if ( ! preg_match( '/^([A-Za-z-]+)\s*:\s*(.*)$/', $line, $m ) ) { continue; } $field = strtolower( $m[1] ); $value = trim( $m[2] ); if ( 'user-agent' === $field ) { if ( $in_rule ) { $current = array(); $in_rule = false; } $current[] = strtolower( $value ); foreach ( $current as $agent ) { $groups[ $agent ] = $groups[ $agent ] ?? array( 'allow' => array(), 'disallow' => array(), ); } continue; } if ( 'allow' === $field || 'disallow' === $field ) { $in_rule = true; if ( '' === $value ) { continue; } foreach ( $current as $agent ) { $groups[ $agent ][ $field ][] = $value; } } } return $groups; } // The llms.txt file. /** * Serve /llms.txt when the fix is on, before WordPress looks for a page. */ public static function maybe_llms(): void { if ( empty( self::settings()['llms'] ) ) { return; } $path = (string) wp_parse_url( home_url( '/llms.txt' ), PHP_URL_PATH ); $req = isset( $_SERVER['REQUEST_URI'] ) ? (string) wp_parse_url( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), PHP_URL_PATH ) : ''; if ( $req !== $path ) { return; } header( 'Content-Type: text/plain; charset=utf-8' ); header( 'X-Robots-Tag: noindex' ); echo self::llms(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- plain text, built from escaped-free titles and addresses on purpose. exit; } /** * The site's llms.txt: what the business is, and its key pages. * Built from this site's pages and the facts kept here; cached until a page changes. */ public static function llms(): string { $cached = get_transient( 'outercite_llms' ); if ( is_string( $cached ) ) { return $cached; } $s = self::settings(); $name = (string) ( $s['org_name'] ?? '' ); $name = '' !== $name ? $name : wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); $about = (string) ( $s['org_description'] ?? '' ); $about = '' !== $about ? $about : wp_specialchars_decode( get_bloginfo( 'description' ), ENT_QUOTES ); $out = '# ' . self::one_line( $name ) . "\n\n"; if ( '' !== $about ) { $out .= '> ' . self::one_line( $about ) . "\n\n"; } $key = array(); $front = (int) get_option( 'page_on_front' ); if ( $front ) { $key[ $front ] = get_post( $front ); } foreach ( get_posts( array( 'post_type' => 'page', 'post_status' => 'publish', 'posts_per_page' => 50, 'orderby' => 'menu_order title', 'order' => 'ASC', 'has_password' => false, ) ) as $page ) { $key[ $page->ID ] = $page; } $out .= "## Pages\n\n"; foreach ( array_filter( $key ) as $page ) { $summary = self::one_line( wp_trim_words( wp_strip_all_tags( strip_shortcodes( (string) ( $page->post_excerpt ? $page->post_excerpt : $page->post_content ) ) ), 24, '...' ) ); $out .= '- [' . self::one_line( get_the_title( $page ) ) . '](' . get_permalink( $page ) . ')' . ( '' !== $summary ? ': ' . $summary : '' ) . "\n"; } $posts = get_posts( array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 20, 'has_password' => false, ) ); if ( $posts ) { $out .= "\n## Recent articles\n\n"; foreach ( $posts as $post ) { $out .= '- [' . self::one_line( get_the_title( $post ) ) . '](' . get_permalink( $post ) . ")\n"; } } set_transient( 'outercite_llms', $out, DAY_IN_SECONDS ); return $out; } /** * Text on one line, without markdown-breaking brackets. * * @param string $text Text. */ private static function one_line( string $text ): string { $text = html_entity_decode( $text, ENT_QUOTES | ENT_HTML5, 'UTF-8' ); return trim( (string) preg_replace( '/\s+/', ' ', str_replace( array( '[', ']' ), array( '(', ')' ), $text ) ) ); } /** * A page changed: rebuild llms.txt on the next request, and clear the host's cache of it. */ public static function forget_llms(): void { delete_transient( 'outercite_llms' ); if ( ! empty( self::settings()['llms'] ) ) { Tracking::purge_page_cache(); } } // Organisation and FAQ markup. /** * Is a known SEO plugin already printing organisation markup? */ public static function seo_plugin(): string { if ( defined( 'WPSEO_VERSION' ) ) { return 'Yoast SEO'; } if ( class_exists( '\RankMath' ) ) { return 'Rank Math'; } if ( defined( 'AIOSEO_VERSION' ) ) { return 'All in One SEO'; } if ( defined( 'SEOPRESS_VERSION' ) ) { return 'SEOPress'; } return ''; } /** * The organisation markup, from the facts kept here. * * @return array */ public static function organization(): array { return self::organization_from( self::settings() ); } /** * Organisation markup from a set of settings. * * @param array $s Settings. * @return array */ public static function organization_from( array $s ): array { $org = array( '@context' => 'https://schema.org', '@type' => (string) ( $s['org_type'] ?? 'Organization' ), 'name' => (string) ( $s['org_name'] ?? get_bloginfo( 'name' ) ), 'url' => home_url( '/' ), ); if ( ! empty( $s['org_description'] ) ) { $org['description'] = (string) $s['org_description']; } $logo = (int) get_theme_mod( 'custom_logo' ); if ( $logo && wp_get_attachment_image_url( $logo, 'full' ) ) { $org['logo'] = (string) wp_get_attachment_image_url( $logo, 'full' ); } if ( ! empty( $s['org_phone'] ) ) { $org['telephone'] = (string) $s['org_phone']; } $address = array_filter( (array) ( $s['org_address'] ?? array() ) ); if ( $address ) { $org['address'] = array_merge( array( '@type' => 'PostalAddress' ), $address ); } $same = array_values( array_filter( array_map( 'esc_url_raw', (array) ( $s['org_same_as'] ?? array() ) ) ) ); if ( $same ) { $org['sameAs'] = $same; } return $org; } /** * Questions and answers in a page: headings that end in a question mark, * each answered by the text up to the next heading. * * @param \WP_Post $post The page. * @return array */ public static function faqs( \WP_Post $post ): array { $html = (string) preg_replace( '//s', '', (string) $post->post_content ); $html = strip_shortcodes( $html ); if ( ! preg_match_all( '#]*>(.*?)#is', $html, $m, PREG_OFFSET_CAPTURE ) ) { return array(); } $out = array(); $count = count( $m[0] ); for ( $i = 0; $i < $count; $i++ ) { $q = trim( html_entity_decode( wp_strip_all_tags( $m[2][ $i ][0] ), ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ); if ( '?' !== substr( $q, -1 ) ) { continue; } $start = $m[0][ $i ][1] + strlen( $m[0][ $i ][0] ); $end = $i + 1 < $count ? $m[0][ $i + 1 ][1] : strlen( $html ); $a = trim( (string) preg_replace( '/\s+/', ' ', html_entity_decode( wp_strip_all_tags( substr( $html, $start, $end - $start ) ), ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ) ); if ( '' !== $a ) { $out[] = array( 'q' => $q, 'a' => $a, ); } } return array_slice( $out, 0, 20 ); } /** * FAQ markup for a page, or null when it has no questions. * * @param \WP_Post $post The page. * @return array|null */ public static function faq_markup( \WP_Post $post ): ?array { $faqs = self::faqs( $post ); if ( ! $faqs ) { return null; } return array( '@context' => 'https://schema.org', '@type' => 'FAQPage', 'mainEntity' => array_map( static function ( $f ) { return array( '@type' => 'Question', 'name' => $f['q'], 'acceptedAnswer' => array( '@type' => 'Answer', 'text' => $f['a'], ), ); }, $faqs ), ); } /** * Print the markup turned on for this request. */ public static function markup(): void { $s = self::settings(); $json = array(); if ( ! empty( $s['org'] ) && ( is_front_page() || is_home() ) ) { $json[] = self::organization(); } if ( is_singular() ) { $post = get_queried_object(); if ( $post instanceof \WP_Post && get_post_meta( $post->ID, self::FAQ, true ) && ! post_password_required( $post ) ) { $faq = self::faq_markup( $post ); if ( $faq ) { $json[] = $faq; } } } foreach ( $json as $item ) { echo '\n"; } } /** * The FAQ markup box on the edit screen. * * @param string $post_type Post type being edited. * @param \WP_Post $post The post. */ public static function meta_box( $post_type, $post ): void { if ( ! $post instanceof \WP_Post || ! in_array( $post_type, array( 'page', 'post' ), true ) || ! current_user_can( Roles::DRAFTS ) ) { return; } add_meta_box( 'outercite-faq', __( 'Outercite: FAQ markup', 'outercite' ), array( __CLASS__, 'render_meta_box' ), null, 'side', 'low' ); } /** * Render the FAQ markup box, with a preview of what it would add. * * @param \WP_Post $post The post. */ public static function render_meta_box( \WP_Post $post ): void { wp_nonce_field( 'outercite_faq_' . $post->ID, 'outercite_faq_nonce' ); $faqs = self::faqs( $post ); printf( '

', checked( (bool) get_post_meta( $post->ID, self::FAQ, true ), true, false ), esc_html__( 'Add FAQ markup for the questions on this page', 'outercite' ) ); if ( ! $faqs ) { echo '

' . esc_html__( 'No questions found yet. Write each question as a heading that ends with a question mark, with its answer below it. Save to check again.', 'outercite' ) . '

'; return; } echo '

' . esc_html( sprintf( /* translators: %d: number of questions */ _n( '%d question found:', '%d questions found:', count( $faqs ), 'outercite' ), count( $faqs ) ) ) . '

    '; foreach ( $faqs as $f ) { echo '
  • ' . esc_html( $f['q'] ) . '
  • '; } echo '
'; } /** * Save the FAQ markup switch. * * @param int $post_id Post ID. */ public static function save_meta_box( $post_id ): void { if ( ! isset( $_POST['outercite_faq_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['outercite_faq_nonce'] ) ), 'outercite_faq_' . $post_id ) ) { return; } if ( wp_is_post_revision( $post_id ) || ! current_user_can( 'edit_post', $post_id ) || ! current_user_can( Roles::DRAFTS ) ) { return; } $on = ! empty( $_POST['outercite_faq'] ); $was = (bool) get_post_meta( $post_id, self::FAQ, true ); if ( $on ) { update_post_meta( $post_id, self::FAQ, 1 ); } else { delete_post_meta( $post_id, self::FAQ ); } if ( $on !== $was ) { Activity::add( 'faq', $on ? __( 'Turned FAQ markup on for a page', 'outercite' ) : __( 'Turned FAQ markup off for a page', 'outercite' ), (int) $post_id ); } } // Settings. /** * Save the site fixes tab. */ public static function handle_save(): void { check_admin_referer( 'outercite_fixes' ); if ( ! current_user_can( Roles::CONNECT ) ) { wp_die( esc_html__( 'You are not allowed to do that.', 'outercite' ) ); } $before = self::settings(); $text = static function ( string $key, int $max = 200 ): string { return isset( $_POST[ $key ] ) ? substr( sanitize_text_field( wp_unslash( $_POST[ $key ] ) ), 0, $max ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing -- checked above. }; // phpcs:disable WordPress.Security.NonceVerification.Missing -- checked above. $same = isset( $_POST['org_same_as'] ) ? array_slice( array_filter( array_map( 'esc_url_raw', array_map( 'trim', preg_split( '/[\r\n]+/', sanitize_textarea_field( wp_unslash( $_POST['org_same_as'] ) ) ) ) ) ), 0, 10 ) : array(); $types = array( 'Organization', 'LocalBusiness', 'ProfessionalService', 'Dentist', 'MedicalBusiness', 'LegalService', 'Store', 'Restaurant', 'HomeAndConstructionBusiness' ); $type = $text( 'org_type', 40 ); $after = array( 'crawlers' => ! empty( $_POST['crawlers'] ) ? 1 : 0, 'llms' => ! empty( $_POST['llms'] ) ? 1 : 0, 'org' => ! empty( $_POST['org'] ) ? 1 : 0, 'org_type' => in_array( $type, $types, true ) ? $type : 'Organization', 'org_name' => $text( 'org_name' ), 'org_description' => $text( 'org_description', 300 ), 'org_phone' => $text( 'org_phone', 40 ), 'org_address' => array( 'streetAddress' => $text( 'org_street' ), 'addressLocality' => $text( 'org_city', 80 ), 'addressRegion' => $text( 'org_region', 80 ), 'postalCode' => $text( 'org_postcode', 20 ), 'addressCountry' => $text( 'org_country', 2 ), ), 'org_same_as' => $same, ); // phpcs:enable update_option( self::OPTION, $after, false ); delete_transient( 'outercite_llms' ); $labels = array( 'crawlers' => __( 'AI crawler access', 'outercite' ), 'llms' => __( 'llms.txt', 'outercite' ), 'org' => __( 'organisation markup', 'outercite' ), ); foreach ( $labels as $key => $label ) { if ( (int) ( $before[ $key ] ?? 0 ) !== (int) $after[ $key ] ) { Activity::add( 'fix', sprintf( /* translators: %s: name of the fix */ $after[ $key ] ? __( 'Turned on %s', 'outercite' ) : __( 'Turned off %s', 'outercite' ), $label ) ); } } Tracking::purge_page_cache(); Admin::flash( 'success', __( 'Site fixes saved.', 'outercite' ) ); wp_safe_redirect( Admin::settings_url( array( 'tab' => 'fixes' ) ) ); exit; } /** * Fill empty organisation fields from what the business told Outercite. * * @param array $s Settings. * @return array */ private static function with_profile( array $s ): array { if ( ! Connection::is_linked() ) { return $s; } $res = Ledger::profile(); if ( ! $res['ok'] || ! is_array( $res['data'] ) ) { return $s; } $p = $res['data']; $addr = (array) ( $p['address'] ?? array() ); $fill = array( 'org_name' => (string) ( $p['businessName'] ?? '' ), 'org_description' => (string) ( $p['description'] ?? '' ), 'org_phone' => (string) ( $p['phone'] ?? '' ), ); foreach ( $fill as $key => $value ) { if ( empty( $s[ $key ] ) && '' !== $value ) { $s[ $key ] = $value; } } $map = array( 'streetAddress' => 'street', 'addressLocality' => 'city', 'addressRegion' => 'region', 'postalCode' => 'postcode', 'addressCountry' => 'country', ); foreach ( $map as $field => $from ) { if ( empty( $s['org_address'][ $field ] ) && ! empty( $addr[ $from ] ) ) { $s['org_address'][ $field ] = (string) $addr[ $from ]; } } return $s; } /** * The site fixes tab on the settings screen. */ public static function render(): void { $s = self::with_profile( self::settings() ); $post_action = admin_url( 'admin-post.php' ); echo '
'; wp_nonce_field( 'outercite_fixes' ); echo ''; // AI crawler access. echo '

' . esc_html__( 'AI crawler access', 'outercite' ) . '

'; $check = self::crawler_check(); if ( ! $check['ok'] ) { echo '

' . esc_html( $check['error'] ) . '

'; } elseif ( $check['blocked'] ) { echo '

' . esc_html( sprintf( /* translators: %s: crawler names */ __( 'robots.txt shuts out: %s. AI answers cannot read or cite pages these crawlers are kept from.', 'outercite' ), implode( ', ', $check['blocked'] ) ) ) . ( '' !== $check['error'] ? ' ' . esc_html( $check['error'] ) : '' ) . '

'; } else { echo '

' . esc_html__( 'robots.txt lets the AI crawlers in.', 'outercite' ) . '

'; } if ( self::robots_file_exists() ) { echo '

' . esc_html__( 'This site has a robots.txt file on the server, which WordPress cannot change. Add these lines to it, or ask your host to:', 'outercite' ) . '

'; echo ''; echo '

'; } else { printf( '', checked( ! empty( $s['crawlers'] ), true, false ), esc_html__( 'Let AI answer engines read this site (adds Allow lines to robots.txt)', 'outercite' ) ); } echo '
' . esc_html__( 'Which crawlers', 'outercite' ) . '
    '; foreach ( self::CRAWLERS as $agent => $what ) { echo '
  • ' . esc_html( $agent ) . ' ' . esc_html( $what ) . '
  • '; } echo '
'; // llms.txt. $file = file_exists( trailingslashit( ABSPATH ) . 'llms.txt' ); echo '

llms.txt

'; echo '

' . esc_html__( 'A short file at the site root that tells AI tools what the business is and lists its key pages. It is rebuilt when a page changes.', 'outercite' ) . '

'; if ( $file ) { echo '

' . esc_html__( 'This site already has an llms.txt file on the server, which is served instead. Remove it to use this one.', 'outercite' ) . '

'; } printf( '', checked( ! empty( $s['llms'] ), true, false ), disabled( $file, true, false ), esc_html__( 'Serve llms.txt', 'outercite' ), esc_url( home_url( '/llms.txt' ) ), esc_html__( 'View', 'outercite' ) ); echo '
' . esc_html__( 'Preview', 'outercite' ) . '
' . esc_html( self::llms() ) . '
'; // Organisation markup. echo '

' . esc_html__( 'Organisation markup', 'outercite' ) . '

'; echo '

' . esc_html__( 'Tells AI answers and search engines who the business is, on the home page. Empty fields are filled from what the business told Outercite.', 'outercite' ) . '

'; $seo = self::seo_plugin(); if ( '' !== $seo ) { echo '

' . esc_html( sprintf( /* translators: %s: SEO plugin name */ __( '%s already adds organisation markup. Turn this on only if it is switched off there, so the page does not say it twice.', 'outercite' ), $seo ) ) . '

'; } printf( '', checked( ! empty( $s['org'] ), true, false ), esc_html__( 'Add organisation markup to the home page', 'outercite' ) ); echo ''; $addr = (array) ( $s['org_address'] ?? array() ); $fields = array( 'org_name' => array( __( 'Business name', 'outercite' ), (string) ( $s['org_name'] ?? '' ) ), 'org_description' => array( __( 'One-line description', 'outercite' ), (string) ( $s['org_description'] ?? '' ) ), 'org_phone' => array( __( 'Phone', 'outercite' ), (string) ( $s['org_phone'] ?? '' ) ), 'org_street' => array( __( 'Street address', 'outercite' ), (string) ( $addr['streetAddress'] ?? '' ) ), 'org_city' => array( __( 'Suburb or city', 'outercite' ), (string) ( $addr['addressLocality'] ?? '' ) ), 'org_region' => array( __( 'State or region', 'outercite' ), (string) ( $addr['addressRegion'] ?? '' ) ), 'org_postcode' => array( __( 'Postcode', 'outercite' ), (string) ( $addr['postalCode'] ?? '' ) ), 'org_country' => array( __( 'Country code, such as AU', 'outercite' ), (string) ( $addr['addressCountry'] ?? '' ) ), ); echo ''; foreach ( $fields as $name => $def ) { echo ''; } echo ''; echo ''; echo '
' . esc_html__( 'Preview', 'outercite' ) . '
' . esc_html( (string) wp_json_encode( self::organization_from( $s ), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ) . '
'; echo '
'; // FAQ markup. echo '

' . esc_html__( 'FAQ markup, page by page', 'outercite' ) . '

'; echo '

' . esc_html__( 'Turn it on in the "Outercite: FAQ markup" box on a page\'s edit screen. It lists the questions it found, so you see what it adds before you save.', 'outercite' ) . '

'; $on = get_posts( array( 'post_type' => array( 'page', 'post' ), 'post_status' => 'publish', 'posts_per_page' => 50, 'meta_key' => self::FAQ, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- settings screen only. ) ); if ( $on ) { echo '
    '; foreach ( $on as $p ) { echo '
  • ' . esc_html( get_the_title( $p ) ) . ' (' . esc_html( sprintf( /* translators: %d: number of questions */ _n( '%d question', '%d questions', count( self::faqs( $p ) ), 'outercite' ), count( self::faqs( $p ) ) ) ) . ')
  • '; } echo '
'; } else { echo '

' . esc_html__( 'No pages have FAQ markup yet.', 'outercite' ) . '

'; } echo '
'; echo '
'; } }