Title: Stylesheet Filter
Last modified: August 30, 2016

---

# Stylesheet Filter

 *  Resolved [dannywynne](https://wordpress.org/support/users/dannywynne/)
 * (@dannywynne)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/stylesheet-filter/)
 * Currently the stylesheet is selected based on the theme name. Would it be possible
   to add a statement like this:
 *     ```
       $stylesheet = (get_option('mpdf_theme')!=''&&file_exists($templatePath.get_option('mpdf_theme').'.css')) ? $templatePath.get_option('mpdf_theme').'.css' : "";
       $stylesheet = apply_filters('mpdf_output_stylesheet', $stylesheet);
       ```
   
 * This keeps the normal functionality of the css name being there based on the 
   theme, but also allows for unexpected cases where the developer may need to use
   something other than the theme name.
 * [https://wordpress.org/plugins/wp-mpdf/](https://wordpress.org/plugins/wp-mpdf/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [fkrauthan](https://wordpress.org/support/users/fkrauthan/)
 * (@fkrauthan)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/stylesheet-filter/#post-6391790)
 * I don’t see any use case for a function like that. The CSS is tied directly into
   the template anyway. And the CSS is completely independent of the regular website
   css and most likely cause issues if you start using a normal wordpress CSS file
   and don’t optimize it for the pdf print.
 * But feel free to create a pull request on github if you need a function like 
   that.
 *  Thread Starter [dannywynne](https://wordpress.org/support/users/dannywynne/)
 * (@dannywynne)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/stylesheet-filter/#post-6391793)
 * Appreciate your response.
 * I have already implemented this customization successfully, but I’d prefer to
   not have to manage it as a branch. Had a recent issue where a site that had this
   deployed auto-updated all their plugins, which caused some havoc.
 * To your point about the CSS, totally agree. The CSS we are talking about here
   is only for the pdf print.
 * Here’s my use case, and you can see if it merits a change – the PDF CSS file 
   is determined via a check of two logic steps:
    1) State information for the page(
   think query string, cookies, etc.). 2) I am storing the physical PDF CSS files
   in a different location than where WP-MPDF is looking for them. I wanted these
   integrated into a supporting plugin for ease of management.
 * I would say that the ability to move the PDF CSS elsewhere is a pretty strong
   argument to add a filter on the stylesheet. But that’s also because it is part
   of my reason to customize it, so I’m biased.
 * Thanks for taking the time to consider this.
 *  Plugin Author [fkrauthan](https://wordpress.org/support/users/fkrauthan/)
 * (@fkrauthan)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/stylesheet-filter/#post-6391797)
 * Since I don’t have a strong use case for that sort of functionality feel free
   to re create your change in a branch and create a pull request. I am most willing
   to review that change and merge it back into the plugin code and release a new
   version.
 * I just don’t have the time to implement a feature like that and do proper testing
   and documentation writing about it in the readme.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Stylesheet Filter’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-mpdf.svg)
 * [wp-mpdf](https://wordpress.org/plugins/wp-mpdf/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-mpdf/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-mpdf/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-mpdf/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-mpdf/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [fkrauthan](https://wordpress.org/support/users/fkrauthan/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/stylesheet-filter/#post-6391797)
 * Status: resolved