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

Hi,

I want to use this function for making the question title a link. could some one please tell me which file i need to upload this script? and where to implant it?

TX

by
Are you doing this to improve SEO? I mean what benefit will you get if the title of your question (in the question page) linked to same pag?
by
Hi,

Yes. It's to improve seo. I believe it's help....

1 Answer

0 votes
by

1. Open /qa-theme/<your-selected-theme>/qa-theme.php

2. Look for function title()

3. If it is not there then just add this code to the file:

public function title()    {
    $q_view = isset($this->content['q_view']) ? $this->content['q_view'] : null;
    $url = isset($q_view['url']) ? $q_view['url'] : false;
    if (isset($this->content['title'])) {
        $this->output(
            $url ? '<a class="q-title-link" href="'.$url.'">' : '',
            $this->content['title'],
            $url ? '</a>' : ''
        );
    }
}
4. If it is there then you can try replacing it with the whole function from #3
5. If it is there and #4 didn't work you will have to merge them yourself
by
I see you're using a commercial advanced custom theme there. Firstly, remove that comment as that code should not be public as it is released under a commercial license, as far as I know. The best thing I can tell you in order to blindly help you add that function is to locate a file (always under your theme folder) that has the structure I've mentioned above. Try to look for a file containing "qa_html_theme_base" or maybe "doctype". Then follow the steps in the answer again.
by
OK. I Hide my last comment (Tx for letting me know about that).

I have found in "my_theme_theme_base", file called "functions.php". I paste there your code before the closing "}" tag. now the site is not break but the title is still not a link.

I guess it's hard for you to help me blindly....
by
Yes, it is quite hard without knowing what's on the other side :( Probably you can contact the theme developer and ask him how you can override the title function in that specific theme (probably linking to this question).

Another less advisable approach is to perform a core hack and add REPLACE the title function in qa-include/qa-theme-base.php but again, if the theme is changing that function then you will not see the change, but it is worth the try.
by
Ok.

Thanks very much for your help. I will contact theme developer. He is actually very nice and kind and he surely will be helpful.

I thought I could do it by myself. guess I was wrong....:)

Thank you very much again....
...