get_clean_basedomain

Definition:
function get_clean_basedomain() {}

Get base domain of network.

Return values

returns:Base domain.

Source code

function get_clean_basedomain() {

	if ( $existing_domain = network_domain_check() )

		return $existing_domain;

	$domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );

	if ( $slash = strpos( $domain, '/' ) )

		$domain = substr( $domain, 0, $slash );

	return $domain;

}

1270

get_children

Definition:
function get_children($args = '', $output = OBJECT) {}

Retrieve all children of the post parent ID.
Normally, without any enhancements, the children would apply to pages. In the context of the inner workings of WordPress, pages, posts, and attachments share the same table, so therefore the functionality could apply to any one of them. It is then noted that while this function does not work on posts, it does not mean that it won’t work on posts. It is recommended that you know what context you wish to retrieve the children of.

Parameters

  • mixed $args: Optional. User defined arguments for replacing the defaults.
  • string $output: Optional. Constant for return type, either OBJECT (default), ARRAY_A, ARRAY_N.

Return values

returns:False on failure and the type will be determined by $output parameter.

Source code

function get_children($args = '', $output = OBJECT) {

	$kids = array();

	if ( empty( $args ) ) {

		if ( isset( $GLOBALS['post'] ) ) {

			$args = array('post_parent' => (int) $GLOBALS['post']->post_parent );

		} else {

			return $kids;

		}

	} elseif ( is_object( $args ) ) {

		$args = array('post_parent' => (int) $args->post_parent );

	} elseif ( is_numeric( $args ) ) {

		$args = array('post_parent' => (int) $args);

	}



	$defaults = array(

		'numberposts' => -1, 'post_type' => 'any',

		'post_status' => 'any', 'post_parent' => 0,

	);



	$r = wp_parse_args( $args, $defaults );



	$children = get_posts( $r );



	if ( !$children )

		return $kids;



	update_post_cache($children);



	foreach ( $children as $key => $child )

		$kids[$child->ID] = $children[$key];



	if ( $output == OBJECT ) {

		return $kids;

	} elseif ( $output == ARRAY_A ) {

		foreach ( (array) $kids as $kid )

			$weeuns[$kid->ID] = get_object_vars($kids[$kid->ID]);

		return $weeuns;

	} elseif ( $output == ARRAY_N ) {

		foreach ( (array) $kids as $kid )

			$babes[$kid->ID] = array_values(get_object_vars($kids[$kid->ID]));

		return $babes;

	} else {

		return $kids;

	}

}

1268

get_cat_name

Definition:
function get_cat_name( $cat_id ) {}

Retrieve the name of a category from its ID.

Parameters

  • int $cat_id: Category ID

Return values

returns:Category name, or an empty string if category doesn’t exist.

Source code

function get_cat_name( $cat_id ) {

	$cat_id = (int) $cat_id;

	$category = &get_category( $cat_id );

	if ( ! $category || is_wp_error( $category ) )

		return '';

	return $category->name;

}

1266

get_cat_ID

Definition:
function get_cat_ID( $cat_name='General' ) {}

Retrieve the ID of a category from its name.

Parameters

  • string $cat_name: Optional. Default is ‘General’ and can be any category name.

Return values

returns:0, if failure and ID of category on success.

Source code

function get_cat_ID( $cat_name='General' ) {

	$cat = get_term_by( 'name', $cat_name, 'category' );

	if ( $cat )

		return $cat->term_id;

	return 0;

}

1264

get_catname

Definition:
function get_catname( $cat_ID ) {}

Retrieve the category name by the category ID.

Parameters

  • int $cat_ID: Category ID

Return values

returns:category name

Source code

function get_catname( $cat_ID ) {

	_deprecated_function( __FUNCTION__, '2.8', 'get_cat_name()' );

	return get_cat_name( $cat_ID );

}

1262