Ejemplo n.º 1
0
function vp_seo_title($title)
{
    global $wpdb;
    //see if the URL has the property ref in it
    $options = get_option('vp_options');
    if (get_the_ID() == $options['pageid']) {
        $vpid = "0";
        $thisurl = vp_curURL();
        $baseurl = get_permalink($options['pageid']);
        if (isset($_GET["vebraid"])) {
            $vpid = $_GET["vebraid"];
        } else {
            if (strpos($thisurl, $baseurl) !== FALSE) {
                $vpid = str_replace("/", "", str_replace($baseurl, "", $thisurl));
            }
        }
        $table_name = $wpdb->prefix . "vebraproperties";
        $sql = "SELECT * FROM {$table_name} WHERE vebraid=" . $vpid;
        if ($properties = $wpdb->get_results($sql)) {
            foreach ($properties as $property) {
                return $property->property_type . ' : ' . $property->address_display;
            }
        }
    }
    return $title;
}
Ejemplo n.º 2
0
function vp_theproperty()
{
    global $vp_detailvars;
    global $wpdb;
    //see if the URL has the property ref in it
    $options = get_option('vp_options');
    $thisurl = vp_curURL();
    $baseurl = get_permalink($options['pageid']);
    if (isset($_GET["vebraid"])) {
        $vp_detailvars['vebraid'] = $_GET["vebraid"];
    } else {
        if (strpos($thisurl, $baseurl) !== FALSE) {
            $vp_detailvars['vebraid'] = str_replace("/", "", str_replace($baseurl, "", $thisurl));
        }
    }
    //build the query
    $table_name = $wpdb->prefix . "vebraproperties";
    $sql = "SELECT * FROM {$table_name} LIMIT 1";
    if ($vp_detailvars["vebraid"] != "") {
        $sql = "SELECT * FROM {$table_name} WHERE vebraid=" . $vp_detailvars["vebraid"];
    }
    if ($vp_detailvars["agentref"] != "") {
        $sql = "SELECT * FROM {$table_name} WHERE agentref='" . $vp_detailvars["agentref"] . "'";
    }
    return $wpdb->get_results($sql);
}