Forums Forums Search & Filter Pro search-filter/results.php – to load from plugin dir

Viewing 9 posts - 1 through 9 (of 9 total)
  • Anonymous
    #35435

    Hi Ross,

    Love the plugin. Thanks for this.

    I need to customise results.php, but I need to be able to do that from a plugin, NOT from the theme. Right now, the only way to do so, according to the docs, we can copy paste search-filter/results.php in our theme’s dir.

    Can you please advise on how to maybe overwrite/extend Search_Filter_Query Class (the_results function), from a custom plugin, and define new location for search-filter/results.php?

    Any help is much appreciated.

    Thank you,

    V.

    Ross Moderator
    #35438

    Hi there

    I guess the best way to do this would be to use the standard way of customising the results template via the theme..

    However, you wouldn’t use all the standard loop code etc, you would just empty the results.php file in your theme, and load the file that you desire using PHP, something like:

    results.php:

    <?php
        include '/path/to/my/plugin/myresultstemplate.php';
    ?>

    Thanks

    Anonymous
    #35440

    Hi Ross,

    Thanks for the quick reply. Unfortunately, it didn’t resolved my issue here.

    Example: I am not allowed to touch, nor access WP theme’s folders or files. I need to be able to load results.php file from within plugin.

    Is there a way to define new results.php file path (/path/to/my/plugin/myresultstemplate.php)?

    Many thanks,

    V.

    Ross Moderator
    #35444

    There is no way without hacking the plugin.

    Let me have a think, I could add a filter on the template filenames to check where you could override it.

    Like I mention, its not a feature, but I’ll consider adding it to the next version once I’ve had a chance to properly think about the implications.

    Thanks

    Anonymous
    #35445

    Hi,

    Please consider adding this to your plugin as it will add the ability for other developers to extend your plugin’s functionalities.

    Thank you, really appreciate it.

    V.

    Ross Moderator
    #35446

    Are you developing a plugin that uses S&F Pro? I’d be interested to hear a bit more about it ๐Ÿ™‚

    Anonymous
    #35449

    Nope ๐Ÿ™‚ Just need the ability to modify results.php without touching the WP theme’s files. So I figured the only way to do this would be trough the custom plugin.. but no ๐Ÿ™‚

    Yeah, just give us a filter or something, so we can change the path to the results.php file without changing WP theme’s structure.

    Cheers

    Anonymous
    #36125

    Hey Ross,

    Hope you’re well.

    Any chance you can tell me when’s the next plugin release? And if you’re planning to let “us” define the results.php file path?

    Cheers,

    V.

    Ross Moderator
    #36171

    Hey again, I’ve been thinking about this one.

    I don’t want to unnecessarily add bloat to the code, so want to get a better understanding of why you would want to do this – can you describe to me your use case?

    The way I see it, anyone implementing S&F should also have access to the theme, and the theme is the best place for layout customisations like this.

    Look forward to your response.

    Thanks

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