function solostream_theme_js() { if (!is_admin() && is_singular()) { global $post; $featcontent = get_post_meta($post->ID, 'post_featcontent', true); $featvideo = get_post_meta($post->ID, 'post_featvideo', true); $featpages = get_post_meta($post->ID, 'post_featpages', true); $featgalleries = get_post_meta($post->ID, 'post_featgalleries', true); if ($featcontent != "No" || $featvideo == "Yes" || $featpages == "Yes" || $featgalleries == "Yes" || is_pagetemplate_active('page-youtube.php')) { wp_enqueue_script('jquery'); wp_enqueue_script('flexslider', get_bloginfo('template_directory') . '/js/flexslider.js', array('jquery')); } if (is_pagetemplate_active('page-portfolio.php')) { wp_enqueue_script('jquery'); wp_enqueue_script('framework', get_bloginfo('template_directory') . '/js/framework.js', array('jquery')); } } if (!is_admin() && is_home()) { global $post; $page_id = get_option('page_for_posts'); $featcontent = get_post_meta($page_id, 'post_featcontent', true); $featvideo = get_post_meta($page_id, 'post_featvideo', true); $featpages = get_post_meta($page_id, 'post_featpages', true); $featgalleries = get_post_meta($post->ID, 'post_featgalleries', true); if ($featcontent != "No" || $featvideo == "Yes" || $featpages == "Yes" || $featgalleries == "Yes") { wp_enqueue_script('jquery'); wp_enqueue_script('flexslider', get_bloginfo('template_directory') . '/js/flexslider.js', array('jquery')); } } if (!is_admin()) { wp_enqueue_script('external', get_bloginfo('template_directory') . '/js/external.js'); wp_enqueue_script('suckerfish', get_bloginfo('template_directory') . '/js/suckerfish.js'); if (get_option('solostream_show_catnav') == 'yes') { wp_enqueue_script('suckerfish-cat', get_bloginfo('template_directory') . '/js/suckerfish-cat.js'); } if (get_option('solostream_responsive_off') != 'Yes') { wp_enqueue_script('mobilmenu', get_bloginfo('template_directory') . '/js/jquery.mobilemenu.js', array('jquery')); } if (get_option('solostream_features_on') != 'No' || get_option('solostream_videos_on') == 'Yes' || get_option('solostream_featpage_on') == 'Yes' || is_active_widget(false, false, 'videoslide-widget')) { wp_enqueue_script('jquery'); wp_enqueue_script('flexslider', get_bloginfo('template_directory') . '/js/flexslider.js', array('jquery')); } if (is_active_widget(false, false, 'sidetabs-widget') || is_pagetemplate_active("page-tabbed-archive.php") || is_pagetemplate_active("page-tabbed-cat.php")) { wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-per', get_bloginfo('template_directory') . '/admin/jquery-ui-personalized-1.5.2.packed.js', array('jquery')); wp_enqueue_script('sprinkle-tabs', get_bloginfo('template_directory') . '/admin/sprinkle-tabs.js', array('jquery')); } } }
<?php if (is_pagetemplate_active("template-contact.php") || is_pagetemplate_active("template-contact-2.php")) { $contactPages = ot_get_page("contact"); if ($contactPages[0]) { $contactUrl = get_page_link($contactPages[0]); } else { $contactPages = get_contact_page2(); $contactUrl = get_page_link($contactPages[0]); } } else { $contactUrl = "#"; } ?> <div class="the-error-msg"> <strong class="font-replace"><?php _e("No Articles Found", THEME_NAME); ?> </strong> <p><?php printf(__('Sorry, there are no articles here ! <br/>You can <a href="%1$s">contact us</a> to resolve this problem !', THEME_NAME), $contactUrl); ?> </p> <p><?php printf(__('Or You can still <a href="%1$s">go back to Homepage</a> !', THEME_NAME), home_url()); ?> </p> </div>
function form($instance) { $defaults = array('title_name' => true, 'title_contact' => false); $instance = wp_parse_args((array) $instance, $defaults); $agent = isset($instance['agent']) ? $instance['agent'] : false; $title = $instance['title_name'] ? '[' . __('Agent Name', 'wpsight') . ']' : strip_tags($instance['title']); ?> <p> <label for="<?php echo $this->get_field_id('agent'); ?> "><?php _e('Agent', 'wpsight'); ?> :</label> <select class="widefat" id="<?php echo $this->get_field_id('agent'); ?> " name="<?php echo $this->get_field_name('agent'); ?> "> <option value=""><?php _e('Please select user', 'wpsight'); ?> …</option> <?php $args = apply_filters('wpsight_featured_agent_user_args', array()); foreach (get_users($args) as $user) { echo '<option value="' . $user->ID . '"' . selected($user->ID, $agent, false) . '>' . $user->display_name . '</option>'; } ?> </select> </p> <div<?php if ($agent == false) { echo ' style="display:none"'; } ?> > <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title', 'wpsight'); ?> : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /> </label> </p> <p> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('title_name'); ?> " name="<?php echo $this->get_field_name('title_name'); ?> "<?php checked($instance['title_name'], true); ?> /> <label for="<?php echo $this->get_field_id('title_name'); ?> "><?php _e('Agent name as widget title', 'wpsight'); ?> </label> </p> <p<?php if (!is_pagetemplate_active('page-tpl-contact.php')) { echo ' style="display:none"'; } ?> > <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('title_contact'); ?> " name="<?php echo $this->get_field_name('title_contact'); ?> "<?php checked($instance['title_contact'], true); ?> /> <label for="<?php echo $this->get_field_id('title_contact'); ?> "><?php _e('Show link to contact form', 'wpsight'); ?> </label> </p> </div><?php }
function wpsight_do_listing_favorites_contact_link() { if (!is_page_template('page-tpl-favorites.php') || empty($_COOKIE[WPSIGHT_COOKIE_FAVORITES]) || !is_pagetemplate_active('page-tpl-contact.php')) { return; } ?> <div class="title-actions title-actions-contact"> <a href="<?php echo esc_url(add_query_arg(array('fav' => '1'), get_pagetemplate_permalink('page-tpl-contact.php'))); ?> " class="<?php echo apply_filters('wpsight_title_action_css', 'btn btn-mini', 'contact'); ?> "><i class="icon-envelope-alt"></i> <?php _e('Contact', 'wpsight'); ?> </a> </div><?php }
function wpsight_do_listing_agent($location = false, $widget = false, $instance = false) { /** * Check location and set * $args accordingly */ if ($location == 'archive') { // Set agent ID $agent = get_userdata(get_query_var('author')); $agent_id = $agent->ID; // Set contact link $contact_link = is_pagetemplate_active('page-tpl-contact.php') ? add_query_arg(array(apply_filters('wpsight_author_slug', 'agent') => $agent_id), get_pagetemplate_permalink('page-tpl-contact.php')) : false; // Set $args $args = array('title' => $agent->display_name, 'contact' => esc_url($contact_link), 'image' => array('show' => true, 'align' => 'right', 'linked' => true), 'bio' => true, 'email' => array('show' => true, 'icon' => '<i class="icon-envelope"></i> ', 'linked' => true), 'url' => array('show' => true, 'icon' => '<i class="icon-external-link"></i> ', 'linked' => true), 'custom' => array('fields' => wpsight_profile_contact_fields($location), 'icon' => true, 'linked' => true), 'button' => false); $args = apply_filters('wpsight_listing_agent_info_args_archive', $args, $agent_id); } elseif ($location == 'listing') { // Set agent ID $agent_id = get_the_author_meta('ID'); // Set $args $args = array('title' => get_the_author(), 'image' => array('show' => true, 'align' => 'left', 'linked' => true), 'bio' => true, 'email' => array('show' => true, 'icon' => '<i class="icon-envelope"></i> ', 'linked' => true), 'url' => array('show' => true, 'icon' => '<i class="icon-external-link"></i> ', 'linked' => true), 'custom' => array('fields' => wpsight_profile_contact_fields($location), 'icon' => true, 'linked' => true), 'button' => true); $args = apply_filters('wpsight_listing_agent_info_args_listing', $args, $widget, $instance, $agent_id); } elseif ($location == 'featured') { // Set agent ID $agent_id = $instance['agent']; // Set $args $args = array('title' => false, 'image' => array('show' => true, 'align' => 'left', 'linked' => true), 'bio' => true, 'email' => array('show' => true, 'icon' => '<i class="icon-envelope"></i> ', 'linked' => true), 'url' => array('show' => true, 'icon' => '<i class="icon-external-link"></i> ', 'linked' => true), 'custom' => array('fields' => wpsight_profile_contact_fields($location), 'icon' => true, 'linked' => true), 'button' => true); $args = apply_filters('wpsight_listing_agent_info_args_featured', $args, $widget, $instance, $agent_id); } elseif ($location == 'list') { // Set agent ID global $agent_id; // Set $args $args = array('title' => true, 'image' => array('show' => true, 'align' => 'left', 'linked' => true), 'bio' => true, 'email' => array('show' => true, 'icon' => '<i class="icon-envelope"></i> ', 'linked' => true), 'url' => array('show' => true, 'icon' => '<i class="icon-external-link"></i> ', 'linked' => true), 'custom' => array('fields' => wpsight_profile_contact_fields($location), 'icon' => true, 'linked' => true), 'button' => true); $args = apply_filters('wpsight_listing_agent_info_args_list', $args, $agent_id); } $args = apply_filters('wpsight_listing_agent_info_args', $args); // Extract $args extract($args, EXTR_SKIP); // Create listing agent info $listing_agent = '<div class="listing-agent listing-agent-' . $agent_id . ' author-info clearfix">'; if ($title && !is_singular()) { $listing_agent .= '<div class="title title-author clearfix">'; $listing_agent .= '<h2>' . $title . '</h2>'; if (isset($contact) && $contact != false) { $listing_agent .= '<div class="title-actions title-actions-contact">' . "\n"; $listing_agent .= '<a href="' . $contact_link . '" class="btn btn-mini"><i class="icon-envelope-alt"></i>' . __('Contact', 'wpsight') . '</a>' . "\n"; $listing_agent .= '</div>' . "\n"; } $listing_agent .= '</div><!-- .title -->'; } // Get profile image or avatar if ($image['show'] == true) { $author_image = get_the_author_meta('profile_image', $agent_id); if (!empty($author_image)) { $agent_image = '<img src="' . $author_image['url'] . '" class="avatar avatar-align-' . $image['align'] . '" alt="' . $title . '" />'; } else { $agent_image = '<span class="avatar-align-' . $image['align'] . '">' . get_avatar(get_the_author_meta('email', $agent_id), '80', false, $title) . '</span>'; } if ($image['linked'] == true) { $listing_agent .= '<a href="' . get_author_posts_url($agent_id) . '" title="' . __('See my listings', 'wpsight') . '" class="avatar-wrap avatar-wrap-align-' . $image['align'] . '">'; } else { $listing_agent .= '<div class="avatar-wrap avatar-wrap-align-' . $image['align'] . '">'; } $listing_agent .= $agent_image; if ($image['linked'] == true) { $listing_agent .= '</a><!-- .avatar-wrap -->'; } else { $listing_agent .= '</div><!-- .avatar-wrap -->'; } } // Put text next to image in extra div $listing_agent .= '<div class="listing-agent-info">'; // Display agent name on agent list if ($title && $location == 'list') { $listing_agent .= '<h2>' . get_the_author_meta('display_name', $agent_id) . '</h2>'; } // Get profile contact email // if( $email['show'] == true ) { // $agent_email = get_the_author_meta( 'email', $agent_id ); // if( ! empty( $agent_email ) ) { // $listing_agent .= '<div class="listing-agent-email">'; // if( ! empty( $email['icon'] ) ) // $listing_agent .= $email['icon']; // $listing_agent .= '<strong>' . __( 'Email', 'wpsight' ) . ':</strong> '; // if( $email['linked'] == true ) // $listing_agent .= '<a href="mailto:' . antispambot( $agent_email ) . '">'; // $listing_agent .= antispambot( $agent_email ); // if( $email['linked'] == true ) // $listing_agent .= '</a>'; // $listing_agent .= '</div><!-- .listing-agent-email -->'; // } // } // Get profile contact website if ($url['show'] == true) { $agent_url = get_the_author_meta('url', $agent_id); if (!empty($agent_url)) { $listing_agent .= '<div class="listing-agent-url">'; if (!empty($url['icon'])) { $listing_agent .= $url['icon']; } $listing_agent .= '<strong>' . __('Website', 'wpsight') . ':</strong> '; if ($url['linked'] == true) { $listing_agent .= '<a href="' . $agent_url . '" target="_blank">'; } $listing_agent .= $agent_url; if ($email['linked'] == true) { $listing_agent .= '</a>'; } $listing_agent .= '</div><!-- .listing-agent-url -->'; } } // Get profile contact custom fields foreach ($custom['fields'] as $k => $v) { $agent_meta = get_the_author_meta($k, $agent_id); if (!empty($agent_meta)) { $listing_agent .= '<div class="listing-agent-' . $k . '">'; if (!empty($v['icon']) && $custom['icon'] !== false) { $listing_agent .= $v['icon']; } // $listing_agent .= '<strong>' . $v['label'] . ':</strong> '; if ($custom['linked'] == true && $v['url'] != false) { $url = $v['url'] . $agent_meta; if ($v['url'] === true) { $url = $agent_meta; } $listing_agent .= '<a href="' . $url . '" target="_blank">'; } if ($k == 'email') { $listing_agent .= '<strong><a href="mailto:' . $agent_meta . '">' . $agent_meta . '</a></strong>'; } else { $listing_agent .= '<strong>' . $agent_meta . '</strong>'; } if ($custom['linked'] == true && $v['url'] != false) { $listing_agent .= '</a>'; } $listing_agent .= '</div><!-- .listing-agent-' . $k . ' -->'; } } // Create author archive button if ($button == true && !is_author()) { // $listing_agent .= '<a href="' . get_author_posts_url( $agent_id ) . '" class="' . apply_filters( 'wpsight_button_class_agent', 'btn' ) . '">'; // $listing_agent .= __( 'See my listings', 'wpsight' ); // $listing_agent .= '</a>'; $listing_agent .= '<div><i class="fa fa-user"></i> <a href="' . get_author_posts_url($agent_id) . '" class="agent-profile-link">'; $listing_agent .= __('Agent profile', 'wpsight'); $listing_agent .= '</a></div>'; } // Get profile description/bio if ($bio == true) { $listing_agent .= '<div class="listing-agent-bio">'; $listing_agent .= wpsight_format_content(get_the_author_meta('description', $agent_id)); $listing_agent .= '</div><!-- .listing-agent-bio -->'; } // Add link to profile for admins // if( current_user_can( 'edit_users' ) ) { // $listing_agent .= '<div class="listing-agent-profile">'; // $listing_agent .= '<i class="icon-user"></i> <strong>' . __ ( 'Admin', 'wpsight' ) . ':</strong> '; // $listing_agent .= '<a href="' . admin_url( 'user-edit.php?user_id=' . $agent_id, is_ssl() ? 'https' : 'http' ) . '" class="wpsight-listing-agent-profile">' . __ ( 'See profile', 'wpsight' ) . '</a>'; // $listing_agent .= '</div><!-- .listing-agent-profile -->'; // } // Put text next to image in extra div $listing_agent .= '</div><!-- .listing-agent-info -->'; // Create listing agent info $listing_agent .= '</div><!-- .listing-agent -->'; // Filter and output echo apply_filters('wpsight_listing_agent_info', $listing_agent); }
function wpsight_listing_title_action_favorite($data) { $labels = array('favorites_add' => $data['label'], 'favorites_see' => __('Favorites', 'wpsight')); $labels = apply_filters('wpsight_do_listing_title_actions_labels', $labels); // Check if listings are still published $favorites_removed = array(); if (isset($_COOKIE[WPSIGHT_COOKIE_FAVORITES])) { $favorites = explode(',', $_COOKIE[WPSIGHT_COOKIE_FAVORITES]); foreach ($favorites as $favorite) { if (get_post_status($favorite) != 'publish') { $favorites_removed[] = $favorite; } } } ?> <script type="text/javascript"> jQuery(document).ready(function($){ var cookie_favs = '<?php echo WPSIGHT_COOKIE_FAVORITES; ?> '; var removeValue = function(list, value) { var values = list.split(","); for(var i = 0 ; i < values.length ; i++) { if(values[i] == value) { values.splice(i, 1); return values.join(","); } } return list; }; <?php // Remove unpublished listings from cookie if (!array_empty($favorites_removed)) { foreach ($favorites_removed as $favorite_removed) { echo 'var favs = removeValue($.cookie(cookie_favs), ' . $favorite_removed . ');'; } echo '$.cookie(cookie_favs, favs,{ expires: 60, path: \'' . COOKIEPATH . '\' });'; } ?> if($.cookie(cookie_favs)!=null) { if($.cookie(cookie_favs).search('<?php the_ID(); ?> ')!=-1) { $('.actions-favorites').hide(); $('.actions-favorites-link').show(); if($('.actions-favorites-link small').length == 0) { $('.actions-favorites-link').append(' <span class="badge badge-important">' + $.cookie(cookie_favs).split(',').length + '</span>'); } } } $('.actions-favorites').click(function(e) { e.preventDefault(); if($.cookie(cookie_favs)==null || $.cookie(cookie_favs)=='') { $.cookie(cookie_favs, <?php the_ID(); ?> ,{ expires: 60, path: '<?php echo COOKIEPATH; ?> ' }); } else { var fav = $.cookie(cookie_favs); $.cookie(cookie_favs, fav + ',' + <?php the_ID(); ?> ,{ expires: 60, path: '<?php echo COOKIEPATH; ?> ' }); } $(this).fadeOut(75, function() { $('.actions-favorites-link').fadeIn(75); $('.actions-favorites-link').append(' <span class="badge badge-important">' + $.cookie(cookie_favs).split(',').length + '</span>'); }); }); }); </script><?php $output = ''; if (is_pagetemplate_active('page-tpl-favorites.php')) { // Save Button $output .= '<a href="' . $data['href'] . '" id="' . $data['id'] . '" class="' . $data['class'] . '" target="' . $data['target'] . '" ' . $data['atts'] . '>'; // check if icon is available if ($data['icon']) { $output .= '<i class="' . $data['icon'] . '"></i>'; } $output .= $labels['favorites_add']; $output .= '</a>'; // Favorites Button $output .= '<a href="' . get_pagetemplate_permalink('page-tpl-favorites.php') . '" class="' . apply_filters('wpsight_title_action_css', 'btn btn-mini actions-favorites-link action-link', 'favorites_see') . '" style="display:none">'; $output .= '<i class="icon-star"></i>' . $labels['favorites_see']; $output .= '</a>'; } // return output return $output; }