Skip to content

Instantly share code, notes, and snippets.

@miklb
Created August 6, 2017 02:58
Show Gist options
  • Save miklb/2688093d71849f8cb18859354cadd071 to your computer and use it in GitHub Desktop.
Save miklb/2688093d71849f8cb18859354cadd071 to your computer and use it in GitHub Desktop.
function to map mf2 types to post formats props @dshanske
function mf2_s_template_type() {
if (function_exists('get_post_kind') )
{
/* Use kinds for specific templates
*/
$name = get_post_kind_slug();
}
else {
/* Otherwise use post formats for templates
* For those post formats that have post kind
* analogues - use the closest equivalent
* comment out if needed
*/
$name = get_post_format();
if ( false === $name ) {
$name = 'article';
}
else{
switch($name)
{
case 'image':
$name = 'photo';
break;
case 'aside':
$name = 'note';
break;
case 'status':
$name = 'note';
break;
case 'link':
$name = 'bookmark';
break;
case 'quote':
$name = "quote";
break;
}
}
}
return $name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment