WP_Sitemaps_Stylesheet::get_stylesheet_css() WordPress Method

The WP_Sitemaps_Stylesheet::get_stylesheet_css() method is used to return the CSS for the sitemap stylesheet.

WP_Sitemaps_Stylesheet::get_stylesheet_css() #

Gets the CSS to be included in sitemap XSL stylesheets.


Return

(string) The CSS.


Top ↑

Source

File: wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php

258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
    public function get_stylesheet_css() {
        $text_align = is_rtl() ? 'right' : 'left';
 
        $css = <<<EOF
 
                    body {
                        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
                        color: #444;
                    }
 
                    #sitemap {
                        max-width: 980px;
                        margin: 0 auto;
                    }
 
                    #sitemap__table {
                        width: 100%;
                        border: solid 1px #ccc;
                        border-collapse: collapse;
                    }
 
                    #sitemap__table tr td.loc {
                        /*
                         * URLs should always be LTR.
                         * See https://core.trac.wordpress.org/ticket/16834
                         * and https://core.trac.wordpress.org/ticket/49949
                         */
                        direction: ltr;
                    }
 
                    #sitemap__table tr th {
                        text-align: {$text_align};
                    }
 
                    #sitemap__table tr td,
                    #sitemap__table tr th {
                        padding: 10px;
                    }
 
                    #sitemap__table tr:nth-child(odd) td {
                        background-color: #eee;
                    }
 
                    a:hover {
                        text-decoration: none;
                    }
 
EOF;
 
        /**
         * Filters the CSS only for the sitemap stylesheet.
         *
         * @since 5.5.0
         *
         * @param string $css CSS to be applied to default XSL file.
         */
        return apply_filters( 'wp_sitemaps_stylesheet_css', $css );
    }


Top ↑

Changelog

Changelog
VersionDescription
5.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.