Plugin Directory

Changeset 1731185


Ignore:
Timestamp:
09/17/2017 02:49:02 PM (9 years ago)
Author:
richartkeil
Message:

change page title where possible

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exposify/trunk/public.php

    r1703948 r1731185  
    2121    $this->exposify = new Exposify($apiKey, $baseUrl);
    2222
    23     add_filter('the_content',        [$this, 'changePageContent']);
    24     add_filter('page_template',      [$this, 'changePageTemplate']);
    25     add_action('wp_enqueue_scripts', [$this, 'insertLinks']);
     23    add_filter('the_content',            [$this, 'changePageContent']);
     24    add_filter('page_template',          [$this, 'changePageTemplate']);
     25    add_action('wp_enqueue_scripts',     [$this, 'insertLinks']);
     26    add_filter('the_title',              [$this, 'changePageTitle']);
     27    add_filter('pre_get_document_title', [$this, 'changeSiteTitle']);
    2628  }
    2729
     
    8789  {
    8890    if (
     91      !get_query_var('slug') ||
    8992      get_the_ID() != get_option('exposify_properties_page_id') ||
    9093      !in_the_loop()
     
    9699
    97100    return $this->exposify->html->getTitle();
     101  }
     102
     103  /**
     104  * Change the site title to the property name.
     105  *
     106  * @param  string  $oldTitle
     107  * @return string
     108  */
     109  public function changeSiteTitle($oldTitle)
     110  {
     111    if (get_query_var('slug')) {
     112      $this->attemptRequest();
     113      return $this->exposify->html->getTitle();
     114    }
     115
     116    return $oldTitle;
    98117  }
    99118
Note: See TracChangeset for help on using the changeset viewer.