Advertisements

get_the_generator

Definition:
function get_the_generator( $type = '' ) {}

Creates the generator XML or Comment for RSS, ATOM, etc.
Returns the correct generator type for the requested output format. Allows for a plugin to filter generators on an individual basis using the ‘get_the_generator_{$type}’ filter.

Parameters

  • string $type: The type of generator to return – (html|xhtml|atom|rss2|rdf|comment|export).

Return values

returns:The HTML content for the generator.

Defined filters

  • get_the_generator_{$type}
    apply_filters( "get_the_generator_{$type}", $gen, $type )

Source code

function get_the_generator( $type = '' ) {

	if ( empty( $type ) ) {



		$current_filter = current_filter();

		if ( empty( $current_filter ) )

			return;



		switch ( $current_filter ) {

			case 'rss2_head' :

			case 'commentsrss2_head' :

				$type = 'rss2';

				break;

			case 'rss_head' :

			case 'opml_head' :

				$type = 'comment';

				break;

			case 'rdf_header' :

				$type = 'rdf';

				break;

			case 'atom_head' :

			case 'comments_atom_head' :

			case 'app_head' :

				$type = 'atom';

				break;

		}

	}



	switch ( $type ) {

		case 'html':

			$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">';

			break;

		case 'xhtml':

			$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />';

			break;

		case 'atom':

			$gen = '<generator uri="http://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>';

			break;

		case 'rss2':

			$gen = '<generator>http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>';

			break;

		case 'rdf':

			$gen = '<admin:generatorAgent rdf:resource="http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />';

			break;

		case 'comment':

			$gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->';

			break;

		case 'export':

			$gen = '<!-- generator="WordPress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '" -->';

			break;

	}

	return apply_filters( "get_the_generator_{$type}", $gen, $type );

1831

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: