Add the RTL style to the Child Theme

This is a Developer Level doc.

If you're unfamiliar with PHP and/or editing files, codes and templates, as well as with resolving possible conflict, please seek help from a professional. Under our Support Policy, we don't provide support for modifications and customization.

Load the RTL stylesheet from the parent theme into the child theme by using the following PHP snippet:

/**
 * Load the parent rtl.css file
 */
function oceanwp_child_enqueue_rtl_style() {
	// Dynamically get version number of the parent stylesheet
	$theme   = wp_get_theme( 'OceanWP' );
	$version = $theme->get( 'Version' );
	// Load the stylesheet
	if ( is_rtl() ) {
		wp_enqueue_style( 'oceanwp-rtl', get_template_directory_uri() . '/rtl.css', array('oceanwp-style'), $version );
	}
	
}
add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_rtl_style' );

All PHP snippets should be added via a child theme's functions.php file.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.