....
while(have_posts()):the_post();
$taxonomies=get_object_taxonomies($post->post_type);
$otherTax=get_the_terms($post->ID,implode('',$taxonomies));
if($otherTax&&!is_wp_error($otherTax)){
$slug=$otherTax[0]->slug;
$otherTaxparent=$otherTax[0]->parent;
if($otherTaxparent&&!is_wp_error($otherTaxparent)){
$otherTax=get_term($otherTaxparent);
$slug=$otherTax->slug;
}
get_template_part('taxonomy/content-taxonomy/content-taxonomy',$slug);
}else{
echo'none';
}
....
$taxonomies=get_object_taxonomies($post->post_type);
$otherTax=get_the_terms($post->ID,implode('',$taxonomies));
echo $otherTax[0]->slug;
<?php get_header();
if(have_posts()):
while(have_posts()):the_post();
$taxonomies=get_object_taxonomies($post->post_type);
$otherTax=get_the_terms($post->ID,implode('',$taxonomies));
get_template_part('taxonomy/content-taxonomy/content-taxonomy',$otherTax[0]->slug);
endwhile;
else:get_template_part('template_parts/post/content','none');endif;
get_sidebar();get_footer();
taxonomy-{taxonomy}-{term}.php
.current-menu-item > a,.current-menu-ancestor > a,.current_page_item > a,.current_page_ancestor > a{border:solid 2px #000;....
$args=array(
'posts_per_page' => 9
);
<?php get_header();
if(have_posts()){
if(function_exists('Brumer_Navigation_Pag')):Brumer_Navigation_Pag();else:posts_nav_link();endif;
while(have_posts()):the_post();get_template_part('VAB_template_parts/post/VAB','excerpt');endwhile;
if(function_exists('Brumer_Navigation_Pag')):Brumer_Navigation_Pag();else:posts_nav_link();endif;
}else{get_template_part('VAB_template_parts/post/VAB','none');}
get_sidebar();get_footer();
( function( blocks, element ) {
........
} )(
window.wp.blocks,
window.wp.element,
);
( function( blocks, element, RichText ) {
........
} )(
window.wp.blocks,
window.wp.element,
window.wp.editor.RichText,
);
var el=wp.element.createElement,registerBlockType=wp.blocks.registerBlockType,InnerBlocks=wp.editor.InnerBlocks,allowedBlocks=['core/paragraph','core/heading'];
registerBlockType('первый',{
.....
});
registerBlockType('второй',{
.....
});
var el=wp.element.createElement,registerBlockType=wp.blocks.registerBlockType,RichText=wp.editor.RichText,InnerBlocks=wp.editor.InnerBlocks,allowedBlocks=['core/paragraph','core/heading'];
const iconEmail = el('svg', { width: 20, height: 20 },
el( 'path',
{
d: "M19.833 1.127c-0.144-0.129-0.349-0.163-0.527-0.088l-19 8c-0.192 0.081-0.314 0.272-0.306 0.48s0.144 0.389 0.342 0.455l5.658 1.886v5.64c0 0.212 0.133 0.4 0.333 0.471 0.055 0.019 0.111 0.029 0.167 0.029 0.148 0 0.291-0.066 0.388-0.185l2.763-3.401 4.497 4.441c0.095 0.094 0.221 0.144 0.351 0.144 0.042 0 0.084-0.005 0.125-0.016 0.17-0.044 0.305-0.174 0.355-0.343l5-17c0.055-0.185-0.003-0.385-0.147-0.514zM16.13 3.461l-9.724 7.48-4.488-1.496 14.212-5.984zM7 11.746l9.415-7.242-7.194 8.854c-0 0-0 0.001-0.001 0.001l-2.22 2.733v-4.346zM14.256 17.557l-3.972-3.922 8.033-9.887-4.061 13.808z"
}
)
);
registerBlockType('customization-editor/section', {
title: 'Секция',
icon: iconEmail,
category: 'widgets',
description:'Мой Custom Section',
keywords: [ 'секция', 'section'],
edit:function(props){
var content=props.attributes.content;
function onChangeContent(newContent){props.setAttributes({content:newContent});}
return(
el('div',{className:props.className},
el(RichText,{tagName:'p',className:props.className,onChange:onChangeContent,value:content,}),
el('div',{className:'vab_custom_section'},el(InnerBlocks,{allowedBlocks:allowedBlocks,}))
)
);
},
save:function(props){
return(
el('div',{className:props.className},
el(RichText.Content,{tagName:'p',value:props.attributes.content,}),
el('div',{className:'vab_custom_section'},el(InnerBlocks.Content,null))
)
);
},
});
registerBlockType('vabtopic/vab-mixed-block',{
title: i18n.__('Смешанный блок','VAB'),
icon:'index-card',
category:'VAB_category',
attributes:{
title:{type:'array',source:'children',selector:'h2',},
mediaID:{type:'number',},
mediaURL:{type:'string',source:'attribute',selector:'img',attribute:'src',},
mixedfirst:{type:'array',source:'children',selector:'.mixedfirst',},
mixedsecond:{type:'array',source:'children',selector:'.mixedsecond',},
},
edit:function(props){
var attributes=props.attributes;
var onSelectImage=function(media){
return props.setAttributes({mediaURL:media.url,mediaID:media.id,});
};
return (
el('div',{className:props.className},
el(RichText,{tagName:'h2',inline:true,placeholder:i18n.__('Заголовок'),value:attributes.title,onChange:function(value){props.setAttributes({title:value});},
}),
el('div',{className:'recipe-image'},
el(MediaUpload,{onSelect:onSelectImage,allowedTypes:'image',value:attributes.mediaID,
render:function(obj){
return el(components.Button,{
className:attributes.mediaID?'image-button':'button button-large',
onClick:obj.open
},
! attributes.mediaID?i18n.__('Загрузка изображения'):el('img',{src:attributes.mediaURL})
);
}
})
),
el('h3',{},i18n.__('Редактируемый блок первый')),
el(RichText,{tagName:'ul',multiline:'li',placeholder:i18n.__('placeholder'),value:attributes.mixedfirst,
onChange:function(value){props.setAttributes({mixedfirst:value});},
className:'mixedfirst',
}),
el('h3',{},i18n.__('Редактируемый блок второй')),
el(RichText,{
tagName:'div',
inline:false,
placeholder:i18n.__('placeholder'),
value:attributes.mixedsecond,
onChange:function(value){
props.setAttributes({mixedsecond:value});
}
}),
el('div',{className:'vab_custom_section'},el(InnerBlocks,{allowedBlocks:allowedBlocks,}))
)
);
},
save:function(props){
var attributes=props.attributes;
return(
el('div',{className:props.className},
el(RichText.Content,{tagName:'h2',value:attributes.title}),
attributes.mediaURL&&el('div',{className:'mixed-image'},el('img',{src:attributes.mediaURL}),),
el('h3',{},i18n.__('Редактируемый блок первый','VAB')),
el(RichText.Content,{tagName:'ul',className:'mixedfirst',value:attributes.mixedfirst}),
el('h3',{},i18n.__('Редактируемый блок второй','VAB')),
el(RichText.Content,{tagName:'div',className:'mixedsecond',value:attributes.mixedsecond}),
el('div',{className:'vab_custom_section'},el(InnerBlocks.Content,null))
)
);
},
});
Может, хотябы, так написать(и то не во всех случаях сработает как нужно)?
is_home() || is_front_page()