Advertisement:

Author Topic: How remove or replace title site in pages?  (Read 1339 times)

fmohsen

  • Newbie
  • *
  • Posts: 30
How remove or replace title site in pages?
« on: April 26, 2017, 10:39:08 am »
Hi all
Please Help me
How remove or replace title site in pages?
osclass add site title in title any pages how remove it or replace

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: How remove or replace title site in pages?
« Reply #1 on: April 26, 2017, 08:37:56 pm »
Look in header.php from your theme folder.

fmohsen

  • Newbie
  • *
  • Posts: 30
Re: How remove or replace title site in pages?
« Reply #2 on: April 28, 2017, 09:41:34 am »
Thank you answer
but if remove and replace title tag  not good seo because one title tag fixed in all page
me want edit meta_title() but cant

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: How remove or replace title site in pages?
« Reply #3 on: April 28, 2017, 01:01:15 pm »
You must search the function that is making the title in the theme's files and them modify it as you please to result in a different title patern.

fmohsen

  • Newbie
  • *
  • Posts: 30
Re: How remove or replace title site in pages?
« Reply #4 on: April 29, 2017, 09:53:58 am »
i search  but not find function
i found meta_title()  but after change code in function no change in site
so post topic for help

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: How remove or replace title site in pages?
« Reply #5 on: April 29, 2017, 11:52:37 am »
This is for 3.7.1
oc-includes/osclass/functions.php

Code: [Select]
function meta_title() {
    $location = Rewrite::newInstance()->get_location();
    $section  = Rewrite::newInstance()->get_section();
    $text = '';

    switch ($location) {
        case ('item'):
            switch ($section) {
                case 'item_add':    $text = __('Publish a listing'); break;
                case 'item_edit':   $text = __('Edit your listing'); break;
                case 'send_friend': $text = __('Send to a friend') . ' - ' . osc_item_title(); break;
                case 'contact':     $text = __('Contact seller') . ' - ' . osc_item_title(); break;
                default:            $text = osc_item_title() . ' ' . osc_item_city(); break;
            }
        break;
        case('page'):
            $text = osc_static_page_title();
        break;
        case('error'):
            $text = __('Error');
        break;
        case('search'):
            $region   = osc_search_region();
            $city     = osc_search_city();
            $pattern  = osc_search_pattern();
            $category = osc_search_category_id();
            $s_page   = '';
            $i_page   = Params::getParam('iPage');

            if($i_page != '' && $i_page > 1) {
                $s_page = ' - ' . __('page') . ' ' . $i_page;
            }

            $b_show_all = ($region == '' && $city == '' && $pattern == '' && empty($category));
            $b_category = (!empty($category));
            $b_pattern  = ($pattern != '');
            $b_city     = ($city != '');
            $b_region   = ($region != '');

            if($b_show_all) {
                $text = __('Show all listings') . ' - ' . $s_page . osc_page_title();
            }

            $result = '';
            if($b_pattern) {
                $result .= $pattern . ' » ';
            }

            if($b_category && is_array($category) && count($category) > 0) {
                $cat = Category::newInstance()->findByPrimaryKey($category[0]);
                if( $cat ) {
                    $result .= $cat['s_name'].' ';
                }
            }

            if($b_city) {
                $result .= $city . ' » ';
            } else if($b_region) {
                $result .= $region . ' » ';
            }

            $result = preg_replace('|\s?»\s$|', '', $result);

            if($result == '') {
                $result = __('Search results');
            }

            $text = '';
            if( osc_get_preference('seo_title_keyword') != '' ) {
                $text .= osc_get_preference('seo_title_keyword') . ' ';
            }
            $text .= $result . $s_page;
        break;
        case('login'):
            switch ($section) {
                case('recover'): $text = __('Recover your password');
                default:         $text = __('Login');
            }
        break;
        case('register'):
            $text = __('Create a new account');
        break;
        case('user'):
            switch ($section) {
                case('dashboard'):       $text = __('Dashboard'); break;
                case('items'):           $text = __('Manage my listings'); break;
                case('alerts'):          $text = __('Manage my alerts'); break;
                case('profile'):         $text = __('Update my profile'); break;
                case('pub_profile'):     $text = __('Public profile') . ' - ' . osc_user_name(); break;
                case('change_email'):    $text = __('Change my email'); break;
                case('change_username'): $text = __('Change my username'); break;
                case('change_password'): $text = __('Change my password'); break;
                case('forgot'):          $text = __('Recover my password'); break;
            }
        break;
        case('contact'):
            $text = __('Contact');
        break;
        default:
            $text = osc_page_title();
        break;
    }

    if( !osc_is_home_page() ) {
        if($text!='') {
            $text .= ' - ' . osc_page_title();
        } else {
            $text = osc_page_title();
        }
    }

    return (osc_apply_filter('meta_title_filter', $text));
}

For example, if you want to change the title of the page: create new account:

EDIT:  The below replacement of english words can be done in the language files of your theme (.po and .mo file) instead of doing it in the function's code. details: https://forums.osclass.org/general-help/can-i-change-the-'publish-your-ad-for-free'-button-to-say-something-else/msg149596/#msg149596

You replace:

Code: [Select]
        case('register'):
            $text = __('Create a new account');

with

Code: [Select]
        case('register'):
            $text = __('your text here');
« Last Edit: April 30, 2017, 11:06:00 am by marius-ciclistu »

fmohsen

  • Newbie
  • *
  • Posts: 30
Re: How remove or replace title site in pages?
« Reply #6 on: April 30, 2017, 08:22:40 am »
Thanks
I change code but not apply me change
second problem  meta title contain name site add title page
example "Iphone 6 Mas de Catalá - NoLogo Inc." in demo osclass that "Iphone 6 Mas de Catalá " is  title page and "NoLogo Inc" is  title site
now me want change "NoLogo Inc"
Please me

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: How remove or replace title site in pages?
« Reply #7 on: April 30, 2017, 09:51:32 am »
1.Go to your admin page of your osclass and look under settings if you want to modify your site title.

2.If you want to remove your site title from your pages' titles,

 replace


Code: [Select]
if( !osc_is_home_page() ) {
        if($text!='') {
            $text .= ' - ' . osc_page_title();
        } else {
            $text = osc_page_title();
        }
    }

with

Code: [Select]
if( !osc_is_home_page() ) {
        if($text!='') {
        } else {
            $text = osc_page_title();
        }
    }


in meta_title function and DO NOT modify anything else.

3.If you want to change the english text of one of your pages from, for example 'Contact - Site_name' to 'Contact-us - Site_name' you edit the language files as described here: https://forums.osclass.org/general-help/can-i-change-the-'publish-your-ad-for-free'-button-to-say-something-else/msg149596/#msg149596

4. If you want to change other than english language text of one of your pages, you edit that language files (.po and .mo files) as described here: https://forums.osclass.org/general-help/can-i-change-the-'publish-your-ad-for-free'-button-to-say-something-else/msg149596/#msg149596

Look in  theme.po first. There should be the words 'Contact' and 'Create a new account'.
« Last Edit: April 30, 2017, 11:05:21 am by marius-ciclistu »

fmohsen

  • Newbie
  • *
  • Posts: 30
Re: How remove or replace title site in pages?
« Reply #8 on: May 01, 2017, 09:38:08 am »
Thank your help
but not know why change in function.php file not apply

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: How remove or replace title site in pages?
« Reply #9 on: May 01, 2017, 12:01:13 pm »
Hit CTRL-F5 a couple of times to refresh your page, or open chrome, hit  CTRL+SHIFT+N and open there your site.

fmohsen

  • Newbie
  • *
  • Posts: 30
Re: How remove or replace title site in pages?
« Reply #10 on: May 05, 2017, 08:27:13 am »
I find problem Plugin 'Meta Edit'

Thank you marius-ciclistu