WordPress.org

Make WordPress Core

Ticket #15863: include-parent-theme-rtl-css.php

File include-parent-theme-rtl-css.php, 622 bytes (added by SergeyBiryukov, 4 years ago)
Line 
1<?php
2/*
3Plugin Name: Include Parent Theme RTL CSS
4Version: 0.1
5Plugin URI: http://core.trac.wordpress.org/ticket/15863
6Description: Allows to include a parent theme RTL stylesheet from a child theme.
7Author: Sergey Biryukov
8*/
9
10function iptrtl_add_stylesheet() {
11        $template_dir_uri = get_template_directory_uri();
12        $template_dir = get_template_directory();
13
14        if ( is_child_theme() && file_exists("$template_dir/rtl.css") ) {
15                wp_register_style( 'parent-theme-rtl', "$template_dir_uri/rtl.css" );
16                wp_enqueue_style( 'parent-theme-rtl' );
17        }
18}
19add_action('wp_print_styles', 'iptrtl_add_stylesheet');
20?>