Hide 'Create Topic' on home page?

AI-generated summary

Discussion Summary: Hide ‘Create Topic’ on home page?

GSeven requested a way to hide the ‘Create Topic’ button on the home page, requiring users to navigate to a category/subcategory before posting. cpradio provided a CSS rule to achieve this:

body:not([class*='category-']) #create-topic {
    display : none;
}

This rule hides the ‘Create Topic’ button on the home page but shows it on category pages. GSeven then asked to modify the code to also show the button on category>subcategory>tag pages, which cpradio accommodated with an updated rule:

body:not([class*='category-']) #create-top ic {
    display: none;
}

body.tags-page #create-topic {
    display: block;
}

Mstm appreciated the solution but noted that it didn’t work on mobile devices. Nolo provided a workaround, suggesting the use of a more specific declaration or the !important property to override the mobile styles:

body:not([class*="category-"]) #create-topic {
    display: none !important;
}

Mstm successfully implemented the solution using the !important property.

Is it possible to hide the ‘create topic’ button on the home page?

i would like my users to navigate to the appropriate category/subcategory before posting a topic, because then the correct category option is automatically placed in the composer, instead of having to scroll through what will be hundreds of categories and subcategories in the drop down menu looking for the right one.

Does anybody know how to do this please?

Try this CSS Rule

body:not([class*='category-']) #create-topic {
    display: none;
}

It will only let the create-topic button appear on category pages.

Yes cpradio, absolutely perfect, top notch support.

many thanks.

actually, can the code be tweeked to show the ‘create topic’ button also in category>subcategory>tag?

Just to confirm, you have show filter by tag enabled?

i do indeed have it enabled.

so when someone goes to service(category)>county(subcategory)>town(tag) the create topic button is shown.

K, this is what you will want then

body:not([class*='category-']) #create-topic {
    display: none;
}

body.tags-page #create-topic {
    display: block;
}

Yes, The ‘create topic’ button now shows up on the page when a tag is selected.

absolute genius. i love you guys.

This populates the composer with the correct category and the correct tag.

:+1:

나도 @cpradio에게 감사드립니다. 이 기능이 추가되면 좋겠어요.
불행히도 모바일 기기에서는 작동하지 않네요 :pensive:

다양한 방법을 시도해 보았지만, 모바일 기기에서 "주제 만들기"를 어떻게 숨길 수 있는지 이해하지 못하겠습니다.
작은 화면에서는 카테고리나 태그를 탐색하기가 어렵기 때문에, 이 Contribute > Feature 기능이 큰 도움이 될 것입니다. 메뉴에 옵션을 추가하는 건 어떨까요? :smiley:

브라우저의 스타일 검사기(Style Inspector)를 사용할 수 있습니다. 모바일에서는 더 구체적인 선언이 기존 선언을 덮어쓰는 것을 확인할 수 있습니다:

따라서 모바일용 더 구체적인 선언을 직접 사용할 수 있습니다:

body:not([class*="category-"]) .list-controls .container #create-topic {
    display: none;
}

또는 !important 속성을 사용하여 일반적인 선언에 우선순위를 부여할 수 있습니다:

body:not([class*="category-"]) #create-topic {
    display: none !important;
}

manuel님, 감사합니다! !important 속성을 사용했는데 완벽하게 작동합니다!