This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

Smithtech

  • ****
  • 219 posts
DISPLAY CATEGORY DESCRIPTION ON FRONT END
« on: September 05, 2021, 01:11:54 AM »
Hi,

Please, how do I display category descriptions on frond tend in Delta theme?
Surprisingly, my categories don't actually rank or show in search results as you will expect. I'm I correct? I have realised that category pages don't really have a fixed meta description. When I check, the category meta description takes the meta description of the latest listing. I have tried different Osclass SEO plugins but it doesn't seem to be improving.
I want to display the category description in front so that at least I have a fix text that will be showing for meta description so that my category pages can stand a chance to show in Google search results.

Thank you

*

MB Themes

Re: DISPLAY CATEGORY DESCRIPTION ON FRONT END
« Reply #1 on: September 05, 2021, 10:26:22 AM »
Simply place osc_category_description() function into search.php
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Smithtech

  • ****
  • 219 posts
Re: DISPLAY CATEGORY DESCRIPTION ON FRONT END
« Reply #2 on: September 07, 2021, 12:02:39 AM »
Simply place osc_category_description() function into search.php


I added the code but nothing is showing on front end.

*

MB Themes

Re: DISPLAY CATEGORY DESCRIPTION ON FRONT END
« Reply #3 on: September 07, 2021, 08:40:16 AM »
There are several options:
- category description is empty (or empty in your locale)
- no category is selected on search
- you did it incorrectly (<?php echo osc_category_description(); ?>)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Smithtech

  • ****
  • 219 posts
Re: DISPLAY CATEGORY DESCRIPTION ON FRONT END
« Reply #4 on: September 12, 2021, 12:11:29 AM »
There are several options:
- category description is empty (or empty in your locale): Category description is not empty. (I am not sure what you mean by or it is empty in your locale)
- no category is selected on search: Category was selected alright
- you did it incorrectly (<?php echo osc_category_description(); ?>): I added this alright and copied this right now and it didn't work


Please, this doesn't work for me still

There are several options:
- category description is empty (or empty in your locale): Category description is not empty. (I am not sure what you mean by or it is empty in your locale)
- no category is selected on search: Category was selected alright
- you did it incorrectly (<?php echo osc_category_description(); ?>): I added this alright and copied this right now and it didn't work

*

MB Themes

Re: DISPLAY CATEGORY DESCRIPTION ON FRONT END
« Reply #5 on: September 12, 2021, 07:41:12 AM »
Ok then I think we have incorrect function.
https://docs.osclasspoint.com/hsearch-php

osc_search_category()

This will be object and I am not sure under which key description is, you must print it and try, but I guess 's_description' could work
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Smithtech

  • ****
  • 219 posts
Re: DISPLAY CATEGORY DESCRIPTION ON FRONT END
« Reply #6 on: September 12, 2021, 10:26:17 PM »
I have tried several of them but they didn't work

Code: [Select]
osc_search_category()
Code: [Select]
osc_search_category(s_description) This one prints the text Array
Code: [Select]
osc_category_description($locale = “”)osc_category_field( 's_description' , $locale)

I checked here as well https://docs.osclasspoint.com/hcategories-php

Marked as best answer by frosticek on September 13, 2021, 04:16:58 PM
*

Smithtech

  • ****
  • 219 posts
Re: DISPLAY CATEGORY DESCRIPTION ON FRONT END
« Reply #7 on: September 12, 2021, 11:27:28 PM »
This code solved the issue
Code: [Select]
<?php $cat Category::newInstance()->findByPrimaryKey($search_cat_id);
echo @
$cat['s_description']; ?>

I got it from this post https://forums.osclasspoint.com/starter-osclass-premium-theme/category-description-4739/

*

MB Themes

Re: DISPLAY CATEGORY DESCRIPTION ON FRONT END
« Reply #8 on: September 13, 2021, 04:16:55 PM »
@support
Nice, this one could work as well:
Code: [Select]
@osc_search_category()['s_description']
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots