function widget($args, $instance) { if (is_single() && rolo_type_is('contact')) { // only display when viewing contact page extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Contact Details', 'rolopress') : $instance['title']); echo $before_widget; if ($title) { echo "\n\t\t\t" . $before_title . $title . $after_title; } if (rolo_type_is('contact')) { rolo_contact_details(get_the_ID()); } echo $after_widget; } }
/** * Add item image * * @credits http://johnathanandersendesign.com */ function rolo_admin_insert_image_column($column_name, $item_id) { if ($column_name == 'image') { if (!$item_id) { return false; } if (rolo_type_is('contact')) { $contact = get_post_meta($item_id, 'rolo_contact', true); echo get_avatar($contact['rolo_contact_email'], 48, ROLOPRESS_IMAGES . "/icons/rolo-contact.jpg"); } if (rolo_type_is('company')) { $company = get_post_meta($item_id, 'rolo_company', true); echo get_avatar($company['rolo_company_email'], 48, ROLOPRESS_IMAGES . "/icons/rolo-company.jpg"); } } }
/** * RoloPress master loop * * Currently handles most situations * * @since 1.2 */ function rolo_loop() { if (!is_single()) { // This class is not needed on single pages ?> <ul class="item-list"> <?php } if (have_posts()) { while (have_posts()) { the_post(); ?> <li id="entry-<?php the_ID(); ?> " class="<?php rolopress_entry_class(); ?> "> <?php rolopress_before_entry(); // Before entry hook ?> <div class="entry-main group"> <?php if (is_archive() || is_home()) { if (rolo_type_is('contact')) { rolo_contact_header(get_the_ID()); } if (rolo_type_is('company')) { rolo_company_header(get_the_ID()); } ?> <?php } elseif (is_single()) { if (rolo_type_is('contact')) { rolo_contact_header(get_the_ID()); the_content(); if (is_active_sidebar("contact-under-main")) { ?> <div class="widget-area contact-under-main"> <?php dynamic_sidebar("contact-under-main"); ?> </div> <?php } } if (rolo_type_is('company')) { rolo_company_header(get_the_ID()); the_content(); if (is_active_sidebar("company-under-main")) { ?> <div class="widget-area company-under-main"> <?php dynamic_sidebar("company-under-main"); ?> </div> <?php } } } elseif (is_search()) { ?> <?php if (rolo_type_is('contact')) { rolo_contact_header(get_the_ID()); } elseif (rolo_type_is('company')) { rolo_company_header(get_the_ID()); } else { ?> <li id="entry-<?php echo basename(get_permalink()); ?> " class="entry-header"> <?php echo '<img class="entry-icon" src=' . ROLOPRESS_IMAGES . '/icons/rolo-default.jpg />'; ?> <a class="entry-title" href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a> </li> <?php } } elseif (is_page()) { the_content(); // show the page content if (is_page_template('widgets.php') || is_page_template('widgets-no-sidebar.php')) { // is this a widget page if (is_active_sidebar("widget-page")) { // is the widget area active ?> <div class="widget-area"> <ul class="xoxo"> <?php dynamic_sidebar("widget-page"); ?> </ul> </div><!-- #widget-area --> <?php } else { rolo_add_some_widgets_message(); // if not, show a message } } } else { ?> <li id="entry-<?php echo basename(get_permalink()); ?> " class="entry-header"> <?php echo '<img class="entry-icon" src=' . ROLOPRESS_IMAGES . '/icons/rolo-default.jpg />'; ?> <a class="entry-title" href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a> </li> <?php } ?> </div><!-- .entry-main --> <?php rolo_entry_footer(); ?> <?php rolopress_after_entry(); // After entry hook ?> </li><!-- #entry-<?php the_ID(); ?> --> <?php } ?> <?php if (!is_single()) { // not needed on single pages ?> </ul><!-- item-list--> <?php } ?> <?php } else { // 404 or no search results ?> <li id="entry-0" class="<?php rolopress_entry_class(); ?> "> <?php rolopress_before_entry(); // Before entry hook ?> <div class="entry-main"> <?php // on inital setup if no contacts or companies are created then // the menu items produce a 404 // This will provide instructions on how to fix $referring_page = $_SERVER['REQUEST_URI']; if ($referring_page == "/type") { rolo_type_tax_message(); } else { rolo_404_message(); } ?> </div><!-- .entry-main --> <?php rolopress_after_entry(); // After entry hook ?> </li><!-- #entry-0 --> <?php } }
function widget($args, $instance) { if (is_single()) { // only display on single pages extract($args); if (rolo_type_is('contact')) { $account = urlencode(rolo_contact_tweet(get_the_ID())); } if (rolo_type_is('company')) { $account = urlencode(rolo_company_tweet(get_the_ID())); } if (empty($account)) { return; } $title = apply_filters('widget_title', $instance['title']); if (empty($title)) { $title = __('Twitter Updates'); } $show = absint($instance['show']); // # of Updates to show $hidereplies = $instance['hidereplies']; $before_timesince = esc_html($instance['beforetimesince']); if (empty($before_timesince)) { $before_timesince = ' '; } $before_tweet = esc_html($instance['beforetweet']); echo "{$before_widget}{$before_title}<a href='" . clean_url("http://twitter.com/{$account}") . "'>{$title}</a>{$after_title}"; if (!($tweets = wp_cache_get('widget-twitter-' . $this->number, 'widget'))) { $twitter_json_url = clean_url("http://twitter.com/statuses/user_timeline/{$account}.json", null, 'raw'); $response = wp_remote_get($twitter_json_url, array('User-Agent' => 'Wickett Twitter Widget')); $response_code = wp_remote_retrieve_response_code($response); if (200 == $response_code) { $tweets = wp_remote_retrieve_body($response); $tweets = json_decode($tweets); $expire = 900; if (!is_array($tweets) || isset($tweets['error'])) { $tweets = 'error'; $expire = 300; } } else { $tweets = 'error'; $expire = 300; wp_cache_add('widget-twitter-response-code-' . $this->number, $response_code, 'widget', $expire); } wp_cache_add('widget-twitter-' . $this->number, $tweets, 'widget', $expire); } if ('error' != $tweets) { echo "<ul class='tweets'>\n"; $tweets_out = 0; foreach ((array) $tweets as $tweet) { if ($tweets_out >= $show) { break; } if (empty($tweet->text) || $hidereplies && !empty($tweet->in_reply_to_user_id)) { continue; } $text = make_clickable(wp_specialchars($tweet->text)); $text = preg_replace_callback('/(^|\\s)@(\\w+)/', array($this, '_rolo_twitter_widget_username'), $text); $text = preg_replace_callback('/(^|\\s)#(\\w+)/', array($this, '_rolo_twitter_widget_hashtag'), $text); // Move the year for PHP4 compat $created_at = substr($tweet->created_at, 0, 10) . substr($tweet->created_at, 25, 5) . substr($tweet->created_at, 10, 15); echo "<li>{$before_tweet}{$text}{$before_timesince}<a href='" . clean_url("http://twitter.com/{$account}/statuses/" . urlencode($tweet->id)) . "' class='timesince'>" . str_replace(' ', ' ', wpcom_time_since(strtotime($created_at))) . " ago</a></li>\n"; $tweets_out++; } echo "</ul>\n"; } else { if (401 == wp_cache_get('widget-twitter-response-code-' . $this->number, 'widget')) { echo "<p>" . __("Error: Please make sure the Twitter account is <a href='http://help.twitter.com/forums/10711/entries/14016'>public</a>.") . "</p>"; } else { echo "<p>" . __("Error: Twitter did not respond. Please wait a few minutes and refresh this page.") . "</p>"; } } echo $after_widget; } }
the_ID(); ?> " class="<?php rolopress_entry_class(); ?> "> <?php rolopress_before_entry(); // Before entry hook ?> <div class="entry-main group"> <?php if (rolo_type_is('contact')) { rolo_contact_header(get_the_ID()); } ?> </div><!-- .entry-main --> <?php rolo_entry_footer(); ?> <?php rolopress_after_entry(); // After entry hook ?>
/** * RoloPress master loop * * Currently handles most situations * * @since 1.2 */ function rolo_loop() { if (!is_single()) { // This class is not needed on single pages ?> <!-- <ul class="item-list"> --> <?php } if (have_posts()) { while (have_posts()) { the_post(); ?> <?php $current_user_id = get_current_user_id(); global $post; $author_id = $post->post_author; $skype_status = ''; if ($current_user_id != $author_id) { continue; } $thumbid = get_post_thumbnail_id($post->ID); $frame_number = get_post_meta($post->ID, 'rolo_contact_framename', true); $thumb = wp_get_attachment_image_src($thumbid, $frame_number); // <------- NAO ESTA A FUNCIONAR $srcimage = $thumb[0]; if (isset($srcimage)) { $style = "background:url(" . $srcimage . ") no-repeat;"; } else { $style = "background: transparent no-repeat"; } $link = get_permalink(); global $_wp_additional_image_sizes; $w = $_wp_additional_image_sizes['frame' . $frame_number]['width']; $h = $_wp_additional_image_sizes['frame' . $frame_number]['height']; if (rolo_type_is('contact')) { $contact = get_post_meta($post->ID, 'rolo_contact', true); if (isset($contact['rolo_contact_phone'])) { $skype_name = $contact['rolo_contact_phone']; $link_skype = "skype:" . $skype_name . " ?call"; } $importance = get_post_meta($post->ID, 'rolo_contact_importance', true); } if (is_archive() || is_home()) { ?> <div id="contact-list"> <div class="photo" id="<?php echo $frame_number; ?> "> <a href="<?php echo $link; ?> "> <span class="<?php echo $frame_number; ?> " style="background: url('') no-repeat;"> <?php the_post_thumbnail($frame_number, array('alt' => $skype_name, 'title' => get_the_title())); // AQUI É ONDE É POSTA A FOTO ?> </span> </a> <img src="<?php echo get_bloginfo('template_url') . '/library/images/frames/' . $frame_number . '.png'; ?> " alt=""> <!-- <div id="title"> --> <?php //the_title(); ?> <!-- </div> --> </div> </div> <!-- close div contact --> <?php continue; } if (is_single()) { if (rolo_type_is('contact')) { if (!empty($skype_name)) { $skype_status = getSkypeStatus($skype_name); } ?> <h2 class="page-title"><?php the_title(); ?> </h2> <div id="contact-single" > <div class="left"> <div style="float:right;"> <div class="photo" id="<?php echo $frame_number; ?> "> <a href="<?php echo $link_skype; ?> "> <span class="<?php echo $frame_number . ' '; ?> " style="background: url('') no-repeat;"> <?php the_post_thumbnail($frame_number, array("alt" => $skype_name, 'title' => get_the_title())); // AQUI É ONDE É POSTA A FOTO ?> </span> </a> <img src="<?php echo get_bloginfo('template_url') . '/library/images/frames/' . $frame_number . '.png'; ?> " alt=""> </div> </div> </div> <?php if (isset($contact['rolo_contact_phone'])) { ?> <div class="right"> <div class="address"> <?php $contact = get_post_meta($post->ID, 'rolo_contact'); $contact = $contact[0]; $address = $contact['rolo_contact_address']; $city = rolo_get_term_list($contact_id, 'city'); $state = rolo_get_term_list($contact_id, 'state'); $zip = rolo_get_term_list($contact_id, 'zip'); $country = rolo_get_term_list($contact_id, 'country'); $city = $city == '' ? '' : $city; // $state = ($state == '') ? 'State' : $state; $zip = $zip == '' ? '' : $zip; $country = $country == '' ? '' : $country; if (isset($address) && ($address != '' || $zip . $city . $country != '')) { echo "Morada:<br/>"; echo $address . ' ' . $zip . ' ' . $city . ' ' . $country; } ?> </div> </div> <?php } the_content(); } rolo_entry_footer(); } elseif (is_search()) { ?> <div id="contact-list"> <div class="photo" id="<?php echo 'frame' . $frame_number; ?> "> <a href="<?php echo $link; ?> "> <span class="<?php echo $frame_number; ?> " style="background: url('') no-repeat;"> <?php the_post_thumbnail($frame_number); // AQUI É ONDE É POSTA A FOTO ?> </span> </a> <img src="<?php echo get_bloginfo('template_url') . '/library/images/frames/' . $frame_number . '.png'; ?> " alt=""> </div> </div> <!-- close div contact --> <?php } elseif (is_page()) { ?> <div id="contact"><?php the_content(); // show the page content if (is_page_template('widgets.php') || is_page_template('widgets-no-sidebar.php')) { // is this a widget page if (is_active_sidebar("widget-page")) { // is the widget area active ?> <div class="widget-area"> <ul class="xoxo"> <?php dynamic_sidebar("widget-page"); ?> </ul> </div><!-- #widget-area --> <?php } else { rolo_add_some_widgets_message(); // if not, show a message } } } else { ?> <div id="contact"> <li id="entry-<?php echo basename(get_permalink()); ?> " class="entry-header"> <?php echo '<img class="entry-icon" src=' . ROLOPRESS_IMAGES . '/icons/rolo-default.jpg />'; ?> <a class="entry-title" href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a> </li> <?php } ?> <!-- </div> --><!-- .entry-main --> <?php rolopress_after_entry(); // After entry hook ?> </div><!-- #entry-<?php the_ID(); ?> --> <?php } ?> <?php if (!is_single()) { // not needed on single pages ?> <!-- </ul> --><!-- item-list--> <?php } ?> <?php } else { // 404 or no search results ?> <li id="entry-0" class="<?php rolopress_entry_class(); ?> "> <?php rolopress_before_entry(); // Before entry hook ?> <div class="entry-main"> <?php // on inital setup if no contacts or companies are created then // the menu items produce a 404 // This will provide instructions on how to fix $referring_page = $_SERVER['REQUEST_URI']; if ($referring_page == "/type") { rolo_type_tax_message(); } else { //rolo_404_message(); } ?> </div><!-- .entry-main --> <?php rolopress_after_entry(); // After entry hook ?> </li><!-- #entry-0 --> <?php } }