• Resolved zimbo000

    (@zimbo000)


    The BD plugin is used with a theme (inFocus) that has its own internal SEO functions that allows a page title and description to be specified for each page. As such the site does not need to, and does not, use Yoast. (And it will not change either – it’s an established news site with over 3000 pages/posts…)

    The page title is set to “The Henley Herald Business Directory” on the /business-directory page and that is OK.

    But on, say, the Accountants category listing page (/business-directory/wpbdp_category/accountants/) the plugin inserts the category into the page title so this is being set:
    <title>Accountants The Henley Herald Business Directory</title>

    Equally on a company listing (/business-directory/12672/xyz-windows/): for company XYZ Windows the current title is
    <title>XYZ Windows The Henley Herald Business Directory</title>

    What I want to do is edit the relevant plugin code to have <title> set as
    <title>Accountants in The Henley Herald Business Directory</title>
    and
    <title>XYZ Windows in The Henley Herald Business Directory</title>

    i.e. change the code to add ‘ in’ after the category and company name.

    I’ve searched various code modules but cannot work out where you insert the category or company name into <title>. Please can you tell me where it does this so I can modify the code?

    https://www.ads-software.com/plugins/business-directory-plugin/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    Hi zimbo000,

    SEO support has always been a tricky thing to add. Most plugins that add this don’t add an API to integrate with and themes that add this, are a whole different beast trying to put it directly into the pages. For BD, we have to control some of the output a bit because we use a short code on a page to output the various pieces of the directory (that makes your integration easier instead of having 5 templates you might have to change, and we pick up your theme look and feel that way).

    Because of that, we looked at all SEO plugins and found only one that offered the support we needed. Fortunately, it was the #1 SEO plugin for WP as well (Yoast). We integrate with Yoast because it provides the API we need to override things on a page to do proper SEO. No other plugin or theme offers that.

    You can read more about that integration here: https://businessdirectoryplugin.com/support-forum/faq/how-to-configure-yoast-seo-correctly-for-bd/

    As for how to do this with your theme, the only way I am aware of would be to hack BD to use the theme’s SEO functions to get what you want. Personally, I have not found a single SEO theme or plugin to be better than Yoast’s (they’ve been doing it the longest, they get all the tricks and have honestly, the best implementation). You’ll probably find that to be easier.

    This customization guide here will tell you all about the BD file structure and which files control which things if you want to go that route anyhow: https://businessdirectoryplugin.com/docs/customization-guide/ Aside from this, you’ll need to work the details out on your own.

    Thread Starter zimbo000

    (@zimbo000)

    I don’t disagree and in fact use Yoast on another site. However the theme’s SEO is very good and the site ranks very well on Google, generally being #1 or 2 for its posts (it’s a local news website), so the client is unlikely to want to change.

    Anyway, I found the answer. In the theme SEO I set the page title for /business-directory/ to be ‘The Henley Herald Business Directory’. The plugin however modifies that title in business-directory-plugin.php by inserting various words (‘Find a Listing’), the category name, $post_title etc etc via the function _meta_title, line 1120 onwards.

    So, for example, in “case ‘browsecategory'” I’ve changed
    return $term->name . ' ' . $sep . ' ' . $title;
    to
    return $term->name . ' in ' . $sep . ' ' . $title;
    and I now have
    <title>Accountants in The Henley Herald Business Directory</title>

    Result!

    However… the function declaration on line 1120 is:
    function _meta_title( $title = '', $sep = '?', $seplocation = 'right' )
    which, because $sep has a value, I think should result in
    <title>Accountants in ? The Henley Herald Business Directory</title>
    – but there is no ? in the HTML.

    Now I actually don’t want the ? but as $sep is specified, why is “?” not appearing in the title?

    Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    The statement above when inside of a function call:

    foo ($sep = ‘value’)

    Means this, when calling the function foo:
    – If $sep is NULL, use ‘value’
    – If $sep is NOT NULL, use the current content of $sep

    So I’m guessing that $sep = ” in your case, overriding the chevrons.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to modify the page title’ is closed to new replies.