Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter juniojeff

    (@juniojeff)

    Hey!
    Thanks for replying! I actually resolved the issue by just getting rid of some lines of the code:

    function primary_category_shortcode(){
    	$term = null;
    	$termName = null;
    
    	$term = the_seo_framework()->get_primary_term( $post->ID, 'category' );
    	if ( empty( $term ) ) {
    				$terms = get_the_terms( $post->ID, 'category' );
    				if ( ! empty( $terms ) ) {
    					$term = $terms[0]->term_id;
    				}
    			}
    	$termName = get_cat_name($term);
    	return $termName;
    }

    This code works on most of my posts, but for some reason, certain categories result in no ID being passed on to $term. Because of the way the code is set up, it spits out the parent category ID (the if then statement), but if I get rid of the if then statement, it does not return any ID value into $term. I have double and tripled check that the primary category is set correctly to the child category.

    Again this code works for 75% of my categories (they’re all child categories under a parent category that is NOT the primary category), but only doesn’t work for roughly 25% of my categories…with no other differences that I can see

    Any thoughts?

    Thread Starter juniojeff

    (@juniojeff)

    Thanks for your reply Ajay. There is a weird behavior when I use that – it creates a link to the category but then makes the title of the post into plain text.

    ANYWAYS…something, maybe a little simpler and actually even more important. When I use [crp limit=”1″ show_author=”1″], it shows the title and “by XXX”. Is there a way to remove the link to the author?

    Thanks so much Ajay

    Thread Starter juniojeff

    (@juniojeff)

    Great! The customizer worked, thanks Ajay

Viewing 3 replies - 1 through 3 (of 3 total)