Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
48 views
ago in Q2A Core by
"Ask a Question" is a very helpful link, when you are viewing a question or a category and you click "Ask a Question" you will ask a question in the exact category.

I would like to customize a little bit, but found out that it's hard to find the solution.

Of course I'm not asking how to apply CSS style onto it, or change the associated language file.

I would like to hide it on homepage, on tags list page, on tag page, on search result page, user profile page... The reason is that on those pages, there is no categoryid, so users have to manually select the correct category.

Unfortunately, the "Ask a Question" link source code is buried deep in a chain of functions in qa-theme-base.php file (nav --> nav_list --> nav_item --> nav_link)

I cannot find a clear-cut solution to customize it, or put it in a widget.

1 Answer

0 votes
ago by

Here's what I get

qa_opt('nav_ask') : if "Ask a Question" link exists

$this->content['navigation']['main']['ask']['url']  : return the url

$this->content['navigation']['main']['ask']['label']  : return the label

If you want to customize, you need to modify  function nav_main_sub()

So far, to hide this link, I can only unset those values. The outer wrapper is still there, but not visible to human eyes.

ago by
thank you!!!
...