do_shortcode

Definition:
function do_shortcode($content) {}

Search content for shortcodes and filter shortcodes through their hooks.
If there are no shortcode tags defined, then the content will be returned without any filtering. This might cause issues when plugins are disabled but the shortcode will still show up in the post or content.

Parameters

  • string $content: Content to search for shortcodes

Return values

returns:Content with shortcodes filtered out.

Source code

function do_shortcode($content) {

	global $shortcode_tags;



	if (empty($shortcode_tags) || !is_array($shortcode_tags))

		return $content;



	$pattern = get_shortcode_regex();

	return preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );

}

974

do_settings_sections

Definition:
function do_settings_sections($page) {}

Prints out all settings sections added to a particular settings page
Part of the Settings API. Use this in a settings page callback function to output all the sections and fields that were added to that $page with add_settings_section() and add_settings_field()

Parameters

  • string $page: The slug name of the page whos settings sections you want to output

Source code

function do_settings_sections($page) {

	global $wp_settings_sections, $wp_settings_fields;



	if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) )

		return;



	foreach ( (array) $wp_settings_sections[$page] as $section ) {

		echo "<h3>{$section['title']}</h3>\n";

		call_user_func($section['callback'], $section);

		if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) )

			continue;

		echo '<table class="form-table">';

		do_settings_fields($page, $section['id']);

		echo '</table>';

	}

972

do_settings_fields

Definition:
function do_settings_fields($page, $section) {}

Print out the settings fields for a particular settings section
Part of the Settings API. Use this in a settings page to output a specific section. Should normally be called by do_settings_sections() rather than directly.

Parameters

  • string $page: Slug title of the admin page who’s settings fields you want to show.
  • section $section: Slug title of the settings section who’s fields you want to show.

Source code

function do_settings_fields($page, $section) {

	global $wp_settings_fields;



	if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )

		return;



	foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {

		echo '<tr valign="top">';

		if ( !empty($field['args']['label_for']) )

			echo '<th scope="row"><label for="' . $field['args']['label_for'] . '">' . $field['title'] . '</label></th>';

		else

			echo '<th scope="row">' . $field['title'] . '</th>';

		echo '<td>';

		call_user_func($field['callback'], $field['args']);

		echo '</td>';

		echo '</tr>';

	}

}

970

do_robots

Definition:
function do_robots() {}

Display the robots.txt file content.
The echo content should be with usage of the permalinks or for creating the robots.txt file.

Defined filters

  • robots_txt
    apply_filters('robots_txt', $output, $public)

Defined actions

  • do_robotstxt
    do_action( 'do_robotstxt' );

Source code

function do_robots() {

	header( 'Content-Type: text/plain; charset=utf-8' );



	do_action( 'do_robotstxt' );



	$output = "User-agent: *\n";

	$public = get_option( 'blog_public' );

	if ( '0' == $public ) {

		$output .= "Disallow: /\n";

	} else {

		$site_url = parse_url( site_url() );

		$path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';

		$output .= "Disallow: $path/wp-admin/\n";

		$output .= "Disallow: $path/wp-includes/\n";

	}



	echo apply_filters('robots_txt', $output, $public);

}

968