*

vnc

  • **
  • 13 posts
Hide a specific category from mainpage and search
« on: August 28, 2022, 08:30:49 PM »
Hi,


We have a erotic category and we want to hide this category from mainpage and search.

The visitor can just view and make search when he is in the category.

Thank you.

*

MB Themes

Re: Hide a specific category from mainpage and search
« Reply #1 on: August 28, 2022, 09:12:21 PM »
Well, you must manually edit main.php and remove category id from loop
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

vnc

  • **
  • 13 posts
Re: Hide a specific category from mainpage and search
« Reply #2 on: August 29, 2022, 10:24:33 AM »
Well, you must manually edit main.php and remove category id from loop

Can you help us with the code, because we cannot find it in main.php?

Thank you!

*

MB Themes

Re: Hide a specific category from mainpage and search
« Reply #3 on: August 29, 2022, 01:07:04 PM »
Not quite sure how you would not be able to find categories section.

Find:
Code: [Select]
<?php while(osc_has_categories()) { ?>
and bellow it create condition, i.e.:
Code: [Select]
<?php if (osc_category_id() == 25) { continue; } ?>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

vnc

  • **
  • 13 posts
Re: Hide a specific category from mainpage and search
« Reply #4 on: October 19, 2022, 06:56:12 PM »
We try the code but still appears in general search and general ads.

*

MB Themes

Re: Hide a specific category from mainpage and search
« Reply #5 on: October 22, 2022, 10:01:27 AM »
@vnc
Code to skip ID 7 looks OK.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

zawr

  • **
  • 25 posts
Re: Hide a specific category from mainpage and search
« Reply #6 on: October 22, 2022, 05:26:26 PM »
@vnc
Code to skip ID 7 looks OK.

Nice work for Epsilon guys! Congratulation! Can we do same thing for DELTA?
...
I did same thing in 'inc.search.php' and 'inc.category.php'
<?php while(osc_has_categories()) { ?>
<?php if (osc_category_id() == 99) { continue; } ?>
Doesn't work..
Note. We, Delta do not have "?php while(osc_has_categories()) { ?" in 'main.php'
« Last Edit: October 23, 2022, 03:36:44 AM by zawr »

*

MB Themes

Re: Hide a specific category from mainpage and search
« Reply #7 on: October 23, 2022, 08:39:25 PM »
@zawr
It's probably wrapped in inc.search.php most probably (or one on inc. files)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

zawr

  • **
  • 25 posts
Re: Hide a specific category from mainpage and search
« Reply #8 on: October 23, 2022, 11:57:30 PM »
@zawr
It's probably wrapped in inc.search.php most probably (or one on inc. files)

I've tried  'inc.search.php' and 'inc.category.php', not working. New ad still appear on home page.
« Last Edit: October 23, 2022, 11:59:06 PM by zawr »

*

MB Themes

Re: Hide a specific category from mainpage and search
« Reply #9 on: October 24, 2022, 04:27:49 PM »
@zawr
You can echo some string to make sure you are modifying correct piece of code.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

zawr

  • **
  • 25 posts
Re: Hide a specific category from mainpage and search
« Reply #10 on: October 24, 2022, 07:14:01 PM »
I'm not a coder, but I've tried all lines of code in different files and submit new ads -- no result..

*

MB Themes

Re: Hide a specific category from mainpage and search
« Reply #11 on: October 24, 2022, 09:57:40 PM »
Submit new ads? for what purpose?
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

zawr

  • **
  • 25 posts
Re: Hide a specific category from mainpage and search
« Reply #12 on: October 25, 2022, 01:14:55 AM »
Originaly vnc ask: We have a erotic category and we want to hide this category from mainpage and search.
I'm doing same thing -- hide my category from main/home page
When I add "<?php if (osc_category_id() == 25) { continue; } ?>" as a second line after "<?php while(osc_has_categories()) { ?>"how can I test it's working or not? I post new ad to "adult/erotic category" and see if new ad is appear on main/home page or not? If yes, code does not work! Am I wrong? What is the other way to test? (For regular user, not a coder)

*

MB Themes

Re: Hide a specific category from mainpage and search
« Reply #13 on: October 25, 2022, 08:13:17 AM »
Following code will hide everything except your category ID:
Code: [Select]
<?php if (osc_category_id() != 25) { continue; } ?>
Don't forget child categories will have different IDs, better to do:
Code: [Select]
<?php if (in_array(osc_category_id(), array(25,26,27))) { continue; } ?>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

zawr

  • **
  • 25 posts
Re: Hide a specific category from mainpage and search
« Reply #14 on: October 25, 2022, 07:37:33 PM »
Hi, Thanks. I totally understand how difficult for you talk to non-tech guys.. But tech savvy are not here because they do not need your help.., but we do!

So, I did changes in 'inc.category.php' /see screenshot.. No result. Tell me what I did wrong?

Code: [Select]
<div class="line">
            <?php osc_goto_first_category(); ?>
            <?php while(osc_has_categories()) { ?>
            <?php if (osc_category_id() != 99) { continue; } ?>
            <?php if (in_array(osc_category_id(), array(99,171,172,173,174,175,176,177,185))) { continue; } ?>
              <?php 
                $search_params
['sCategory'] = osc_category_id(); 
                
$color del_get_cat_color(osc_category_id());
              
?>
« Last Edit: October 25, 2022, 08:52:44 PM by zawr »