• Resolved Shojka

    (@shojka)


    Hello,

    I have posts what are in multi categories, but i want to show widget only at primary category (i think its Yoast plugin option)

    Please tell me is there way to show widget only at primary category?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Shojka

    (@shojka)

    P.S.

    I created function to get primary category:

    function func_get_yoast_primary_category( $atts ) {
    global $post;
    $cat_id = get_post_meta($post->ID, ‘_yoast_wpseo_primary_category’,true);
    $term = get_term( $cat_id );
    return $term->name;
    }

    add_shortcode( ‘get_yoast_primary_category’, ‘func_get_yoast_primary_category’ );

    And i try to use in logic this:
    func_get_yoast_primary_category($term->name) == ‘CATEGORY NAME’

    But nothing happen, before i use other plugin and it works, but now

    Plugin Author Mej de Castro

    (@mej)

    Hi @shojka , Thanks for using Widget Options! Do you mean that you want to show a specific widget on primary category archive page?

    Thanks,
    Mej

    Thread Starter Shojka

    (@shojka)

    Hello Mej,

    I want to show specify widgets at single post. Ex. if post have categories A,B,C but primary category is set to A, i want to use only widget set to category A, dont want to show widgets for category B and C

    Plugin Author Mej de Castro

    (@mej)

    Hi @shojka , The team reviewed it, and it turns out that the current version doesn’t support the conditions that target the primary category only.

    But it’s been submitted to our list of features or change requests to be considered by our developers for future releases.

    Thank you,
    Mej

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Multi Categories’ is closed to new replies.