Saturday, 14 September 2013

where to find a number of subdomain in bluehost

where to find a number of subdomain in bluehost

i used wordpress CMS and i want to show 5 recent post from subdomain to
show on main site, the solution i found is
<?php
global $switched;
switch_to_blog(7);
echo 'You switched from blog ' . $switched . ' to 7';
restore_current_blog();
echo 'You switched back.';
?>
or
<?php
switch_to_blog( 2 ); // Switch to the blog that you want to pull posts
from. You can see the ID when you edit a site through the Network Admin -
the URL will look something like
"http://example.com/wp-admin/network/site-info.php?id=2" - you need the
value of "id", in this case "2" ?>
<h2>Recent Posts</h2>
<ul>
<?php
$args = array( 'numberposts' => '5' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ) {
echo '<li><a href="' . get_permalink($recent["ID"]) . '"
title="Look '.esc_attr($recent["post_title"]).'" >' .
$recent["post_title"].'</a> </li> ';
}
?>
</ul>
<?php restore_current_blog(); // Restore the current blog ?>
but id don't know where to find the number of subdomain..where to find
it.. please help

No comments:

Post a Comment