WP_Terms_List_Table::display_rows_or_placeholder() WordPress Method

The WP_Terms_List_Table::display_rows_or_placeholder() method is used to display either a list of terms (if there are any) or a "no terms" message (if there are none). This method is called by the WP_Terms_List_Table::display() method. The WP_Terms_List_Table::display_rows_or_placeholder() method first checks if there are any terms to list. If there are, it calls the WP_Terms_List_Table::display_rows() method to output the terms. If there are no terms, it displays a "no terms" message.

WP_Terms_List_Table::display_rows_or_placeholder() #


Source

File: wp-admin/includes/class-wp-terms-list-table.php

	public function display_rows_or_placeholder() {
		$taxonomy = $this->screen->taxonomy;

		$number = $this->callback_args['number'];
		$offset = $this->callback_args['offset'];

		// Convert it to table rows.
		$count = 0;

		if ( empty( $this->items ) || ! is_array( $this->items ) ) {
			echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
			$this->no_items();
			echo '</td></tr>';
			return;
		}

		if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $this->callback_args['orderby'] ) ) {
			if ( ! empty( $this->callback_args['search'] ) ) {// Ignore children on searches.
				$children = array();
			} else {
				$children = _get_term_hierarchy( $taxonomy );
			}

			/*
			 * Some funky recursion to get the job done (paging & parents mainly) is contained within.
			 * Skip it for non-hierarchical taxonomies for performance sake.
			 */
			$this->_rows( $taxonomy, $this->items, $children, $offset, $number, $count );
		} else {
			foreach ( $this->items as $term ) {
				$this->single_row( $term );
			}
		}
	}

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.