Advertisement:

Author Topic: [SOLVED] Modifying Specific Categories  (Read 212 times)

Rupert

  • Newbie
  • *
  • Posts: 15
[SOLVED] Modifying Specific Categories
« on: July 02, 2019, 01:04:46 am »
Hello all,

I am using Bender theme, and am trying to figure out how to modify specific categories. The only modifications I want to make are to add specific text at the top of the category page. Each category will have different text. So, the mods aren't drastic.

I was able to find this older thread:
https://forums.osclass.org/3-5-x/different-template-for-certain-categories/

that I think has the answer I am looking for. However, I keep doing something wrong. Has anyone else done this, and can you tell me where to put the custom code (as given at the link I referenced above).

Thank you.
« Last Edit: July 19, 2019, 01:20:47 am by Rupert »

BritWeb

  • Hero Member
  • *****
  • Posts: 770
  • If it ain't broke, don't fix it.
Re: Modifying Specific Categories
« Reply #1 on: July 02, 2019, 01:29:17 pm »
Hello all,

I am using Bender theme, and am trying to figure out how to modify specific categories. The only modifications I want to make are to add specific text at the top of the category page. Each category will have different text. So, the mods aren't drastic.

I was able to find this older thread:
https://forums.osclass.org/3-5-x/different-template-for-certain-categories/

that I think has the answer I am looking for. However, I keep doing something wrong. Has anyone else done this, and can you tell me where to put the custom code (as given at the link I referenced above).

Thank you.

If I understood your requirement correctly, paste the code below in the 'header.php' in appropriate place and change the style as needed.

Code: [Select]
        <?php if (osc_is_search_page()) { ?>
         <div style="text-align:center; height:40px; background:#900; color:#FFF; font-weight:bold; padding-top:8px">
        <?php if (!search_title() ) { ?><?php _e('Search Results','bender'); ?> <?php } elseif ( osc_category_description()) { ?><?php echo osc_category_description(); ?></div><?php } else { ?><?php echo search_title(); ?>
<?php ?>
         </div>
   <?php ?>   

Hope this helps!

Regards
« Last Edit: July 02, 2019, 03:58:45 pm by BritWeb »

Rupert

  • Newbie
  • *
  • Posts: 15
Re: Modifying Specific Categories
« Reply #2 on: July 03, 2019, 03:02:18 am »
Very grateful for the answer! I'll give it a try very soon.

Rupert

  • Newbie
  • *
  • Posts: 15
Re: Modifying Specific Categories
« Reply #3 on: July 03, 2019, 10:31:50 pm »
Hello,

BritWeb, thank you for the code and it worked perfectly. However, I stated my question poorly because the answer isn't what I'm searching for.

What I'm looking for is a way to have a paragraph or so of text below the category heading on each category's main page. For example:

<h1>Name Of Category</h1>
<p>Specific text for this particular category. Specific text for this particular category. Specific text for this particular category. Specific text for this particular category.</p>

<h2>Premium Listings</p>
...listings here...

<h2>All Listings</p>
...listings here...

i've also attached a screenshot if that helps.

I am converting an existing classifieds site over to Osclass. The text I would like to insert is helping the existing site rank very well for several categories. If I don't have the text those pages will fall drastically in search engine rankings (I've tested it in the past...the text makes a big difference).

Thanks for any help you can provide.




BritWeb

  • Hero Member
  • *****
  • Posts: 770
  • If it ain't broke, don't fix it.
Re: Modifying Specific Categories
« Reply #4 on: July 04, 2019, 02:10:49 am »
In that case you could do the following:

on 'search.php' find the following lines...

Code: [Select]
<?php osc_current_web_theme_path('header.php') ; ?>
     <div class="list-header">
        <div class="resp-wrapper">
            <?php osc_run_hook('search_ads_listing_top'); ?>
            <h1><?php echo search_title(); ?></h1>

...and add  '<p><?php echo osc_category_description(); ?></p>' to it so that it now looks as below:

Code: [Select]
<?php osc_current_web_theme_path('header.php') ; ?>
     <div class="list-header">
        <div class="resp-wrapper">
            <?php osc_run_hook('search_ads_listing_top'); ?>
            <h1><?php echo search_title(); ?></h1>
<p><?php echo osc_category_description(); ?></p>

Please make sure you add appropriate description for every category you have created.

Best of luck!

Rupert

  • Newbie
  • *
  • Posts: 15
Re: Modifying Specific Categories
« Reply #5 on: July 04, 2019, 07:12:54 am »
Thanks! I will check this out soon. I need to add a SEO plugin to set the description meta tags, but I can't do that until I migrate from my test server to the actual server. I do appreciate all your help.
« Last Edit: July 04, 2019, 07:54:24 am by Rupert »

Rupert

  • Newbie
  • *
  • Posts: 15
Re: Modifying Specific Categories
« Reply #6 on: July 10, 2019, 07:26:37 pm »
BritWeb, sorry for the belated reply. Your solution works terrific!

I appreciate your help very much.
« Last Edit: July 10, 2019, 07:37:40 pm by Rupert »

BritWeb

  • Hero Member
  • *****
  • Posts: 770
  • If it ain't broke, don't fix it.
Re: Modifying Specific Categories
« Reply #7 on: July 10, 2019, 11:45:02 pm »
BritWeb, sorry for the belated reply. Your solution works terrific!

I appreciate your help very much.

You are welcome!