Skip to content

Instantly share code, notes, and snippets.

@lloc
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lloc/21f15fa36e089340c124 to your computer and use it in GitHub Desktop.
Save lloc/21f15fa36e089340c124 to your computer and use it in GitHub Desktop.
Integration, snippets and examples
<?php
$blog = MslsBlogCollection::instance()->get_current_blog();
$language = $blog->get_language();
<?php
function my_custom_menu_item( $items, $args ) {
if ( function_exists ( 'the_msls' ) && 'primary' == $args->theme_location ) {
$obj = new MslsOutput;
$arr = $obj->get( 2 );
if ( !empty( $arr ) ) {
$items .= '<li>' . implode( '</li><li>', $arr ) . '</li>';
}
}
return $items;
}
add_filter( 'wp_nav_menu_items', 'my_custom_menu_item', 10, 2 );
<?php
/**
* MslsLink - Image + text
*/
$arr = $obj->get( 0 );
/**
* MslsLinkTextOnly - Just text
*/
$arr = $obj->get( 1 );
/**
* MslsLinkImageOnly - Just image
*/
$arr = $obj->get( 2 );
/**
* MslsLinkTextImage - Text + image
*/
$arr = $obj->get( 3 );
<?php
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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment