3

Via the Change Wordpress Title question I found that the page with the "civicrm" slug is what is used for content replacement by CiviCRM.

If I want to remove the CiviCRM "prefix" to all the crm pages just simply removing the page title for the CiviCRM page in WordPress is not enough. Now I see " - Site Name".

Example URL: http://localhost/testsite/civicrm/?page=CiviCRM&q=civicrm/event/ical&reset=1&list=1&html=1

Page's title " - Test Site" (without quotes).

Is there a way to prevent CiviCRM from prefixing the " - "?

Update:

After doing a quick search in the plugin for "' - '" in all the PHP files I'm seeing code like this:

CRM_Utils_System::setTitle($displayName . ' - ' . $activityName);

I'm thinking it's not possible. That string looks pretty hard-coded to me.

1 Answer 1

4

If you just want the site name as the title, you can filter it:

// add filter only when basepage has been parsed
add_action( 'civicrm_basepage_parsed', 'my_override_civi_title' );

function my_override_civi_title() {
  // for themes that use wp_title()
  add_filter( 'wp_title', 'my_page_title', 200, 1 );
  // for themes that use add_theme_support( 'title-tag' )
  add_filter( 'document_title_parts', 'my_page_title_parts' );
}

function my_page_title( $title ) {
  return get_bloginfo( 'name' );
}

function my_page_title_parts( $parts ) {
  unset( $parts['title'] );
  unset( $parts['page'] );
  return $parts;
}

Your own theme's implementation will determine the final method used.

1
  • Found out that the CiviCRM page that is created and used for showing content was using its name.
    – Mike G
    Commented Jan 31, 2017 at 0:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.