Answered: How can I remove nav_sub_list when setting "questions" as homepage?

Post date: 2020-07-08 01:10:22
Views: 3

Hello teddydoors,

There are two ways of disabling the sub navigation for the 'questions' page:

Method 1: Disable the 'sort' query parameter directly in qa-include/pages/questions.php by replacing this:

$sort = ($countslugs && !QA_ALLOW_UNINDEXED_QUERIES) ? null : qa_get('sort');

with this:

$sort = null;

in line 34; and then the sub-menu by replacing this:

$qa_content'navigation']'sub'] = qa_qs_sub_navigation($sort, $categoryslugs);

with this:

$qa_content'navigation']'sub'] = null;

in line 133; please have a look at 'Step 1' and 'Step 2' in this snippet , which already has these changes in place.

  • Pros: Quick and easy way of getting the job done
  • Cons: It'll get reverted to its initial form after updating Q2A

Method 2: Avoid modifying Q2A itself by creating a plugin and duplicate the parts you want to adjust into it. 

  1. Create a plugin. Here's a great tutorial on how to create plugins.
  2. Copy the file I mentioned in Method 1 into 'my_plugin'
  3. Override the route 'questions/' in qa_page_routing() so that it loads the duplicate in the plugin, instead of the one in Q2A.
  4. Adjust the contend of the duplicate so that you can follow Method 1 in the plugin itself.
  • Pros: It'll work after Q2A updates
  • Cons: The plugin needs to be updated manually after Q2A updates

Have a nice day.

Please click Here to read the full story.
 
Other Top and Latest Questions:
The cost of living... with a canine companion
Informatica says it's not for sale, following Salesforce's reported interest in $10 billion deal
Carrier, the century-old inventor of the air conditioner, is moving on to the home heat pump
Emirates CEO issues apology after Dubai flood chaos; says airline has 30,000 suitcases to return
Buckle up. These stocks could see big moves in reaction to earnings this week
How can i solve the problem?
Certified Addiction Counselor work experience conundrum
Tesla shares jump 13% after Musk says company aims to start production of affordable new EV by early 2025
Frieren: Beyond Journey's End: Future Enemies
The Apothecary Diaries: Chilly Apothecary