Advertisement:

Author Topic: Auto Region name Usage / Inserting into META Description field  (Read 1658 times)

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Auto Region name Usage / Inserting into META Description field
« on: January 21, 2018, 02:06:35 am »
Auto Region name Usage / Inserting into META Description field. As you know when a list published script is adding auto city name into description + keyword area as below;

<meta name="description" content="category name + city, published item text ....." />

But for " Regions " it is not adding...When somebody select region name while adding list, script is not adding region name into " description " area... How to do it?

while item posting, when region name selecter META DESCRİPTİON shown as below;

<meta name="description" content="category name , published item text ....." />

I need that region name also must be added after category name...

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: Auto Region name Usage / Inserting into META Description field
« Reply #1 on: January 22, 2018, 12:13:17 am »
Hello,

Add this piece of code into your theme's functions.php file:
Code: [Select]
function cust_ad_meta_desc($desc) {
    if (osc_is_ad_page()) {
        return osc_item_category()." - ".osc_item_city().", ".osc_item_region()." - ".osc_item_description();
    }
    else return $desc;
}

osc_add_filter('meta_description_filter', 'cust_ad_meta_desc');

It will show description like this:
Category - City, Region - Item description....
« Last Edit: January 22, 2018, 12:18:46 am by patrickFromCroatia »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Auto Region name Usage / Inserting into META Description field
« Reply #2 on: January 22, 2018, 12:20:27 am »
And this function is called when?
You need to add a hook or filter with it.
Edit

Aa, you did now :)

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: Auto Region name Usage / Inserting into META Description field
« Reply #3 on: January 22, 2018, 01:28:57 am »
Script is already adding city name when you select city...
Problem is, it is not adding " region " name when region only selected....

Script must be ;
If only region selected : Catergory, Region, item description...
If only city selected ; Category, cities, item description...

Script currently is not adding " region " name in description.....in fact it must be added...

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: Auto Region name Usage / Inserting into META Description field
« Reply #4 on: January 24, 2018, 06:54:17 pm »
İs there no any expert to create a code...

I need meta like this;

Meta Description: Category, Region, passage from listing.....
Example: Diving schools Arizona, here you can find whole list of best dive schools in Arizona and surroinding areas....

Current osclass script is not adding " arizona " when user publish a list and select " Arizona " ( Region name )...


marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Auto Region name Usage / Inserting into META Description field
« Reply #5 on: January 24, 2018, 10:52:52 pm »
Doesn't
Code: [Select]
        return osc_item_category()." - ".osc_item_city().", ".osc_item_region()." - ".osc_item_description();return
category - city - region - description?

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: Auto Region name Usage / Inserting into META Description field
« Reply #6 on: January 25, 2018, 02:09:26 am »
it is ok working, I have also removed -, signs between category + region
I want to also modify keywords section, where to find this section?

Current keywords : category,region,category region

I want : region category, region, category, category region, region category custom word
            city category, city, category, category city, region city custom word

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: Auto Region name Usage / Inserting into META Description field
« Reply #7 on: January 25, 2018, 10:47:16 am »
I noticed that this code is not good, it is adding whole published text into META descrition area ( please see secreenshoot )

- Also after Category name - ,  must be deleted,
- At the end of fisrt line of  <meta name="description" content=".............  &lt;br /&gt; ( those marks must be deleted and line must be closed with " />

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Auto Region name Usage / Inserting into META Description field
« Reply #8 on: January 25, 2018, 10:54:08 am »
Try it like this.

Code: [Select]
function cust_ad_meta_desc($desc) {
    if (osc_is_ad_page()) {
        return osc_item_category()."  ".osc_item_city().", ".osc_item_region()." - ".osc_item_title();
    }
    else return $desc;
}

osc_add_filter('meta_description_filter', 'cust_ad_meta_desc');

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: Auto Region name Usage / Inserting into META Description field
« Reply #9 on: January 25, 2018, 12:18:37 pm »
This is caused header problem,
see secreenshoot,

By the way, given code should must be add bottom of function.php ( bender )?  I am talking for bender,
is there difference with wizards + bender for this function?

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Auto Region name Usage / Inserting into META Description field
« Reply #10 on: January 25, 2018, 01:44:29 pm »
I just removed a single - from the code.... Please pay attention when you are modifying your script...

Do not leave empy lines after ?> in functions files ir in between ?> and <?php

Aficionado

  • Guest
Re: Auto Region name Usage / Inserting into META Description field
« Reply #11 on: January 25, 2018, 02:36:03 pm »
The best/clean way to change meta titles and description is to Install OsclassWizards SEO plugin version 1 (free) and modify it.

That way you have all the changes without modifying the theme or the core.

The code in that Seo plugin is little and clean and easy to read and modify.

You can do practically whatever you want.

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: Auto Region name Usage / Inserting into META Description field
« Reply #12 on: January 25, 2018, 03:23:53 pm »
Here is function.php file,
I just placed code you gave me...I have no any other modification,

I sent you file at the attachment, can you please place code and send me back...
Thank your help...

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: Auto Region name Usage / Inserting into META Description field
« Reply #13 on: January 25, 2018, 09:14:14 pm »
Hello marius-ciclistu@
Did you check file?
I need really help about this case,

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Auto Region name Usage / Inserting into META Description field
« Reply #14 on: January 25, 2018, 09:49:47 pm »
Replace

Code: [Select]
osc_add_hook('search_ads_listing_medium', 'search_ads_listing_medium_fn');
?>
with

Code: [Select]
osc_add_hook('search_ads_listing_medium', 'search_ads_listing_medium_fn');

function cust_ad_meta_desc($desc) {
    if (osc_is_ad_page()) {
        return osc_item_category()." ".osc_item_city().", ".osc_item_region()." - ".osc_item_title();
    }
    else return $desc;
}

osc_add_filter('meta_description_filter', 'cust_ad_meta_desc');
?>