Advertisement:

Author Topic: How to show text on category page only  (Read 914 times)

HimSelf

  • Full Member
  • ***
  • Posts: 163
How to show text on category page only
« 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 !
« Last Edit: November 04, 2016, 01:37:48 am by HimSelf »

HimSelf

  • Full Member
  • ***
  • Posts: 163
Re: How to show text on category page only
« Reply #1 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

Liath

  • issues
  • Hero Member
  • *
  • Posts: 1346
  • </html> the end is always near
Re: How to show text on category page only
« Reply #2 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

HimSelf

  • Full Member
  • ***
  • Posts: 163
Re: How to show text on category page only
« Reply #3 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.


HimSelf

  • Full Member
  • ***
  • Posts: 163
Re: How to show text on category page only
« Reply #4 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

HimSelf

  • Full Member
  • ***
  • Posts: 163
Re: How to show text on category page only
« Reply #5 on: December 01, 2016, 01:45:57 pm »
ideas are welcome !