Esempio n. 1
0
/**
 * @deprecated since 2.2.1
 */
function wpbdp_bar($parts = array())
{
    $parts = wp_parse_args($parts, array('links' => true, 'search' => false));
    $html = '<div class="wpbdp-bar cf">';
    $html .= apply_filters('wpbdp_bar_before', '', $parts);
    if ($parts['links']) {
        $html .= wpbdp_main_links();
    }
    if ($parts['search']) {
        $html .= wpbdp_search_form();
    }
    $html .= apply_filters('wpbdp_bar_after', '', $parts);
    $html .= '</div>';
    return $html;
}
Esempio n. 2
0
 public function main_page()
 {
     $html = '';
     if (count(get_terms(WPBDP_CATEGORY_TAX, array('hide_empty' => 0))) == 0) {
         if (is_user_logged_in() && current_user_can('install_plugins')) {
             $html .= wpbdp_render_msg(_x('There are no categories assigned to the business directory yet. You need to assign some categories to the business directory. Only admins can see this message. Regular users are seeing a message that there are currently no listings in the directory. Listings cannot be added until you assign categories to the business directory.', 'templates', 'WPBDM'), 'error');
         } else {
             $html .= "<p>" . _x('There are currently no listings in the directory.', 'templates', 'WPBDM') . "</p>";
         }
     }
     if (current_user_can('administrator')) {
         if ($errors = wpbdp_payments_api()->check_config()) {
             foreach ($errors as $error) {
                 $html .= wpbdp_render_msg($error, 'error');
             }
         }
     }
     $listings = '';
     if (wpbdp_get_option('show-listings-under-categories')) {
         $listings = $this->view_listings(false);
     }
     if (current_user_can('administrator') && wpbdp_get_option('hide-empty-categories') && wp_count_terms(WPBDP_CATEGORY_TAX, 'hide_empty=0') > 0 && wp_count_terms(WPBDP_CATEGORY_TAX, 'hide_empty=1') == 0) {
         $msg = _x('You have "Hide Empty Categories" on and some categories that don\'t have listings in them. That means they won\'t show up on the front end of your site. If you didn\'t want that, click <a>here</a> to change the setting.', 'templates', 'WPBDM');
         $msg = str_replace('<a>', '<a href="' . admin_url('admin.php?page=wpbdp_admin_settings&groupid=listings#hide-empty-categories') . '">', $msg);
         $html .= wpbdp_render_msg($msg);
     }
     $html .= wpbdp_render(array('businessdirectory-main-page', 'wpbusdirman-index-categories'), array('submit_listing_button' => wpbusdirman_post_menu_button_submitlisting(), 'view_listings_button' => wpbusdirman_post_menu_button_viewlistings(), 'action_links' => wpbusdirman_post_menu_button_submitlisting() . wpbusdirman_post_menu_button_viewlistings(), 'search_form' => wpbdp_get_option('show-search-listings') ? wpbdp_search_form() : '', 'listings' => $listings));
     return $html;
 }