restrict the publication of the featured image in the header to one category.

I installed the sparkling template.

I created the SLIDER category for items that I would like to highlight through the featured image.

The image to be put in the header has a precise dimension

The problem is that any featured image of any item is put in the slider.

My requirement is: only the featured image of the article that I tag with SLIDER category, can appear in the slider

I searched in the forum and found this piece of code to put in function.php (I think at any point) in this post

function exclude_category( $query ) {
if( ! is_category() && of_get_option( ‘sparkling_slider_checkbox’ ) == 1 ){
$slidecat = of_get_option( ‘sparkling_slide_categories’ );

    if (  $query->is_main_query() ) {
        $query->set( 'cat', '-'.$slidecat );


I did so, and in the slider in facts, no picture appears that is not the choice of the “slider options” category (SLIDER)


in backpanel> all posts, the article with the SLIDER tag, disappears! And the article is not published in homepage!

There are 3 articles published, I see only two. It is gone and no longer able to find, edit or even delete.

Luckily I had still open, and I could try to remove the tick in SLIDER, I reload, and the post has reappeared in the list “all posts”

It would be important to me that only category that I decided in “slider options”, to publish the featured image in the slider, but not make me disappear the article from the list “all posts” : D

Thanks for the attention and excuse me for the bad english.


Hi Giovanni,

I hope you are well today and thank you for your question.

I am not sure i understood your question correctly.

Do you want not to display the slider posts on the blog?

It would be important to me that only category that I decided in “slider options”, to publish the featured image in the slider

Yes this is how the slider works.

If it’s not working like that for you then please share the screenshot of your slider settings and your site URL where it’s displaying so that i can troubleshoot it.

Best Regards,

Hello Movin. I do not know how to tell you, but now works correctly! The only things I did was install the child theme and update to wordpress 5.1. Before any image that I put in the new article in featured image, was published in the header, without that I checked the category _SLIDER. I do not know what to tell you, I’m sorry, excuse me.

Best regards

Glad it now works correctly for you!

Please advise if you have more questions.

Have a fantastic day!

Many thanks!

I just opened a ticket to another problem :slight_smile:

Have a nice day!