I’ve the next information coming from my WP Relaxation API by way of https://cms.dboxcg.com/index.php/wp-json/wp/v2/taxonomies
:
{
"class": {
"title": "Classes",
"slug": "class",
"description": "",
"sorts": [
"post"
],
"hierarchical": true,
"rest_base": "classes",
"_links": {
"assortment": [
{
"href": "https://cms.dboxcg.com/index.php/wp-json/wp/v2/taxonomies"
}
],
"wp:gadgets": [
{
"href": "https://cms.dboxcg.com/index.php/wp-json/wp/v2/categories"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
},
"post_tag": {
"title": "Tags",
"slug": "post_tag",
"description": "",
"sorts": [
"post"
],
"hierarchical": false,
"rest_base": "tags",
"_links": {
"assortment": [
{
"href": "https://cms.dboxcg.com/index.php/wp-json/wp/v2/taxonomies"
}
],
"wp:gadgets": [
{
"href": "https://cms.dboxcg.com/index.php/wp-json/wp/v2/tags"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
},
"canine": {
"title": "Canines",
"slug": "canine",
"description": "",
"sorts": [
"poodle",
"labrador",
"beagle",
"retriever"
],
"hierarchical": false,
"rest_base": "canine",
"_links": {
"assortment": [
{
"href": "https://cms.dboxcg.com/index.php/wp-json/wp/v2/taxonomies"
}
],
"wp:gadgets": [
{
"href": "https://cms.dboxcg.com/index.php/wp-json/wp/v2/dog"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
}
}
I’m attempting to retrieve the array of canine sorts in a customized plugin.
[
"poodle",
"labrador",
"beagle",
"retriever"
]
How do I entry the above array by way of wordpress hooks? I’ve tried the next with no luck:
get_taxonomy('canine')->sorts;
$wp_taxonomies['dog']->sorts;
Right here is the code I’m attempting to implement in a customized plugin:
$dog_types = get_taxonomy('canine')->object_type;
foreach ($dog_types as $kind) {
add_filter( "manage_{$kind}_posts_columns", 'update_dog_type_columns' );
add_action( "manage_{$kind}_posts_custom_column", 'update_dog_type_column', 10, 2 );
}
operate update_dog_type_columns( $columns ) {
$columns = array(
'cb' => $columns['cb'],
'title' => __( 'Title' ),
'picture' => __( 'Thumbnail' ),
'date' => __( 'Date' )
);
return $columns;
}
operate update_dog_type_column( $column, $post_id ) {
change ( $column ) {
case 'picture':
$vimeo_link = get_field('vimeo_link');
if ($vimeo_link) {
$vimeo_logo_url = 'https://imageurl/vimeo_logo.jpg';
echo '<img src="' . $vimeo_logo_url . '" top="100px" width="100px" />';
break;
} else {
$img_array = get_field('picture');
$img = $img_array['sizes']['thumbnail'];
echo '<img src="' . $img . '" top="100px" width="100px" />';
break;
}
case '12 months':
echo get_field( '12 months', $post_id );
break;
}
}