WP_HTML_Open_Elements::at
Returns the node at the nth position on the stack of open elements, or null if no such position exists.
Note that this uses a 1-based index, which represents the "nth item" on the stack, counting from the top, where the top-most element is the 1st, the second is the 2nd, etc...
Метод класса: WP_HTML_Open_Elements{}
Хуков нет.
Возвращает
WP_HTML_Token|null. The node on the stack at the given location, or null if the location isn't on the stack.
Использование
$WP_HTML_Open_Elements = new WP_HTML_Open_Elements(); $WP_HTML_Open_Elements->at( $nth ): ?WP_HTML_Token;
- $nth(int) (обязательный)
- Retrieve the nth item on the stack, with 1 being the top element, 2 being the second, etc.
Список изменений
| С версии 6.7.0 | Введена. |
Код WP_HTML_Open_Elements::at() WP HTML Open Elements::at WP 7.1
public function at( int $nth ): ?WP_HTML_Token {
foreach ( $this->walk_down() as $item ) {
if ( 0 === --$nth ) {
return $item;
}
}
return null;
}