-
-
Notifications
You must be signed in to change notification settings - Fork 42
Use the blog collection in your functions (and filters)
lloc edited this page Feb 10, 2013
·
7 revisions
If you want to use the collection of blogs which created the plugin in your functions (and filters) you can write code like this:
function my_print_something() {
foreach ( MslsBlogCollection::instance()->get() as $blog ) {
printf(
'<link rel="alternate" hreflang="%1$s" href="http://%1$s.example.com/" />'
$blog->get_language()
);
}
}
add_action( 'wp_head', 'my_print_something' );
The above code prints the link references to your blogs in all html headers of the frontend output.