uzderc
asked 6 years ago

Suppose I want to style my install to match my theme, such changing the submit button, matching the fields, etc.

If I make these changes to the plugin files, they will be overwritten if I update the plugin when updates are available.

Is there a way to do custom css or “child” files for css?

Thanks,

Robbie

1 Answers
DominicStaff
answered 6 years ago

Currently, you can create a template for DW Q&A based on WordPress child theme, so you may want to check out this link: https://codex.wordpress.org/Child_Themes
Basically, here is the instruction to create a template for DWQ&A:
1) Follow the guide in the link above to create a WP child theme.
2) Go to your child theme folder, and create a new folder, named it dwqa-templates. Inside your new folder, create the style.css file.
3) Go to plugins/dw-question-answer/inc/templates/default folder, and copy all the .php files in that folder to the dwqa-templates folder that you created above.
4) Open up the functions.php file in your child theme folder, and add the code below to bottom of the file:

/* load style for DW Q&A plugin */

if( !function_exists('dwqa_tmpl_scripts') ){

 function dwqa_tmpl_scripts(){

 wp_enqueue_style( 'dwqa-tmpl', get_stylesheet_directory_uri() . '/dwqa-templates/style.css' );

 }

 add_action( 'wp_enqueue_scripts', 'dwqa_tmpl_scripts' );

}

5) After 4 steps above, you can now edit both the .php file and the style.css file in dwqa-templates folder as you want without any effect on the Q&A plugin.
Hope this helps!

uzderc
replied 6 years ago

Wow, sometimes when you ask for support people will say stuff like “Just put the code in a child theme.”
Your answer was amazingly detailed and I appreciate the help!

Powered by DW Question & Answer Pro