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

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

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:
Movie: Deaf President Now!
FedEx beats earnings estimates, forecasts $1 billion cost savings in the next fiscal year
Answered: [New Free Plugin] : Points to the users on each Activeday
Stocks making the biggest moves midday: Nike, Uber, Newmont, Trade Desk and more
Nvidia heads for 5-day win streak as it hits record highs
Trump's war against the Powell Fed has taken another political turn
What we know so far about Jeff Bezos' $50 million star-studded luxury Venice wedding
Andrew Cuomo concedes the New York City mayoral primary to Zohran Mamdani, who leads in the first-choice vote
CDC vaccine panel holds first meeting since RFK Jr. put immunization critics in place
Women's Tennis Association extends media rights deal with Tennis Channel through 2032