Created
August 6, 2017 02:58
-
-
Save miklb/2688093d71849f8cb18859354cadd071 to your computer and use it in GitHub Desktop.
function to map mf2 types to post formats props @dshanske
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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