Osclass forums

Support forums => General help => 3.6.x => Topic started by: HimSelf on November 04, 2016, 01:27:52 am

Title: How to show text on category page only
Post by: HimSelf on November 04, 2016, 01:27:52 am
Hello,

i'm trying to add the category description in my theme.

so i added
Code: [Select]
<div><?php echo osc_item_category_description(); ?> </div>
in search.php and it works well.

Perhaps, i have some description that shows also on regular search pages.

how can i add something like "if(is_category()) { echo osc_item_category_description(); }"

( is_category(); ) is a wordpress function that helps to show some informations only if we are on a category page.

thanks a lot in advance for your help !
Title: Re: How to show text on category page only
Post by: HimSelf on November 04, 2016, 10:50:40 pm
No idea ?

let me try to explain it differently :

i need a function or a code that can do this :

Am i on a category page ?

- yes : show category description

- no : show something else or nothing.

thanks a lot for your help
Title: Re: How to show text on category page only
Post by: Liath on November 04, 2016, 10:59:22 pm
why no just use
Code: [Select]
if (osc_item_category_description()) { echo osc_item_category_description(); }

you can use too
Code: [Select]
if (osc_item_category()) { echo osc_item_category_description(); }
https://doc.osclass.org/HItems.php (https://doc.osclass.org/HItems.php)
Title: Re: How to show text on category page only
Post by: HimSelf on November 08, 2016, 12:20:56 am
thanks for you answear.

your idea seems good,

but it didnt work.

i still have category description displayed in search results.

i have tested your 2 examples, in my theme and in default osclass theme.

Title: Re: How to show text on category page only
Post by: HimSelf on November 16, 2016, 01:57:56 am
here is an example :

-http://www.brui**o.be/recherche/sKeyword,chambre

(replace ** by "mm") sorry but i dont want this results to show up in google ;-)

this page should return no description, but it shows the description from the category of the displayed 1st result !

this make troubles for my SEO.

how can i manage this ? Any idea is welcome
Title: Re: How to show text on category page only
Post by: HimSelf on December 01, 2016, 01:45:57 pm
ideas are welcome !