We're merging with GenerateBlocks! Learn more here.

[Resolved] Category Above The Title

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Category Above The Title

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #36152
    Alirio
    Participant

    Hi Everyone.

    On a card, I’d like to style and move the category above the title. How can I do that?

    Thank you.

    Rio

    #36158
    elvin
    Moderator

    Hi Rio,

    You’ll have to uncheck “include terms” on the meta settings and add the terms manually through a hook.

    As for re-hooking the term manually, you’ll need this PHP snippet:

    add_action('wpsp_before_header', function($settings){
    if( 18984 == (int)$settings['list_id']){ //apply to specified WPSP ID
    	printf( '<span class="wp-show-posts-terms wp-show-posts-meta">%1$s</span>',
    				get_the_term_list( get_the_ID(), 'category', '', apply_filters( 'wpsp_term_separator', ', ' ) )
    			);
    }
    },10,1);
    #36172
    Alirio
    Participant

    Hi Elvin. Thanks for your reply.

    I have “include terms” unchecked and also added the PHP snippet with no luck. My website is https://ithrive.health if you’d like to check the home page. I also added the WP Show Posts’ list ID to the snippet.

    I also cleared the cache.

    Is there anything else I need to check?

    I have not done any CSS either.

    #36177
    elvin
    Moderator

    Can you share the exact code you’re using?

    So I can cross check if the code used matches the list on the page you’ve linked. 🙂

    #36179
    Alirio
    Participant

    Sure. Here you go:

    add_action('wpsp_before_header', function($settings){
    if( 18984 == (int)$settings['6317']){ //apply to specified WPSP ID
    	printf( '<span class="wp-show-posts-terms wp-show-posts-meta">%1$s</span>',
    				get_the_term_list( get_the_ID(), 'category', '', apply_filters( 'wpsp_term_separator', ', ' ) )
    			);
    }
    },10,1);
    • This reply was modified 3 weeks, 6 days ago by Alirio.
    #36182
    elvin
    Moderator

    Change it to this:

    add_action('wpsp_before_header', function($settings){
    if( 6317 == (int)$settings['list_id']){ //apply to specified WPSP ID
    	printf( '<span class="wp-show-posts-terms wp-show-posts-meta">%1$s</span>',
    				get_the_term_list( get_the_ID(), 'category', '', apply_filters( 'wpsp_term_separator', ', ' ) )
    			);
    }
    },10,1);
    #36193
    Alirio
    Participant

    That worked. I misunderstood where to add the list ID lol …my bad. Thank you, ELVIN!

    #36200
    elvin
    Moderator

    No problem. 😀

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.