Filter hook for Slider

  • Posted in : TheBlogger
  • Eric
    Participant

    Hi,
    I’d like to customize the main slider on the front page. I want to exclude some categories and custom post types from showing up in the slider.
    Is there a filter hook, where I can adjust these settings and what would be the correct syntax?
    Regards,
    Eric

    serkan
    Moderator

    Hi Eric,
    You can go to appearance > widgets > blog featured area > main slider > slides sticky post and save it.
    After that, you can make some posts as sticky and they will only show on the slider.
    By doing this, you can manually pick up the posts. There is not any filter to exclude some categories.
    Thanks

    Eric
    Participant

    Hi Serkan,

    unfortunately this is not a solution for my customer.

    I looked, where the query for the slider is generated and added 2 lines of code to the widget-main-slider.php under line 352:

    $excluded_categories = array();
    $excluded_categories = apply_filters('slider_excluded_categories',$excluded_categories);

    and 1 line under the new line 371:

    'category__not_in' => $excluded_categories
    .
    In the functions.php of the child theme I added a filter function with an array of the categories, that I want to filter.

    But that is a quick and dirty solution with 3 problems:
    1. The exclusion is set for every slider widget instance.
    2. It is hard coded. If there is a need to change the categories, the functions.php must be edited again.
    3. All the changes will be gone with the next update of the theme files.

    Because of problem #3 I didn’t add another field to the widget. But I would appreciate it, if you’ll add this possibility to the widget.

    Best regards,
    Eric

    serkan
    Moderator

    I see you, but we don’t promise any customization work anywhere, but still, we try to help you all on some simple css customizations that don’t take more than just a few minutes,
    but what you are asking is not possible with custom css it also requires editing theme core files.
    I will still forward this topic to our developers if there is anything we can do.
    Thanks for your understanding.

    Eric
    Participant

    Hi Serkan,

    I didn’t ask for an individual customization of your theme. When you answered me, that there was no built-in filter hook for the slider, I wrote it on my own.

    I just wanted to let you know, that it would be a nice feature to have a frontend solution.

    And indeed, that is more a topic for your developers’ roadmap than for a CSS customizer.

    Best regards,
    Eric

    serkan
    Moderator

    Hi Eric,
    Thanks for your all effort and feedback. It is nice of you.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register