function featuredvendors($title = '<h2>Featured Vendors</h2>', $cat = "", $num_rows = 1, $min = 4) { return; $featpod = new Pod('vendor_profiles'); // leave this here for REFERENCE ONLY, it is not used $sql = "SELECT wp_pod_tbl_vendor_profiles.id AS vid, wp_pod_tbl_vendor_profiles.name AS name, wp_pod_tbl_vendor_profiles.slug AS slug, " . "wp_pod_tbl_vendor_profiles.description AS description, v2_profile_image_sm FROM wp_pod_tbl_vendor_profiles " . "JOIN wp_pod ON (wp_pod_tbl_vendor_profiles.id = wp_pod.tbl_row_id) " . "JOIN wp_pod_rel ON (wp_pod.id = wp_pod_rel.pod_id) " . "JOIN wp_pod_tbl_categories ON (wp_pod_rel.tbl_row_id = wp_pod_tbl_categories.id) " . "WHERE " . "wp_pod_rel.field_id = 110 " . "AND profile_type = 'Platinum' "; if ($cat == 'services') { // leave this here for REFERENCE ONLY, it is not used $sql .= "AND wp_pod_tbl_categories.slug NOT IN ('venues','dining', '')"; $sqlwhere = "profile_type = 'platinum' " . "AND ((category1 NOT IN ('venues','dining', 'uncategorized', '')) " . "OR (category2 NOT IN ('venues','dining', 'uncategorized', '')) " . "OR (category3 NOT IN ('venues','dining', 'uncategorized', '')) " . "OR (category4 NOT IN ('venues','dining', 'uncategorized', '')) " . "OR (category5 NOT IN ('venues','dining', 'uncategorized', '')) " . ")"; } elseif ($cat != '') { // leave this here for REFERENCE ONLY, it is not used $sql .= "AND wp_pod_tbl_categories.slug = '{$cat}'"; $sqlwhere = "profile_type = 'platinum' " . "AND ((category1 = '{$cat}') " . "OR (category2 = '{$cat}') " . "OR (category3 = '{$cat}') " . "OR (category4 = '{$cat}') " . "OR (category5 = '{$cat}') " . ")"; } else { } $featpod->findRecords('id', -1, $sqlwhere); $total_vps = $featpod->getTotalRows(); $avp = array(); // there has to be at least $min vendors to show the featured block if ($total_vps >= $min) { while ($featpod->fetchRecord()) { // make sure we have an ACTUAL image file $img = get_ao_image($featpod); // make sure the image is square (only square images can be displayed here) if (image_is_square($img)) { $avp[$featpod->get_field('id')] = get_vendorfields($featpod); } } } else { return false; } // randomize the vendor list shuffle($avp); // now pull the first x vendors $avp = array_slice($avp, 0, $num_rows * 4); echo $title; $i = 0; echo '<div class="featured_block">'; foreach ($avp as $vid => $fields) { $i++; // end the block and start a new one if needed if ($i == 5) { echo '</div><div class="featured_block">'; $i = 1; echo '<br clear="all" />'; } // spit out the image echo <<<HEREDOC \t\t<div class="featured_wrap"> \t\t\t<div class="featured_image"><a href="/profile/{$fields["slug"]}"><img src="{$fields["imag"]}" title="{$fields["name"]}" alt="{$fields["name"]}"/></a></div> \t\t\t<div class="featured_name"><a href="/profile/{$fields["slug"]}">{$fields["name"]}</a></div> \t\t</div> HEREDOC; } echo '</div><br clear="all" />'; }
<?php /* Template Name: Vendor Profile 5 */ include_once 'guide-functions.php'; require_once 'vendor_access/recaptchalib.php'; ao_set_in_guide(true); $slug = pods_url_variable(1); $cmd = pods_url_variable(2); $goto = pods_url_variable(3); $err = array(); $profile = new Pod('vendor_profiles'); $profile->findRecords('id', -1, "t.slug = '{$slug}'"); $total = $profile->getTotalRows(); if ($total > 0) { $profile->fetchRecord(); $a = get_vendorfields($profile); } else { get_header(); ?> <div class="post"> <h1>Vendor Not Found</h1> <p>We apologize for the mixup but we were not able to find this vendor.</p> <p>Go to the <a href="javascript:history.back();">Occasions Magazine home page</a> or <a href="javascript:history.back();">back to the page that sent you here</a>.</p> </div> <?php get_footer(); } // ==================================================================== // REDIRECT TRACKING // ==================================================================== if ($cmd == 'go') {
require "/home/oonline/public_html/wp-blog-header.php"; // for some reason WP thinks this is a "not found" page and returns a 404 error header, so we force a 200 status_header(200); ?> <div id="menu-content-featured"> <div class="head3">Highest Rated Vendors</div> <?php include_once 'guide-functions.php'; $vp = new Pod('vendor_profiles'); $vp->findRecords('', 0, '', 'SELECT * FROM wp_pod_tbl_vendor_profiles WHERE profile_type = \'platinum\' AND rating > 4 ORDER BY NAME'); $total_vps = $vp->getTotalRows(); $avp = array(); if ($total_vps > 0) { while ($vp->fetchRecord()) { // get our fields from the POD $avp[$vp->get_field('id')] = get_vendorfields($vp); } } // shuffle our vendors and then only take the first two shuffle($avp); $avp = array_slice($avp, 0, 3, true); foreach ($avp as $vid => $fields) { // create our rating box $rating_data = get_ratingbox($fields["rati"]); echo <<<HEREDOC \t\t<div class="menu-featured-vendor" onclick="window.location.href='/profile/{$fields["slug"]}'"> \t\t\t<a href="/profile/{$fields["slug"]}"><img src="{$fields["imag"]}" title="{$fields["summ"]}" /></a> \t\t\t<a href="/profile/{$fields["slug"]}">{$fields["name"]}</a> \t\t\t<!-- <h2 class="guidelist_name"><a href="/profile/{$fields["slug"]}">{$fields["name"]}</a></h2> --> \t\t\t{$rating_data} \t\t</div>