最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Calling custom taxonomies

programmeradmin2浏览0评论

need some help with cpt having next-previous links with title or related posts. I'm using Oceanwp theme. For normal posts it show related posts. But for CPT, some code has to be edited.

In the child theme I've copied some files and I can see related posts in cpt but with default categories not with custom taxonomy associated with CPT. This is the code in theme i need help with:

    // Term
$term_tax = get_theme_mod( 'ocean_single_post_next_prev_taxonomy', 'post_tag' );
$term_tax = $term_tax ? $term_tax : 'post_tag';

It is in my child theme next-prev-subjects.php and related-posts-subjects.php.

How can I edit this code to use custom taxonomies. I've CPT named Subjects and 3 category like custom taxonomies: Physics, Chem, Maths and one tags like custom taxonomy named tagsubject.

I tried this one but didn't worked

// Term
    $term_tax = get_theme_mod( 'ocean_single_post_next_prev_taxonomy', 'subject_category' );
    $term_tax = $term_tax ? $term_tax : 'subject_category';

Do I've to use this:

$terms_tax = get_terms( array(
'taxonomy' => 'physics','chem','maths'
'hide_empty' => false,
) );

Any help with this way or any other way will be really appreciated. For other ways I did found similar questions in this forum but I don't know which files to edit or create in the child theme.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论