Q&A Plugin customization of main question page

hi folks,

I love the q&a plugin, but I would like to be able to customize the mainpage of the plugin (put some text upfront (introduction etc).

is that possible?

thanks very much!
david

  • Michael Bissett

    Hi @David, it's Michael from the live chat earlier today, hope you're doing well!

    In regards to adding some intro text, you can try inserting this into either the functions.php for your theme (preferably a child theme, so that the changes aren't lost on an update), or as a mu-plugin (more on that here):

    function custom_qa_intro ( $case ) {
      if ( 'archive-question' == $case ) {
    
      echo '<div id="qa-intro">
      Intro text here
      </div>';
      }
    }
    add_action ('qa_before_content', 'custom_qa_intro', 10, 1);

    You can customize the text as you need to, you can even style the text with some CSS code if you wish (as we have that CSS ID handy in the <div> element).

    In regards to the Facebook login option, where were you wanting to have that on the page? Oh, and also, what plugin are you looking to use to show the Facebook login option?

    Were you planning to use our Ultimate Facebook plugin to handle that?

    Please advise,
    Michael

  • Ash

    Hello @David

    I hope you are well today.

    Please try the following code:

    add_action( 'wp_footer', 'set_extra_content' );
    function set_extra_content() {
        ?>
        <script type="text/javascript">
        jQuery(function($){
            var html = '<div id="extra_content" style="margin: 20px 0">CONTENT</div>';
            $('#qa-content-wrapper').prepend(html);
        });
        </script>
        <?php
    }

    Change CONTENT with your text.

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps Please feel free to ask more question if you have.

    Cheers
    Ash