Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
360 views
in Themes by
Hi,

I'm looking to display html (a div element) within the home page footer only? Can anyone help with how to add this to a template?

Many thanks.
Q2A version: 1.6.3

1 Answer

0 votes
by
selected by
 
Best answer

This heavily depends on the theme you're using. Edit file qa-theme/<your-theme>/qa-theme.php

If you aren't already overriding the footer function in your theme then adding this to the file will do:
        
function footer() {
    $this->output('<div class="qa-footer">');
    if (qa_request() === '') {
        $this->output(
            '<div>',
            'A div with content',
            '</div>'
        );
    }
    $this->nav('footer');
    $this->attribution();
    $this->footer_clear();
 
    $this->output('</div> <!-- END qa-footer -->', '');
}
 
If you are using the Snow theme released with Q2A 1.6.3 you should make your already existing body_suffix function look like this, as it is already being overriden by the theme:
 
function body_suffix() {
    $this->output('<div class="qa-footer-bottom-group">');
    if (qa_request() === '') {
        $this->output(
            '<div>',
            'A div with content',
            '</div>'
        );
    }
    qa_html_theme_base::footer();
    $this->output('</div> <!-- END footer-bottom-group -->', '');
}
 
Other themes might/will require a different solution.
by
Thanks. That works fine for text output (thank you).

What about if I wanted a styled <div> and hyperlinked text? e.g. to output:

<style type="text/css">
#wrap {
   width:708px;
   margin:20px auto;
}
#left_col {
   float:left;
   width:354px;
}
#right_col {
   float:right;
   width:354px;
}
p.padding {
    padding: 3px 5px;
}
</style>
<div align="left" id="wrap">
    <div id="left_col">
<p class="padding"><a href="http://something.com">something</a></p>
</div>

etc...
by
Exactly the same as the answer but with the custom HTML you want. I would add the style to the CSS style sheet of the theme, though.

As I always say: No need to say thanks, that's what accepting answers and upvoting is there for :)
...