Skip to content

Instantly share code, notes, and snippets.

@lloc lloc/integration.md
Last active Aug 29, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.