WP_Theme_JSON::append_to_selector() – Function that appends a sub-selector to a existing one.

You appear to be a bot. Output may be restricted

Description

Function that appends a sub-selector to a existing one.

Given the compounded $selector "h1, h2, h3" and the $to_append selector ".some-class" the result will be "h1.some-class, h2.some-class, h3.some-class".

Usage

$string = WP_Theme_JSON::append_to_selector( $selector, $to_append );

Parameters

$selector
( string ) required – Original selector.
$to_append
( string ) required – Selector to append.

Returns

string

Source

File name: wordpress/wp-includes/class-wp-theme-json.php
Lines:

1 to 9 of 9
  protected static function append_to_selector( $selector, $to_append ) {
    $new_selectors = array();
    $selectors     = explode( ',', $selector );
    foreach ( $selectors as $sel ) {
      $new_selectors[] = $sel . $to_append;
    }

    return implode( ',', $new_selectors );
  }
 

 View on GitHub View on Trac