Support » Plugin: Breaking News Ticker » Hide ticker when no posts is found in that category?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor wpqastle

    (@wpqastle)

    Hello Wdrescher!

    Sorry for late reply. We have no settings for this feature, but you can use a custom code for it.

    <?php if (in_category( 'category slug' )) : ?>
    <?php do_action('show_bnt'); ?>
    <?php endif;?>

    or if shortcode:

    <?php if (in_category( 'category slug' )) : ?>
    <?php echo do_shortcode([breaking_news_ticker]'); ?>
    <?php endif;?>

    ex:

    <?php if (in_category( 'press' )) : ?>
    <?php do_action('show_bnt'); ?>
    <?php endif;?>

    Note: the post only publish in selecting category.

    If you like this plugin, then please leave us a good rating and review or If you have any other questions or would like us to clarify anything else, please, let us know. We are always glad to help in any way we can.

    Thanks
    WpQastle.com

    Thread Starter wdrescher

    (@wdrescher)

    I’ll go ahead and try this and see how it works, I appreciate the great support and will gladly leave a good rating an review.

    Plugin Contributor wpqastle

    (@wpqastle)

    Ok, If worked let us know or If you have any other questions or would like us to clarify anything else, please, let us know. We are always glad to help in any way we can.

    Thanks
    WpQastle.com

    Thread Starter wdrescher

    (@wdrescher)

    I added this to my functions php to render my own shortcode:

    function breakingnews_shortcode() {
    
    	if (in_category( 'breaking' )) :
    	do_action('show_bnt');
    	endif;
    
    }
    add_shortcode( 'breakingnews', 'breakingnews_shortcode' );

    Then I put [breakingnews] in to my home page and it doesn’t render anything even when there’s a post in that category.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hide ticker when no posts is found in that category?’ is closed to new replies.