Пример #1
0
            echo "</div></div></div></div></a>";
            $counter++;
        }
    }
}
?>
				</div>
			</div>
		</div>

		<div class="col-md-4 col-sm-12">
			<?php 
wp_reset_postdata();
$terms = get_posts('post_type=team&posts_per_page=-1&orderby=title&order=ASC&post_parent=' . $post->ID);
if ($terms) {
    $teamstr = '';
    foreach ((array) $terms as $taxonomy) {
        $themeid = $taxonomy->ID;
        $themeURL = $taxonomy->post_name;
        $teamstr .= "<li><a href='/team/" . $themeURL . "/'>" . govintranetpress_custom_title($taxonomy->post_title) . "</a></li>";
    }
    echo "<div class='widget-box'><h3 class='widget-title'>Sub-teams</h3><ul>" . $teamstr . "</ul></div>";
}
?>
		
		</div>
	</div>
</div>

<?php 
get_footer();
Пример #2
0
/**
 * Makes some changes to the <title> tag, by filtering the output of wp_title().
 *
 * If we have a site description and we're viewing the home page or a blog posts
 * page (when using a static front page), then we will add the site description.
 *
 * If we're viewing a search result, then we're going to recreate the title entirely.
 * We're going to add page numbers to all titles as well, to the middle of a search
 * result title and the end of all other titles.
 *
 * The site title also gets added to all titles.
 *
 * @since Twenty Ten 1.0
 *
 * @param string $title Title generated by wp_title()
 * @param string $separator The separator passed to wp_title(). Twenty Ten uses a
 * 	vertical bar, "|", as a separator in header.php.
 * @return string The new title, ready for the <title> tag.
 */
function twentyten_filter_wp_title($title, $separator)
{
    // Don't affect wp_title() calls in feeds.
    if (is_feed()) {
        return $title;
    }
    // The $paged global variable contains the page number of a listing of posts.
    // The $page global variable contains the page number of a single post that is paged.
    // We'll display whichever one applies, if we're not looking at the first page.
    global $paged, $page;
    if (is_search()) {
        // If we're a search, let's start over:
        $title = sprintf(__('Search results for %s', 'twentyten'), '"' . get_search_query() . '"');
        // Add a page number if we're on page 2 or more:
        if ($paged >= 2) {
            $title .= " {$separator} " . sprintf(__('Page %s', 'twentyten'), $paged);
        }
        // Add the site name to the end:
        //$title .= " $separator " . get_bloginfo( 'name', 'display' );
        // We're done. Let's send the new title back to wp_title():
        return $title;
    }
    // Otherwise, let's start by adding the site name to the end:
    if (is_front_page()) {
        $title .= get_bloginfo('name', 'display');
    }
    $slug = pods_url_variable(0);
    $slug2 = pods_url_variable(1);
    if ($slug == "task") {
        $taskpod = new Pod('task', pods_url_variable(1));
        $taskparent = $taskpod->get_field('parent_guide');
        $title_context = '';
        if ($taskparent) {
            $parent_guide_id = $taskparent[0]['ID'];
            $taskparent = get_post($parent_guide_id);
            $title_context = " (" . govintranetpress_custom_title($taskparent->post_title) . ")";
        }
        $title .= $title_context . " - tasks and guides";
    } else {
        if ($slug2 == "projects") {
            $title .= " - projects";
        } else {
            if ($slug2 == "vacancies") {
                $title .= " - job vacancies";
            } else {
                if ($slug == "staff") {
                    global $post;
                    $u = $post->post_title;
                    $title .= $u . " - staff profile";
                } else {
                    if ($slug == "events") {
                        $title .= " - events";
                    } else {
                        if ($slug == "glossary") {
                            $title .= " - jargon buster";
                        } else {
                            if ($slug == "atoz") {
                                $title .= " - A to Z";
                            } else {
                                if ($slug == "forums") {
                                    $title .= " - forums";
                                } else {
                                    if ($slug == "topics") {
                                        $title .= " - forum topics";
                                    } else {
                                        if ($slug == "replies") {
                                            $title .= " - forum replies";
                                        } else {
                                            if ($slug == "news") {
                                                $title .= " - news";
                                            } else {
                                                if ($slug == "blog") {
                                                    $title .= " - blog";
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // If we have a site description and we're on the home/front page, add the description:
    $site_description = get_bloginfo('description', 'display');
    if ($site_description && (is_home() || is_front_page())) {
        $title .= " {$separator} " . $site_description;
    }
    // Add a page number if necessary:
    if ($paged >= 2 || $page >= 2) {
        $title .= " {$separator} " . sprintf(__('Page %s', 'twentyten'), max($paged, $page));
    }
    // Return the new title to wp_title():
    return trim(preg_replace('/\\[.*\\]/i', '', $title));
}
 unset($poduser);
 foreach ($terms as $taxonomy) {
     //print_r($taxonomy);
     //echo $taxonomy['name'];
     $themeid = $taxonomy['term_id'];
     $themeparent = $taxonomy['parent'];
     if ($themeparent == 0) {
         $teamlist = govintranetpress_custom_title($taxonomy['name']);
         $html .= "" . $teamlist . "<br>";
         //echo $teamlist;
     } else {
         while ($themeparent != 0) {
             $newteam = get_term_by('id', $themeparent, 'team');
             $themeparent = $newteam->parent;
         }
         $teamlist = govintranetpress_custom_title($newteam->name);
         $html .= "" . $teamlist . "<br>";
     }
 }
 if (get_user_meta($userid, 'user_job_title', true)) {
     $meta = get_user_meta($userid, 'user_job_title', true);
     $meta = str_replace(" ", "&nbsp;", $meta);
     $html .= '<span class="small">' . $meta . "</span><br>";
 }
 if (get_user_meta($userid, 'user_telephone', true)) {
     $html .= '<span class="small"><i class="glyphicon glyphicon-earphone"></i> ' . get_user_meta($userid, 'user_telephone', true) . "</span><br>";
 }
 if (get_user_meta($userid, 'user_mobile', true) && $showmobile) {
     $html .= '<span class="small"><i class="glyphicon glyphicon-phone"></i> ' . get_user_meta($userid, 'user_mobile', true) . "</span>";
 }
 $html .= "</div></div></a></div></div>";
Пример #4
0
     echo '<h3 class="contacthead">' . __('Team', 'govintranet') . '</h3>';
     $teamlist = array();
     //build array of hierarchical teams
     foreach ((array) $teams as $t) {
         $team = get_post($t);
         $teamid = $team->ID;
         $teamurl = $team->post_name;
         $teamparent = $team->post_parent;
         while ($teamparent != 0) {
             $parentteam = get_post($teamparent);
             $parentURL = $parentteam->post_name;
             $parentname = govintranetpress_custom_title($parentteam->post_title);
             $teamlist[] = " <a href='" . get_permalink($teamparent) . "'>" . $parentname . "</a>";
             $teamparent = $parentteam->post_parent;
         }
         $teamlist[] = " <a href='" . get_permalink($team->ID) . "'>" . govintranetpress_custom_title($team->post_title) . "</a>";
         echo "<p><strong>" . __('Team', 'govintranet') . ":</strong> " . implode(" &raquo; ", $teamlist) . "</p>";
         $teamlist = array();
     }
 }
 $jt = get_user_meta($user_id, 'user_job_title', true);
 $ug = get_user_meta($user_id, 'user_grade', true);
 if (!$teams && ($jt || $ug)) {
     echo '<h3 class="contacthead">' . __("Role", "govintranet") . '</h3>';
 }
 if ($jt) {
     echo "<p><strong>" . __('Job title', 'govintranet') . ": </strong>" . $jt . "</p>";
 }
 if ($ug) {
     $ug = get_term($ug, 'grade', ARRAY_A);
     if ($ug['name']) {
Пример #5
0
/**
 * Makes some changes to the <title> tag, by filtering the output of wp_title().
 *
 * If we have a site description and we're viewing the home page or a blog posts
 * page (when using a static front page), then we will add the site description.
 *
 * If we're viewing a search result, then we're going to recreate the title entirely.
 * We're going to add page numbers to all titles as well, to the middle of a search
 * result title and the end of all other titles.
 *
 * The site title also gets added to all titles.
 *
 * @since Twenty Ten 1.0
 *
 * @param string $title Title generated by wp_title()
 * @param string $separator The separator passed to wp_title(). Twenty Ten uses a
 * 	vertical bar, "|", as a separator in header.php.
 * @return string The new title, ready for the <title> tag.
 */
function govintranet_filter_wp_title($title, $separator)
{
    // Don't affect wp_title() calls in feeds.
    if (is_feed()) {
        return $title;
    }
    // The $paged global variable contains the page number of a listing of posts.
    // The $page global variable contains the page number of a single post that is paged.
    // We'll display whichever one applies, if we're not looking at the first page.
    global $paged, $page, $post;
    if (is_search()) {
        // If we're a search, let's start over:
        $title = sprintf(__('Search results for %s', 'govintranet'), '"' . get_search_query() . '"');
        // Add a page number if we're on page 2 or more:
        if ($paged >= 2) {
            $title .= " {$separator} " . sprintf(__('Page %s', 'govintranet'), $paged);
        }
        // Add the site name to the end:
        //$title .= " $separator " . get_bloginfo( 'name', 'display' );
        // We're done. Let's send the new title back to wp_title():
        return $title;
    }
    // Otherwise, let's start by adding the site name to the end:
    if (is_front_page()) {
        $title .= get_bloginfo('name', 'display');
    }
    global $wp_query;
    $view = $wp_query->get_queried_object();
    if (isset($view) && isset($view->taxonomy)) {
        if ($view->taxonomy == "a-to-z") {
            $title = _x("Letter", "alphabet", "govintranet") . " " . $title;
        } else {
            if (isset($view) && $view->taxonomy == "category") {
                $title .= " " . __("tasks and guides category", "govintranet");
            } else {
                if (isset($view) && $view->taxonomy) {
                    return $title;
                } else {
                    if ($post->post_type == "task") {
                        $taskparent = $post->post_parent;
                        $title_context = '';
                        if ($taskparent) {
                            $parent_guide_id = $taskparent;
                            $taskparent = get_post($parent_guide_id);
                            $title_context = " (" . govintranetpress_custom_title($taskparent->post_title) . ")";
                        }
                        $title .= $title_context . " - " . __('tasks and guides', 'govintranet');
                    } else {
                        if ($post->post_type == "project") {
                            $title .= " - " . __('project', 'govintranet');
                        } else {
                            if ($post->post_type == "vacancy") {
                                $title .= " - " . __('job vacancies', 'govintranet');
                            } else {
                                if ($post->post_type == "event") {
                                    $title .= " - " . __('events', 'govintranet');
                                } else {
                                    if ($post->post_type == "jargon-buster") {
                                        $title .= " - " . __('jargon buster', 'govintranet');
                                    } else {
                                        if ($post->post_type == "forums") {
                                            $title .= " - " . __('forums', 'govintranet');
                                        } else {
                                            if ($post->post_type == "topics") {
                                                $title .= " - " . __('forum topics', 'govintranet');
                                            } else {
                                                if ($post->post_type == "replies") {
                                                    $title .= " - " . __('forum replies', 'govintranet');
                                                } else {
                                                    if ($post->post_type == "news") {
                                                        $title .= " - " . __('news', 'govintranet');
                                                    } else {
                                                        if ($post->post_type == "news-update") {
                                                            $title .= " - " . __('news update', 'govintranet');
                                                        } else {
                                                            if ($post->post_type == "blog") {
                                                                $title .= " - " . __('blog', 'govintranet');
                                                            } else {
                                                                if (!$post->post_type) {
                                                                    global $post;
                                                                    $u = $post->post_title;
                                                                    $title .= $u . " - " . __('staff profile', 'govintranet');
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // If we have a site description and we're on the home/front page, add the description:
    $site_description = get_bloginfo('description', 'display');
    if ($site_description && (is_home() || is_front_page())) {
        $title .= " {$separator} " . $site_description;
    }
    // Add a page number if necessary:
    if ($paged >= 2 || $page >= 2) {
        $title .= " {$separator} " . sprintf(__('Page %s', 'govintranet'), max($paged, $page));
    }
    // Return the new title to wp_title():
    return trim(preg_replace('/\\[.*\\]/i', '', $title));
}
Пример #6
0
            if ($chapter_header) {
                // if on chapter 1
                echo '<div class="col-lg-12 chapterr"><a href="' . get_permalink($carray[2]["id"]) . '" title="' . __("Navigate to next part", "govintranet") . '">' . $carray[2]["name"] . '&nbsp;<span class="dashicons dashicons-arrow-right-alt2"></span></a></div>';
            } elseif ($current_chapter == 2) {
                // if on chapter 2
                echo '<div class="col-lg-6 col-md-6 chapterl"><a href="' . get_permalink($parent_guide_id) . '" title="' . __("Navigate to previous part", "govintranet") . '"><span class="dashicons dashicons-arrow-left-alt2"></span>&nbsp;' . __("Overview", "govintranet") . '</a></div>';
                if ($carray[3]['slug']) {
                    echo '<div class="col-lg-6 col-md-6 chapterr"><a href="' . get_permalink($carray[3]["id"]) . '" title="' . __("Navigate to next part", "govintranet") . '">' . $carray[3]["name"] . '&nbsp;<span class="dashicons dashicons-arrow-right-alt2"></span></a></div>';
                }
            } else {
                // we're deep in the middle somewhere
                $previous_chapter = $current_chapter - 1;
                $next_chapter = $current_chapter + 1;
                echo '<div class="col-lg-6 col-md-6 chapterl"><a href="' . get_permalink($carray[$previous_chapter]["id"]) . '" title="' . __("Navigate to previous part", "govintranet") . '"><span class="dashicons dashicons-arrow-left-alt2"></span>&nbsp;' . govintranetpress_custom_title($carray[$previous_chapter]["name"]) . '</a></div>';
                if ($carray[$next_chapter]['slug']) {
                    echo '<div class="col-lg-6 col-md-6 chapterr"><a href="' . get_permalink($carray[$next_chapter]["id"]) . '" title="' . __("Navigate to next part", "govintranet") . '">' . govintranetpress_custom_title($carray[$next_chapter]["name"]) . '&nbsp;<span class="dashicons dashicons-arrow-right-alt2"></span></a></div>';
                }
            }
            echo "</div>";
            echo "</div>";
        } else {
            ?>
			<h1><?php 
            echo $guidetitle;
            ?>
 <small><span class="dashicons dashicons-<?php 
            echo $icon;
            ?>
"></span> <?php 
            echo _x('Project', 'noun', 'govintranet');
            ?>
Пример #7
0
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $items = intval($instance['items']);
     $pages = $instance['pages'];
     $tasks = $instance['tasks'];
     $projects = $instance['projects'];
     $vacancies = $instance['vacancies'];
     $news = $instance['news'];
     $blog = $instance['blog'];
     $events = $instance['event'];
     $lastupdated = $instance['lastupdated'];
     $acf_key = "widget_" . $this->id_base . "-" . $this->number . "_exclude_posts";
     $excludeposts = get_option($acf_key);
     $exclude = array();
     if ($excludeposts) {
         foreach ($excludeposts as $sp) {
             $exclude[] = $sp;
         }
     }
     $donefilter = false;
     $filter = '';
     if ($projects == 'on') {
         $filter .= "post_type = 'project'";
         $donefilter = true;
     }
     if ($pages == 'on') {
         if ($donefilter) {
             $filter .= " or ";
         }
         $filter .= "post_type = 'page'";
         $donefilter = true;
     }
     if ($tasks == 'on') {
         if ($donefilter) {
             $filter .= " or ";
         }
         $filter .= "post_type = 'task'";
         $donefilter = true;
     }
     if ($vacancies == 'on') {
         if ($donefilter) {
             $filter .= " or ";
         }
         $filter .= "post_type = 'vacancy'";
         $donefilter = true;
     }
     if ($news == 'on') {
         if ($donefilter) {
             $filter .= " or ";
         }
         $filter .= "post_type = 'news'";
         $donefilter = true;
     }
     if ($blog == 'on') {
         if ($donefilter) {
             $filter .= " or ";
         }
         $filter .= "post_type = 'blog'";
         $donefilter = true;
     }
     if ($events == 'on') {
         if ($donefilter) {
             $filter .= " or ";
         }
         $filter .= "post_type = 'event'";
         $donefilter = true;
     }
     if ($lastupdated == 'on') {
         $checkdate = 'post_modified';
     } else {
         $checkdate = 'post_date';
     }
     $stoppages = array('how-do-i', 'task-by-category', 'news-by-category', 'newspage', 'tagged', 'atoz', 'about', 'home', 'blogs', 'events', 'category', 'news-type');
     foreach ($stoppages as $sp) {
         $stop = get_page_by_path($sp, ARRAY_A, 'page');
         if ($stop) {
             $exclude[] = $stop['ID'];
         }
     }
     $getitems = $items + count($exclude);
     global $wpdb;
     $q = "\n\t\tselect ID, post_parent, post_type, post_title, post_name, post_date, post_modified, post_status  \n\t\tfrom {$wpdb->posts} \n\t\twhere (" . $filter . ") and post_status = 'publish'";
     if ($exclude) {
         $q .= " and ID NOT IN ('" . implode('\',\' ', $exclude) . "') ";
     }
     $q .= "\n\t\torder by " . $checkdate . " desc\n\t\tlimit " . $getitems . ";\n\t\t";
     $rpublished = $wpdb->get_results($q);
     $k = 0;
     $alreadydone = array();
     if ($rpublished) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo "<ul>";
         foreach ($rpublished as $r) {
             if (in_array($r->ID, $alreadydone)) {
                 continue;
             }
             $alert = '';
             if ($lastupdated == 'on' && $r->post_date == $r->post_modified) {
                 $alert = " <span class='badge'>" . __('NEW', 'govintranet') . "</span>";
             }
             if ($r->post_type == 'page') {
                 $k++;
                 echo "<li><a href='" . get_permalink($r->ID) . "'>" . govintranetpress_custom_title(get_the_title($r->ID)) . "</a>" . $alert . "</li>";
                 $alreadydone[] = $r->ID;
             } elseif ($r->post_type == 'task') {
                 $title_context = '';
                 if ($r->post_parent) {
                     // child chapter
                     $icon = "book";
                     $taskparent = get_post($r->post_parent);
                     $title_context = '';
                     if ($taskparent) {
                         $parent_guide_id = $taskparent->ID;
                         $title_context = " <small>(" . govintranetpress_custom_title($taskparent->post_title) . ")</small>";
                     }
                 } elseif (get_posts("post_type=task&posts_per_page=-1&post_status=publish&post_parent=" . $r->ID . "&orderby=menu_order&order=ASC")) {
                     $icon = "book";
                 } else {
                     $icon = "question-sign";
                 }
                 $k++;
                 echo "<li><a href='" . get_permalink($r->ID) . "'>" . govintranetpress_custom_title($r->post_title) . "</a>" . $title_context . $alert . "</li>";
                 $alreadydone[] = $r->ID;
             } elseif ($r->post_type == 'project') {
                 if (!$r->post_parent) {
                     $k++;
                     echo "<li><a href='" . get_permalink($r->ID) . "'>" . govintranetpress_custom_title($r->post_title) . "</a>" . $alert . "</li>";
                     $alreadydone[] = $r->ID;
                 }
             } else {
                 $k++;
                 echo "<li><a href='" . get_permalink($r->ID) . "'>" . govintranetpress_custom_title($r->post_title) . "</a>" . $alert . "</li>";
                 $alreadydone[] = $r->ID;
             }
             if ($k == $items) {
                 break;
             }
         }
         echo "</ul>";
         wp_reset_query();
         echo $after_widget;
     }
 }
$sortedlist = array();
if (!$postslist->have_posts()) {
    echo "<h1>";
    _e('Not found', 'govintranet');
    echo "</h1>";
    echo "<p>";
    _e('There\'s nothing to show', 'govintranet');
    echo ".</p>";
    get_search_form();
}
while ($postslist->have_posts()) {
    $postslist->the_post();
    //highlight words that begin with this letter in the standard post title
    $foundkey = false;
    //set a flag to see if we get a match
    $oldtitle = govintranetpress_custom_title($post->post_title);
    if (strpos($oldtitle, " ")) {
        $otwords = explode(" ", $oldtitle);
    } else {
        $otwords = array($oldtitle);
    }
    $newwords = array();
    $newtitle = '';
    $tempot = '';
    foreach ($otwords as $ot) {
        $orig_ot = $ot;
        $ot = preg_replace('/[^a-z\\d]+/i', '', $ot);
        $ot = str_replace(',', '', $ot);
        if (strtolower(substr($ot, 0, 1)) == strtolower($slug) && (strlen($ot) > 2 || in_array(strtolower($ot), $gowords)) && !in_array(strtolower($ot), $stopwords)) {
            $newwords[] = "<strong>" . $orig_ot . "</strong>";
            $foundkey = true;
Пример #9
0
                 $taskparent = $taskpod->get_field('parent_guide');
                 $title_context = "";
                 if ($taskparent) {
                     $tparent_guide_id = $taskparent[0]['ID'];
                     $taskparent = get_post($tparent_guide_id);
                     $title_context = " (" . govintranetpress_custom_title($taskparent->post_title) . ")";
                 }
                 $html .= "<li><a href='" . site_url() . "/task/" . $rlink['post_name'] . "'>" . govintranetpress_custom_title($rlink['post_title']) . $title_context . "</a></li>";
             }
         }
     }
     if ($related_pages) {
         foreach ($related_pages as $rlink) {
             if ($rlink['post_status'] == 'publish' && $rlink['ID'] != $id) {
                 $taskpod = new Pod('page', $rlink['ID']);
                 $html .= "<li><a href='" . $rlink['guid'] . "'>" . govintranetpress_custom_title($rlink['post_title']) . $title_context . "</a></li>";
             }
         }
     }
     if ($relatedteams) {
         foreach ($relatedteams as $r) {
             $html .= "<li><a href='" . site_url() . "/team/" . $r->slug . "'>" . $r->name . "</a>&nbsp;<span class='glyphicon glyphicon-list-alt'></span></li>";
         }
     }
     echo "<div class='widget-box list'>";
     echo "<h3 class='widget-title'>Related</h3>";
     echo "<ul>";
     echo $html;
     echo "</ul></div>";
 }
 $post_categories = wp_get_post_categories($post->ID);
Пример #10
0
echo "<div class='widget-box'>";
if ($title) {
    echo "<h3>" . esc_attr($title) . "</h3>";
}
add_filter('pre_get_posts', 'filter_tasks');
$listquery = new wp_query($query);
if ($listquery->have_posts()) {
    while ($listquery->have_posts()) {
        $listquery->the_post();
        if (!$compact) {
            $excerpt = get_the_excerpt();
            $taskparent = get_post($post->post_parent);
            $title_context = '';
            if ($taskparent) {
                $parent_guide_id = $taskparent->ID;
                $title_context = govintranetpress_custom_title($taskparent->post_title);
            }
            echo "<h3 class='postlist'><a href='" . get_permalink($post->ID) . "' title='" . get_the_title($post->ID) . $title_context;
            echo "' rel='bookmark'>" . get_the_title($post->ID) . "</a></h3>";
            echo wpautop($excerpt);
        } else {
            $larray[] = "<li><a href='" . get_permalink($post->ID) . "'>" . get_the_title($post->ID) . "</a> <span class='small'>" . $title_context . "</span></li>";
        }
    }
}
if ($compact) {
    echo "<ul>" . implode('', $larray) . "</ul>";
}
echo "</div>";
remove_filter('pre_get_posts', 'filter_tasks');
wp_reset_postdata();
Пример #11
0
            echo '<span class="small"><i class="glyphicon glyphicon-phone"></i> ' . get_user_meta($userid, 'user_mobile', true) . "</span>";
        }
        echo "</div></div></div></div></a>";
        $counter++;
    }
}
foreach ((array) $searchmasterteam as $post) {
    ?>
		<div>
			<div class="col-lg-12"><br>
				<h3 class='postlist'>				
				<a href="<?php 
    echo get_permalink($post['ID']);
    ?>
" rel="bookmark"><?php 
    echo govintranetpress_custom_title($post['post_title']);
    ?>
 (<?php 
    _e('Team', 'govintranet');
    ?>
)</a></h3>
				<div class='media'>
					<div class='media-body'>
					<?php 
    echo $post['post_content'];
    ?>
					</div>
				</div>
			</div>
		</div>
		<br class="clearfix">
Пример #12
0
        $children = get_pages("child_of=" . $id . "&parent=" . $id . "&hierarchical=0&posts_per_page=-1&post_type=page&sort_column=menu_order&sort_order=ASC");
        echo "<div class='row white'>";
        foreach ((array) $children as $c) {
            if ($c->post_excerpt) {
                $excerpt = $c->post_excerpt;
            } else {
                if (strlen($c->post_content) > 128) {
                    $excerpt = substr(strip_tags($c->post_content), 0, 128) . "&hellip;";
                } elseif (!$c->post_content) {
                    $excerpt = "";
                } else {
                    $excerpt = strip_tags($c->post_content);
                }
            }
            $excerpt = str_replace('[bbp-forum-index]', '', $excerpt);
            if (get_post_meta($id, 'ht_about_restrict', true)) {
                echo "<div class='col-lg-4 col-md-6 col-sm-6 white'>";
            } else {
                echo "<div class='col-lg-3 col-md-6 col-sm-6 white'>";
            }
            echo "\n\t\t\t\t<div class='category-block'>\n\t\t\t\t\t<h2><a href='" . get_permalink($c->ID) . "'>" . govintranetpress_custom_title($c->post_title) . "</a></h2>\n\t\t\t\t\t<p>" . $excerpt . "</p>\n\t\t\t\t</div>\n\t\t\t</div>";
        }
        echo '</div>';
        ?>

	</div>

<?php 
    }
}
get_footer();
Пример #13
0
$term_query = get_terms('team', array('hide_empty' => false, 'parent' => $termid));
$iteams = array();
$iteams[] = $termid;
$multipleteams = false;
foreach ($term_query as $tq) {
    $iteams[] = $tq->term_id;
    $multipleteams = true;
}
//custom sql query returns users in the current team sorted by grade
$chevron = 0;
foreach ($iteams as $tq) {
    $gradehead = '';
    $newteam = get_term_by('id', $tq, 'team');
    //print_r($newteam);
    if ($chevron != 0) {
        echo "<div class='col-lg-12 col-md-12 col-sm-12  home page'><div class='category-block'><h3>" . govintranetpress_custom_title($newteam->name);
        echo " <a href='#teamtop'><span class='glyphicon glyphicon-chevron-up'></span></a>";
        echo "<a id='{$newteam->slug}' name='{$newteam->slug}'>&nbsp;</a></h3></div></div>";
    }
    $chevron = 1;
    $q = "select user_id from wp_usermeta join wp_terms on wp_terms.term_id = wp_usermeta.meta_value where user_id in (select user_id from wp_usermeta as a where a.meta_key = 'user_team' and a.meta_value = " . $tq . " ) and meta_key = 'user_grade' ;\n ";
    $user_query = $wpdb->get_results($q);
    $counter = 0;
    $tcounter = 0;
    $uid = array();
    $ugrade = array();
    $uorder = array();
    $ulastname = array();
    foreach ($user_query as $u) {
        //print_r($u);
        $uid[] = $u->user_id;
Пример #14
0
    //build array of hierarchical teams
    foreach ($terms as $taxonomy) {
        $themeid = $taxonomy['term_id'];
        $themeURL = $taxonomy['slug'];
        $themeparent = $taxonomy['parent'];
        if ($themeURL == 'uncategorized') {
            continue;
        }
        while ($themeparent != 0) {
            $parentteam = get_term_by('id', $themeparent, 'team');
            $parentURL = $parentteam->slug;
            $parentname = govintranetpress_custom_title($parentteam->name);
            $teamlist[] = " <a href='" . site_url() . "/team/{$parentURL}'>" . $parentname . "</a>";
            $themeparent = $parentname['parent'];
        }
        $teamlist[] = " <a href='" . site_url() . "/team/{$themeURL}'>" . govintranetpress_custom_title($taxonomy['name']) . "</a>";
        echo "<strong>Team:</strong> " . implode(" &raquo; ", $teamlist) . "<br>";
        $teamlist = array();
    }
}
$jt = get_user_meta($user_id, 'user_job_title', true);
if ($jt) {
    echo "<strong>Job title: </strong>" . $jt . "<br>";
}
$jt = get_user_meta($user_id, 'user_grade');
//print_r($jt);
if ($jt[0]['name']) {
    echo "<strong>Grade: </strong>" . $jt[0]['name'] . "";
}
?>
		<h3 class="contacthead" >Contact</h3>
Пример #15
0
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $largeitems = intval($instance['largeitems']);
     $mediumitems = intval($instance['mediumitems']);
     $thumbnailitems = intval($instance['thumbnailitems']);
     $listitems = intval($instance['listitems']);
     $showexcerpt = $instance['showexcerpt'];
     $acf_key = "widget_" . $this->id_base . "-" . $this->number . "_pin_stories";
     $top_slot = get_option($acf_key);
     $acf_key = "widget_" . $this->id_base . "-" . $this->number . "_exclude_stories";
     $exclude = get_option($acf_key);
     global $post;
     $removenews = get_transient('cached_removenews');
     if (!$removenews || !is_array($removenews)) {
         //process expired news
         $tzone = get_option('timezone_string');
         date_default_timezone_set($tzone);
         $tdate = date('Ymd');
         $oldnews = query_posts(array('post_type' => 'news', 'meta_query' => array(array('key' => 'news_expiry_date', 'value' => $tdate, 'compare' => '<='))));
         if (count($oldnews) > 0) {
             foreach ($oldnews as $old) {
                 if ($tdate == date('Ymd', strtotime(get_post_meta($old->ID, 'news_expiry_date', true)))) {
                     // if expiry today, check the time
                     if (date('H:i:s', strtotime(get_post_meta($old->ID, 'news_expiry_time', true))) > date('H:i:s')) {
                         continue;
                     }
                 }
                 $expiryaction = get_post_meta($old->ID, 'news_expiry_action', true);
                 if ($expiryaction == 'Revert to draft status') {
                     $my_post = array();
                     $my_post['ID'] = $old->ID;
                     $my_post['post_status'] = 'draft';
                     wp_update_post($my_post);
                     delete_post_meta($old->ID, 'news_expiry_date');
                     delete_post_meta($old->ID, 'news_expiry_time');
                     delete_post_meta($old->ID, 'news_expiry_action');
                     delete_post_meta($old->ID, 'news_auto_expiry');
                     if (function_exists('wp_cache_post_change')) {
                         wp_cache_post_change($old->ID);
                     }
                     if (function_exists('wp_cache_post_change')) {
                         wp_cache_post_change($my_post);
                     }
                 }
                 if ($expiryaction == 'Change to regular news') {
                     set_post_format($old->ID, '');
                     delete_post_meta($old->ID, 'news_expiry_date');
                     delete_post_meta($old->ID, 'news_expiry_time');
                     delete_post_meta($old->ID, 'news_expiry_action');
                     delete_post_meta($old->ID, 'news_auto_expiry');
                     if (function_exists('wp_cache_post_change')) {
                         wp_cache_post_change($old->ID);
                     }
                 }
                 if ($expiryaction == 'Move to trash') {
                     $my_post = array();
                     $my_post['ID'] = $old->ID;
                     $my_post['post_status'] = 'trash';
                     delete_post_meta($old->ID, 'news_expiry_date');
                     delete_post_meta($old->ID, 'news_expiry_time');
                     delete_post_meta($old->ID, 'news_expiry_action');
                     delete_post_meta($old->ID, 'news_auto_expiry');
                     wp_update_post($my_post);
                     if (function_exists('wp_cache_post_change')) {
                         wp_cache_post_change($old->ID);
                     }
                     if (function_exists('wp_cache_post_change')) {
                         wp_cache_post_change($my_post);
                     }
                 }
             }
         }
         wp_reset_query();
     }
     echo $before_widget;
     if ($title) {
         echo $before_title;
         echo $title;
         echo $after_title;
     }
     echo '<div id="ht-feature-news">';
     //load manual sticky news stories
     //	$home = get_page_by_path('/home/',OBJECT,'page');
     //$top_slot =  get_post_meta($home->ID,'top_news_stories');
     //forumalate grid of news stories and formats
     $totalstories = $largeitems + $mediumitems + $thumbnailitems + $listitems;
     $newsgrid = array();
     for ($i = 1; $i <= $totalstories; $i++) {
         if ($i <= $largeitems) {
             $newsgrid[] = "L";
         } elseif ($i <= $largeitems + $mediumitems) {
             $newsgrid[] = "M";
         } elseif ($i <= $largeitems + $mediumitems + $thumbnailitems) {
             $newsgrid[] = "T";
         } elseif ($i <= $largeitems + $mediumitems + $thumbnailitems + $listitems) {
             $newsgrid[] = "Li";
         }
     }
     $siteurl = site_url();
     //manual override news stories
     //display sticky top news stories
     $num_top_slots = count($top_slot);
     $to_fill = $totalstories - $num_top_slots;
     $k = -1;
     $alreadydone = array();
     if ($num_top_slots > 0) {
         foreach ((array) $top_slot as $thisslot) {
             if (!$thisslot) {
                 continue;
             }
             $slot = get_post($thisslot);
             if ($slot->post_status != 'publish') {
                 continue;
             }
             $k++;
             $alreadydone[] = $slot->ID;
             if (function_exists('get_video_thumbnail')) {
                 $videostill = get_video_thumbnail($slot->ID);
             }
             $thistitle = $slot->post_title;
             $thisURL = get_permalink($slot->ID);
             $video = 0;
             if (has_post_format('video', $slot->ID)) {
                 $video = apply_filters('the_content', get_post_meta($slot->ID, 'news_video_url', true));
             }
             if ($newsgrid[$k] == "L") {
                 $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($slot->ID), 'newshead');
                 if ($video) {
                     echo $video;
                 } elseif ($image_uri != "") {
                     echo "<a href='{$thisURL}'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot->post_title) . "' /></a>";
                 }
             }
             if ($newsgrid[$k] == "M") {
                 $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($slot->ID), 'newsmedium');
                 if ($image_uri != "") {
                     echo "<a href='{$thisURL}'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot->post_title) . "' /></a>";
                 }
             }
             if ($newsgrid[$k] == "T") {
                 $image_uri = "<a class='pull-right' href='" . $thisURL . "'>" . get_the_post_thumbnail($slot->ID, 'thumbnail', array('class' => 'media-object hidden-xs')) . "</a>";
                 if ($image_uri != "") {
                     $image_url = $image_uri;
                 }
             }
             $thisdate = $slot->post_date;
             $post = get_post($slot->ID);
             setup_postdata($post);
             $thisexcerpt = get_the_excerpt();
             $thisdate = date("j M Y", strtotime($thisdate));
             $ext_icon = '';
             if (get_post_format($slot->ID) == 'link') {
                 $ext_icon = "<span class='dashicons dashicons-migrate'></span> ";
             }
             if ($newsgrid[$k] == "T") {
                 echo "<div class='media'>" . $image_url;
             }
             echo "<div class='media-body'>";
             echo "<h3 class='noborder'>" . $ext_icon . "<a href='" . $thisURL . "'>" . $thistitle . "</a>" . $ext_icon . "</h3>";
             if ($newsgrid[$k] == "Li") {
                 echo "<p>";
                 echo '<span class="listglyph">' . get_the_date("j M Y");
                 comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
                 echo '</span> ';
                 echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Full story <span class='dashicons dashicons-arrow-right-alt2'></span></a></span></p>";
             } else {
                 if ($showexcerpt == 'on') {
                     echo "<p>";
                     echo '<span class="listglyph">' . get_the_date("j M Y");
                     comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
                     echo '</span> ';
                     echo "</p>";
                     echo $thisexcerpt;
                     echo "<p class='news_date'><a class='more' href='{$thisURL}' title='{$thistitle}'>Full story <span class='dashicons dashicons-arrow-right-alt2'></span></a></p>";
                 } else {
                     echo "<p>";
                     echo '<span class="listglyph">' . get_the_date("j M Y");
                     comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
                     echo '</span> ';
                     echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Full story <span class='dashicons dashicons-arrow-right-alt2'></span></a></span></p>";
                 }
             }
             echo "</div>";
             if ($newsgrid[$k] == "T") {
                 echo "</div>";
             }
             echo "<hr class='light' />\n";
         }
     }
     //end of stickies
     //display remaining stories
     $cquery = array('post_type' => 'news', 'posts_per_page' => $totalstories, 'post__not_in' => $exclude, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-status'), "operator" => "NOT IN")));
     $news = new WP_Query($cquery);
     if ($news->post_count == 0) {
         echo "Nothing to show.";
     }
     global $post;
     while ($news->have_posts()) {
         $news->the_post();
         $theid = get_the_id();
         if (in_array($theid, $alreadydone)) {
             //don't show if already in stickies
             continue;
         }
         $k++;
         if ($k >= $totalstories) {
             break;
         }
         $thistitle = get_the_title($theid);
         $thisURL = get_permalink($theid);
         $video = 0;
         if (has_post_format('video', $theid)) {
             $video = apply_filters('the_content', get_post_meta($theid, 'news_video_url', true));
         }
         if ($newsgrid[$k] == "L") {
             $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($theid), 'newshead');
             if ($video) {
                 echo $video;
             } elseif ($image_uri != "") {
                 echo "<a href='{$thisURL}'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($post->post_title) . "' /></a>";
             }
         }
         if ($newsgrid[$k] == "M") {
             $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($theid), 'newsmedium');
             if ($image_uri != "") {
                 echo "<a href='{$thisURL}'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($post->post_title) . "' /></a>";
             }
         }
         if ($newsgrid[$k] == "T") {
             $image_uri = "<a class='pull-right' href='{$thisURL}'>" . get_the_post_thumbnail($theid, 'thumbnail', array('class' => 'media-object hidden-xs')) . "</a>";
             if ($image_uri != "") {
                 $image_url = $image_uri;
             }
         }
         $thisdate = get_the_date("j M Y");
         $thisexcerpt = get_the_excerpt();
         $ext_icon = '';
         if ($newsgrid[$k] == "T") {
             echo "<div class='media'>" . $image_url;
         }
         echo "<div class='media-body feature-news-" . strtolower($newsgrid[$k]) . "'>";
         if (get_post_format($theid) == 'link') {
             $ext_icon = "<i class='dashicons dashicons-migrate'></i> ";
         }
         echo "<h3 class='noborder'><a href='" . $thisURL . "'>" . $thistitle . "</a> " . $ext_icon . "</h3>";
         if ($newsgrid[$k] == "Li") {
             echo "<p>";
             echo '<span class="listglyph">' . get_the_date("j M Y");
             comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
             echo '</span> ';
             echo "</p>";
         } else {
             if ($showexcerpt == 'on') {
                 echo "<p>";
                 echo '<span class="listglyph">' . get_the_date("j M Y");
                 comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
                 echo '</span> ';
                 echo "</p>";
                 echo $thisexcerpt;
                 echo "<p class='news_date'><a class='more' href='{$thisURL}' title='{$thistitle}'>Full story <span class='dashicons dashicons-arrow-right-alt2'></span></a></p>";
             } else {
                 echo "<p>";
                 echo '<span class="listglyph">' . get_the_date("j M Y");
                 comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
                 echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Full story <span class='dashicons dashicons-arrow-right-alt2'></span></a></span></p>";
             }
         }
         echo "</div>";
         if ($newsgrid[$k] == "T") {
             echo "</div>";
         }
         echo "<hr class='light' />\n";
     }
     wp_reset_query();
     $landingpage = get_option('options_module_news_page');
     if (!$landingpage) {
         $landingpage_link_text = 'news';
         $landingpage = site_url() . '/newspage/';
     } else {
         $landingpage_link_text = get_the_title($landingpage[0]);
         $landingpage = get_permalink($landingpage[0]);
     }
     echo '<p><strong><a title="' . $landingpage_link_text . '" class="small" href="' . $landingpage . '">' . $landingpage_link_text . '</a></strong> <span class="dashicons dashicons-arrow-right-alt2"></span></p>';
     echo "<div class='clearfix'></div>";
     echo "</div>";
     echo $after_widget;
 }
     foreach ((array) $team as $t) {
         //print_r($taxonomy);
         //echo $taxonomy['name'];
         $themeid = $t;
         $theme = get_post($t);
         $themeparent = $theme->post_parent;
         if ($themeparent == 0) {
             $teamlist = govintranetpress_custom_title($theme->post_title);
             $html .= "" . $teamlist . "<br>";
             //echo $teamlist;
         } else {
             while ($themeparent != 0) {
                 $newteam = get_post($themeparent);
                 $themeparent = $newteam->post_parent;
             }
             $teamlist = govintranetpress_custom_title($newteam->post_title);
             $html .= "" . $teamlist . "<br>";
         }
     }
 }
 if (get_user_meta($userid, 'user_job_title', true)) {
     $meta = get_user_meta($userid, 'user_job_title', true);
     //$meta = str_replace(" ", "&nbsp;", $meta);
     $html .= '<span class="small">' . $meta . "</span><br>";
 }
 if (get_user_meta($userid, 'user_telephone', true)) {
     $html .= '<span class="small"><i class="dashicons dashicons-phone"></i> ' . get_user_meta($userid, 'user_telephone', true) . "</span><br>";
 }
 if (get_user_meta($userid, 'user_mobile', true) && $showmobile) {
     $html .= '<span class="small"><i class="dashicons dashicons-smartphone"></i> ' . get_user_meta($userid, 'user_mobile', true) . "</span>";
 }
Пример #17
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $largeitems = intval($instance['largeitems']);
        $mediumitems = intval($instance['mediumitems']);
        $thumbnailitems = intval($instance['thumbnailitems']);
        $listitems = intval($instance['listitems']);
        global $post;
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        echo "<div id='ht-feature-news'>";
        //load manual sticky news stories
        $hc = new Pod('homepage_control');
        $top_slot = $hc->get_field('top_news_story');
        //forumalate grid of news stories and formats
        $totalstories = $largeitems + $mediumitems + $thumbnailitems + $listitems;
        $newsgrid = array();
        for ($i = 1; $i <= $totalstories; $i++) {
            if ($i <= $largeitems) {
                $newsgrid[] = "L";
            } elseif ($i <= $largeitems + $mediumitems) {
                $newsgrid[] = "M";
            } elseif ($i <= $largeitems + $mediumitems + $thumbnailitems) {
                $newsgrid[] = "T";
            } elseif ($i <= $largeitems + $mediumitems + $thumbnailitems + $listitems) {
                $newsgrid[] = "Li";
            }
        }
        $siteurl = site_url();
        //manual override news stories
        //display sticky top news stories
        $num_top_slots = count($top_slot);
        $to_fill = $totalstories - $num_top_slots;
        $k = -1;
        $alreadydone = array();
        if ($num_top_slots > 0) {
            foreach ((array) $top_slot as $slot) {
                $newspod = new Pod('news', $slot['ID']);
                if ($newspod->get_field('post_status') != 'publish') {
                    continue;
                }
                $k++;
                $alreadydone[] = $slot['ID'];
                if (function_exists('get_video_thumbnail')) {
                    $videostill = get_video_thumbnail($slot['ID']);
                }
                $thistitle = govintranetpress_custom_title($slot['post_title']);
                $thisURL = $slot['post_name'];
                if ($newsgrid[$k] == "L") {
                    $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($slot['ID']), 'newshead');
                    if ($image_uri != "" && $videostill == '') {
                        echo "<a href='" . $siteurl . "/news/" . $slot['post_name'] . "/'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>";
                    }
                }
                if ($newsgrid[$k] == "M") {
                    $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($slot['ID']), 'medium');
                    if ($image_uri != "" && $videostill == '') {
                        echo "<a href='" . $siteurl . "/news/" . $slot['post_name'] . "/'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>";
                    }
                }
                if ($newsgrid[$k] == "T") {
                    $image_uri = "<a class='pull-right' href='" . $siteurl . "/news/" . $slot['post_name'] . "/'>" . get_the_post_thumbnail($slot['ID'], 'thumbnail', array('class' => 'media-object hidden-xs')) . "</a>";
                    if ($image_uri != "" && $videostill == '') {
                        $image_url = "<a href='" . $siteurl . "/news/" . $slot['post_name'] . "/'>" . $image_uri . "</a>";
                    }
                }
                $thisdate = $slot['post_date'];
                $post = get_post($slot['ID']);
                setup_postdata($post);
                $thisexcerpt = get_the_excerpt();
                $thisdate = date("j M Y", strtotime($thisdate));
                echo "<h3 class='noborder'><a class='' href='" . $thisURL . "'>" . $thistitle . "</a></h3>";
                if ($newsgrid[$k] == "Li") {
                    echo "<p><span class='news_date'>" . $thisdate . "";
                    echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></span></p>";
                } else {
                    echo "<p><span class='news_date'>" . $thisdate . "</span></p>";
                }
                if ($newsgrid[$k] == "T") {
                    echo "<div class='media'>" . $image_url;
                }
                echo "<div class='media-body'>";
                if ($newsgrid[$k] != "Li") {
                    echo $thisexcerpt . "<p class='news_date'>";
                    echo "<a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></p>";
                }
                echo "</div>";
                if ($newsgrid[$k] == "T") {
                    echo "</div>";
                }
                echo "<hr class='light' />\n";
            }
        }
        //end of stickies
        //display remaining stories
        $cquery = array('orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'news', 'posts_per_page' => $totalstories, 'meta_query' => array(array('key' => 'news_listing_type', 'value' => 0)));
        $news = new WP_Query($cquery);
        if ($news->post_count == 0) {
            echo "Nothing to show.";
        }
        while ($news->have_posts()) {
            $news->the_post();
            if (in_array($post->ID, $alreadydone)) {
                //don't show if already in stickies
                continue;
            }
            $k++;
            if ($k >= $totalstories) {
                break;
            }
            $thistitle = get_the_title($news->ID);
            $newspod = new Pod('news', $news->ID);
            $newspod->display('title');
            $thisURL = get_permalink($news->ID);
            if ($newsgrid[$k] == "L") {
                $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($news->ID), 'newshead');
                if ($image_uri != "" && $videostill == '') {
                    echo "<a href='{$thisURL}'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>";
                }
            }
            if ($newsgrid[$k] == "M") {
                $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($news->ID), 'medium');
                if ($image_uri != "" && $videostill == '') {
                    echo "<a href='{$thisURL}'><img class='img' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>";
                }
            }
            if ($newsgrid[$k] == "T") {
                $image_uri = "<a class='pull-right' href='{$thisURL}'>" . get_the_post_thumbnail($news->ID, 'thumbnail', array('class' => 'media-object hidden-xs')) . "</a>";
                if ($image_uri != "" && $videostill == '') {
                    $image_url = "<a href='{$thisURL}'>" . $image_uri . "</a>";
                }
            }
            $thisdate = get_the_date();
            $thisexcerpt = get_the_excerpt();
            $thisdate = date("j M Y", strtotime($thisdate));
            echo "<h3 class='noborder'><a class='' href='" . $thisURL . "'>" . $thistitle . "</a></h3>";
            if ($newsgrid[$k] == "Li") {
                echo "<p><span class='news_date'>" . $thisdate . "";
                echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></span></p>";
            } else {
                echo "<p><span class='news_date'>" . $thisdate . "</span></p>";
            }
            if ($newsgrid[$k] == "T") {
                echo "<div class='media'>" . $image_url;
            }
            echo "<div class='media-body'>";
            if ($newsgrid[$k] != "Li") {
                echo $thisexcerpt . "<p class='news_date'>";
                echo "<a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></p>";
            }
            echo "</div>";
            if ($newsgrid[$k] == "T") {
                echo "</div>";
            }
            echo "<hr class='light' />\n";
        }
        echo "</div>";
        wp_reset_query();
        ?>
		<div class="category-block"><p><strong><a title='More in news' class="small" href="<?php 
        echo $siteurl;
        ?>
/newspage/">More in news</a></strong> <i class='glyphicon glyphicon-chevron-right small'></i></p></div>


<?php 
        echo $after_widget;
    }
Пример #18
0
            comments_template('', true);
        }
        ?>

		</div> <!--end of first column-->
		<div class="col-lg-4  col-md-4 col-sm-4 col-lg-offset-1">	
			<?php 
        $relnews = new Pod('news', $id);
        $related_links = $relnews->get_field('related_stories');
        if ($related_links) {
            echo "<div class='widget-box list'>";
            echo "<h3 class='widget-title'>Related news</h3>";
            echo "<ul>";
            foreach ($related_links as $rlink) {
                if ($rlink['post_status'] == 'publish' && $rlink['ID'] != $id) {
                    echo "<li><a href='" . $rlink['guid'] . "'>" . govintranetpress_custom_title($rlink['post_title']) . "</a></li>";
                }
            }
            echo "</ul></div>";
        }
        $post_cat = get_the_category();
        if ($post_cat) {
            $html = '';
            foreach ($post_cat as $cat) {
                if ($cat->slug != 'uncategorized') {
                    if (!$catTitlePrinted) {
                        $catTitlePrinted = true;
                    }
                    $html .= "<span class='wptag t" . $cat->term_id . "'><a href='" . site_url() . "/news-by-category/?cat=" . $cat->slug . "'>" . str_replace(" ", "&nbsp;", $cat->name) . "</a></span> ";
                }
            }
Пример #19
0
                    $excerpt = strip_tags($c->post_content);
                }
            }
            $excerpt = str_replace('[bbp-forum-index]', '', $excerpt);
            $themeid = $c->id;
            $themeURL = $c->post_name;
            $catcount++;
            if ($catcount == 3) {
                $catcount = 1;
            }
            /*
              		    if ($catcount==1){
              		    }
            */
            echo "\n\t\t\t<div class='col-lg-3 col-md-6 col-sm-6 white";
            echo "'>\n\t\t\t\t<div class='category-block'>\n\t\t\t\t\t<h2><a href='{$themeURL}/'>" . govintranetpress_custom_title($c->post_title) . "</a></h2>\n\t\t\t\t\t<p>" . $excerpt . "</p>\n\t\t\t\t</div>\n\t\t\t</div>";
            /*
            			if ($catcount==2){
            			}
            */
        }
        echo '</div>';
        ?>
			</div>
		




<?php 
    }
Пример #20
0
function ht_favourites_ajax_show()
{
    $before_widget = stripcslashes($_POST['before_widget']);
    $after_widget = stripcslashes($_POST['after_widget']);
    $before_title = stripcslashes($_POST['before_title']);
    $after_title = stripcslashes($_POST['after_title']);
    $title = stripcslashes($_POST['title']);
    $user_id = $_POST['user_id'];
    $widget_id = $_POST['widget_id'];
    $faves = get_user_meta($user_id, 'user_favourites', true);
    $response = new WP_Ajax_Response();
    $html = "";
    if (count($faves) > 0 && is_array($faves)) {
        $html .= $before_widget;
        $userurl = site_url() . '/staff/' . $user_info->user_nicename;
        $userurl = get_author_posts_url($user_id);
        $gis = "options_forum_support";
        $forumsupport = get_option($gis);
        $staffdirectory = get_option('options_module_staff_directory');
        if (function_exists('bp_activity_screen_index')) {
            // if using BuddyPress - link to the members page
            $userurl = str_replace('/author', '/members', $userurl);
        } elseif (function_exists('bbp_get_displayed_user_field') && $staffdirectory) {
            // if using bbPress - link to the staff page
            $userurl = str_replace('/author', '/staff', $userurl);
        }
        $userurl .= "edit/#acf-field_5669ad29841d0";
        $html .= "<a href='" . $userurl . "' class='btn btn-sm btn-default pull-right editfav'>Edit</a>";
        if ($title) {
            $html .= $before_title . $title . $after_title;
        }
        $html .= "<ul>";
        foreach ($faves as $r) {
            $title_context = "";
            $rlink = get_post($r);
            if ($rlink->post_status == 'publish') {
                $taskparent = $rlink->post_parent;
                if ($taskparent) {
                    $taskparent = get_post($taskparent);
                    $title_context = " (" . govintranetpress_custom_title($taskparent->post_title) . ")";
                }
                $ext_icon = '';
                $ext = '';
                if (get_post_format($r) == 'link') {
                    $ext_icon = " <span class='dashicons dashicons-migrate'></span> ";
                    $ext = "class='external-link' ";
                }
                $html .= "<li><a href='" . get_permalink($rlink->ID) . "'" . $ext . ">" . govintranetpress_custom_title($rlink->post_title) . $title_context . "</a>" . $ext_icon . "</li>";
                $alreadydone[] = $r;
            }
        }
        $html .= "</ul>";
        $html .= $after_widget;
        wp_reset_postdata();
    }
    if ($html) {
        // Request successful
        $response->add(array('data' => 'success', 'supplemental' => array('message' => $html)));
    } else {
        // Request failed
        $response->add(array('data' => 'error', 'supplemental' => array('message' => 'an error occurred')));
    }
    $response->send();
    exit;
}
Пример #21
0
	<?php 
} else {
    $ext_icon = '';
    if (get_post_format($post->ID) == 'link') {
        $ext_icon = "<span class='dashicons dashicons-migrate'></span> ";
    }
    //regular listing *********************
    echo "<div class='media'>";
    $image_url = get_the_post_thumbnail($id, 'thumbnail', array('class' => 'alignright img-responsive'));
    echo "<a href='";
    $userurl = get_permalink();
    echo $userurl;
    echo "'><div class='hidden-xs'>";
    $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'thumbnail');
    if ($image_uri != "") {
        echo "<a href='{$thisURL}'><img class='img img-responsive alignright' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($post->post_title) . "' /></a>";
    }
    echo "</div></a>";
    echo "<div class='media-body'>";
    ?>
	<h3 class='postlist'><?php 
    echo $needtoknow;
    ?>
				
	<a href="<?php 
    the_permalink();
    ?>
" title="<?php 
    printf(esc_attr__('%s', 'govintranet'), the_title_attribute('echo=0'));
    ?>
" rel="bookmark"><?php 
Пример #22
0
         if ($taskparent) {
             $parent_guide_id = $taskparent[0]['ID'];
             $taskparent = get_post($parent_guide_id);
             $title_context = " <small>(" . govintranetpress_custom_title($taskparent->post_title) . ")</small>";
         }
     }
 }
 if ($post_type == 'Projects') {
     $context = "project";
     $icon = "road";
     $taskpod = new Pod('projects', $post->ID);
     $projparent = $taskpod->get_field('parent_project');
     if ($projparent) {
         $parent_guide_id = $projparent[0]['ID'];
         $projparent = get_post($parent_guide_id);
         $title_context = " <small>(" . govintranetpress_custom_title($projparent->post_title) . ")</small>";
     }
 }
 if ($post_type == 'News') {
     $context = "news";
     $icon = "star-empty";
 }
 if ($post_type == 'Vacancies') {
     $context = "job vacancy";
     $icon = "random";
 }
 if ($post_type == 'Blog') {
     $context = "blog";
     $icon = "comment";
 }
 if ($post_type == 'Event') {
Пример #23
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $items = intval($instance['items']);
        $pages = $instance['pages'];
        $tasks = $instance['tasks'];
        $projects = $instance['projects'];
        $vacancies = $instance['vacancies'];
        $news = $instance['news'];
        $blog = $instance['blog'];
        $events = $instance['events'];
        $trail = intval($instance['trail']);
        $ga_viewid = $instance['ga_viewid'];
        $cache = intval($instance['cache']);
        if (!$cache) {
            $cache = 1;
        }
        $widget_id = $id;
        $acf_key = "widget_" . $this->id_base . "-" . $this->number . "_exclude_posts";
        $exclude = get_option($acf_key);
        $stoppages = array('how-do-i', 'task-by-category', 'news-by-category', 'newspage', 'tagged', 'atoz', 'about', 'home', 'blogs', 'events', 'category', 'news-type');
        if ($exclude) {
            foreach ($exclude as $sp) {
                $stop = get_page($sp);
                if ($stop) {
                    $stoppages[] = $stop->post_name;
                }
            }
        }
        $acf_key = "widget_" . $this->id_base . "-" . $this->number . "_show_guide_chapters";
        $showchapters = get_option($acf_key);
        $client_id = '956426687308-20cs4la3m295f07f1njid6ttoeinvi92.apps.googleusercontent.com';
        $client_secret = 'yzrrxZgCPqIu2gaqqq-uzB4D';
        $redirect_uri = 'urn:ietf:wg:oauth:2.0:oob';
        $account_id = 'ga:' . $ga_viewid;
        $baseurl = site_url();
        $to_fill = $items;
        $k = 0;
        $alreadydone = array();
        $html = '';
        $gatransient = substr('cached_ga_' . $widget_id . '_' . sanitize_file_name($title), 0, 45);
        $cachedga = get_transient($gatransient);
        if ($cachedga != "") {
            // if we have a fresh cache
            foreach ($cachedga as $result) {
                if ($k > $items - 1) {
                    break;
                }
                $k++;
                $html .= $result;
            }
        } else {
            //load fresh analytics
            include_once 'GoogleAnalyticsAPI.class.php';
            $ga = new GoogleAnalyticsAPI();
            $ga->auth->setClientId($client_id);
            // From the APIs console
            $ga->auth->setClientSecret($client_secret);
            // From the APIs console
            $ga->auth->setRedirectUri($redirect_uri);
            // Url to your app, must match one in the APIs console
            // Get the Auth-Url
            $url = $ga->auth->buildAuthUrl();
            ini_set('error_reporting', '0');
            // disable all, for security
            $gatoken = get_option('ga_token');
            $refreshToken = get_option('ga_refresh_token');
            $tokenExpires = get_option('ga_token_expires');
            $tokenCreated = get_option('ga_token_created');
            /*
             *  Step 1: Get a Token
             */
            if ($gatoken == '') {
                // if no token stored
                if (!isset($_GET['code'])) {
                    // if we arn't submitting GET code to the db
                    $url = $ga->auth->buildAuthUrl();
                    // give users a form to generate code
                    ?>
					<a class="btn btn-primary" target="_blank" href="<?php 
                    echo $url;
                    ?>
"><?php 
                    _e('Authorise Google Analytics access', 'govintranet');
                    ?>
</a>
					<form id="" class="">
						<label for="code"><?php 
                    _e('Enter your code from Google', 'govintranet');
                    ?>
</label></span>
						<input id="code" name="code" />
						<button class="submit" type="submit"><?php 
                    _e('Save', 'govintranet');
                    ?>
</button>
					</form>
				<?php 
                } else {
                    // we are submitting GET code to the db
                    $auth = $ga->auth->getAccessToken($_GET['code']);
                    if ($auth['http_code'] == 200) {
                        $accessToken = $auth['access_token'];
                        $refreshToken = $auth['refresh_token'];
                        $tokenExpires = $auth['expires_in'];
                        $tokenCreated = time();
                        // Store the Tokens
                        update_option('ga_token', $accessToken);
                        $gatoken = $accessToken;
                        // make token available for use
                        update_option('ga_refresh_token', $refreshToken);
                        update_option('ga_token_expires', $tokenExpires);
                        update_option('ga_token_created', $tokenCreated);
                    } else {
                        $url = $ga->auth->buildAuthUrl();
                        // give users a form to generate code
                        ?>
			            <em><?php 
                        _e('Sorry, something went wrong accessing Google Analytics', 'govintranet');
                        ?>
:<?php 
                        echo $auth['error_description'];
                        ?>
</em>
						<a class="btn btn-primary" target="_blank" href="<?php 
                        echo $url;
                        ?>
"><?php 
                        _e('Authorise Google Analytics access', 'govintranet');
                        ?>
</a>
						<form id="" class="">
							<label for="code"><?php 
                        _e('Enter your code from Google', 'govintranet');
                        ?>
</label></span>
							<input id="code" name="code" type="text"/>
							<button class="submit" type="submit"><?php 
                        _e('Save', 'govintranet');
                        ?>
</button>
						</form>
			        <?php 
                    }
                }
                /*
                 *  Step 2: Validate Token
                 */
            } elseif ($gatoken != '' && time() - $tokenCreated >= $tokenExpires) {
                // We've got a token stored but it's expired
                $auth = $ga->auth->refreshAccessToken($refreshToken);
                $accessToken = $auth['access_token'];
                $tokenExpires = $auth['expires_in'];
                $tokenCreated = time();
                update_option('ga_token', $accessToken);
                $gatoken = $accessToken;
                // make new token available for use
                update_option('ga_token_expires', $tokenExpires);
                update_option('ga_token_created', $tokenCreated);
                /*
                 *  Step 3: Do real stuff!
                 *          If we're here, we sure we've got an access token and it's valid
                 */
            }
            if ($gatoken != '') {
                $ga->setAccessToken($gatoken);
                $ga->setAccountId($account_id);
                $days_to_trail = $trail;
                if ($days_to_trail < 1) {
                    $days_to_trail = 1;
                }
                $tzone = get_option('timezone_string');
                date_default_timezone_set($tzone);
                $start_date = date("Y-m-d", time() - 86400 * $days_to_trail);
                // last x days
                $donefilter = false;
                $filter = '';
                $ext = '';
                if ($projects == 'on') {
                    $filter .= 'ga:pagePath=~/project/';
                    $donefilter = true;
                }
                if ($tasks == 'on') {
                    if ($donefilter) {
                        $filter .= "||";
                    }
                    $filter .= 'ga:pagePath=~/task/';
                    $donefilter = true;
                }
                if ($vacancies == 'on') {
                    if ($donefilter) {
                        $filter .= "||";
                    }
                    $filter .= 'ga:pagePath=~/vacancy/';
                    $donefilter = true;
                }
                if ($news == 'on') {
                    if ($donefilter) {
                        $filter .= "||";
                    }
                    $filter .= 'ga:pagePath=~/news/';
                    $donefilter = true;
                }
                if ($blog == 'on') {
                    if ($donefilter) {
                        $filter .= "||";
                    }
                    $filter .= 'ga:pagePath=~/blog/';
                    $donefilter = true;
                }
                if ($events == 'on') {
                    if ($donefilter) {
                        $filter .= "||";
                    }
                    $filter .= 'ga:pagePath=~/event/';
                    $donefilter = true;
                }
                if ($pages == 'on') {
                    if ($donefilter) {
                        $filter .= "||";
                    }
                    $filter .= 'ga:pagePath=~/';
                    $donefilter = true;
                    if ($projects && $tasks && $vacancies && $news && $blog && $events) {
                        $filter = 'ga:pagePath=~/';
                    }
                }
                //check length of regular express; GA has a 128 character limit. If we're over, query everything and we'll filter results later.
                if (strlen($filter) > 128) {
                    $filter = 'ga:pagePath=~/';
                }
                // Set the default params. For example the start/end dates and max-results
                $defaults = array('start-date' => $start_date, 'end-date' => date('Y-m-d'), 'filters' => $filter);
                $ga->setDefaultQueryParams($defaults);
                $params = array('metrics' => 'ga:uniquePageviews', 'dimensions' => 'ga:pagePath', 'sort' => '-ga:uniquePageviews');
                $visits = $ga->query($params);
                if ($visits) {
                    foreach ($visits as $r => $result) {
                        if ($r == "rows") {
                            foreach ($result as $res) {
                                $found = false;
                                if (strpos($res[0], "show=")) {
                                    continue;
                                }
                                if ($k > $items - 1) {
                                    break;
                                }
                                $tasktitle = '';
                                $tasktitlecontext = '';
                                $filtered_pagepath = $res[0];
                                $path = "/task/";
                                $pathlen = strlen($path);
                                if (substr($filtered_pagepath, 0, $pathlen) == $path && $tasks == 'on') {
                                    $pathparts = explode("/", $res[0]);
                                    if (!$pathparts) {
                                        $pathparts = array();
                                    }
                                    if (end($pathparts) == '') {
                                        array_pop($pathparts);
                                    }
                                    $thistask = end($pathparts);
                                    if (in_array($thistask, $stoppages)) {
                                        continue;
                                    }
                                    $tasktitle = false;
                                    $check = array_shift($pathparts);
                                    $check = array_shift($pathparts);
                                    $path = implode("/", $pathparts);
                                    $taskpod = get_page_by_path($path, OBJECT, 'task');
                                    if ($taskpod) {
                                        if ("publish" != $taskpod->post_status) {
                                            continue;
                                        }
                                        $tasktitle = govintranetpress_custom_title($taskpod->post_title);
                                        $taskid = $taskpod->ID;
                                        $taskslug = $taskpod->post_name;
                                        if ($taskpod->post_parent) {
                                            $taskpod2 = get_post($taskpod->post_parent);
                                            if ($showchapters != 1) {
                                                // hide individual chapters
                                                $taskid = $taskpod2->ID;
                                                $taskslug = $taskpod2->post_name;
                                                $tasktitle = govintranetpress_custom_title($taskpod2->post_title);
                                            } else {
                                                // show individual chapters
                                                $tasktitlecontext = " <small>(" . govintranetpress_custom_title($taskpod2->post_title) . ")</small>";
                                            }
                                        }
                                    }
                                    if (!$tasktitle) {
                                        continue;
                                    }
                                    if (in_array($taskid, $alreadydone)) {
                                        continue;
                                    }
                                    if (get_post_meta($taskid, 'external_link', true)) {
                                        $ext = "class='external-link' ";
                                    }
                                    $found = true;
                                    $k++;
                                }
                                $path = "/news/";
                                $pathlen = strlen($path);
                                if (substr($filtered_pagepath, 0, $pathlen) == $path && $news == 'on') {
                                    $pathparts = explode("/", $res[0]);
                                    if (!$pathparts) {
                                        $pathparts = array();
                                    }
                                    if (!$pathparts) {
                                        $pathparts = array();
                                    }
                                    if (end($pathparts) == '') {
                                        array_pop($pathparts);
                                    }
                                    $thistask = end($pathparts);
                                    if (in_array($thistask, $stoppages)) {
                                        continue;
                                    }
                                    $tasktitle = false;
                                    $path = 'news/' . $thistask;
                                    $taskpod = get_page_by_path($thistask, OBJECT, 'news');
                                    if ("publish" != $taskpod->post_status) {
                                        continue;
                                    }
                                    $tasktitle = $taskpod->post_title;
                                    $taskid = $taskpod->ID;
                                    $taskslug = $taskpod->post_name;
                                    if (!$tasktitle) {
                                        continue;
                                    }
                                    if (in_array($taskid, $alreadydone)) {
                                        continue;
                                    }
                                    if (get_post_meta($taskpod->ID, 'external_link', true)) {
                                        $ext = "class='external-link' ";
                                    }
                                    $found = true;
                                    $k++;
                                }
                                $path = "/project/";
                                $pathlen = strlen($path);
                                if (substr($filtered_pagepath, 0, $pathlen) == $path && $projects == 'on') {
                                    $pathparts = explode("/", $res[0]);
                                    if (!$pathparts) {
                                        $pathparts = array();
                                    }
                                    if (end($pathparts) == '') {
                                        array_pop($pathparts);
                                    }
                                    $thistask = end($pathparts);
                                    if (in_array($thistask, $stoppages)) {
                                        continue;
                                    }
                                    $tasktitle = false;
                                    $path = 'project/' . $thistask;
                                    $taskpod = get_page_by_path($thistask, OBJECT, 'project');
                                    if ("publish" != $taskpod->post_status) {
                                        continue;
                                    }
                                    $tasktitle = $taskpod->post_title;
                                    $taskid = $taskpod->ID;
                                    $taskslug = $taskpod->post_name;
                                    if ($taskpod->post_parent) {
                                        $taskpod = get_post($taskpod->post_parent);
                                        $taskid = $taskpod->ID;
                                        $taskslug = $taskpod->post_name;
                                        $tasktitle = $taskpod->post_title;
                                    }
                                    if (!$tasktitle) {
                                        continue;
                                    }
                                    if (in_array($taskid, $alreadydone)) {
                                        continue;
                                    }
                                    if (get_post_meta($taskpod->ID, 'external_link', true)) {
                                        $ext = "class='external-link' ";
                                    }
                                    $found = true;
                                    $k++;
                                }
                                $path = "/vacancy/";
                                $pathlen = strlen($path);
                                if (substr($filtered_pagepath, 0, $pathlen) == $path && $vacancies == 'on') {
                                    $pathparts = explode("/", $res[0]);
                                    if (!$pathparts) {
                                        $pathparts = array();
                                    }
                                    if (end($pathparts) == '') {
                                        array_pop($pathparts);
                                    }
                                    $thistask = end($pathparts);
                                    if (in_array($thistask, $stoppages)) {
                                        continue;
                                    }
                                    $tasktitle = false;
                                    $path = 'vacancy/' . $thistask;
                                    $taskpod = get_page_by_path($thistask, OBJECT, 'vacancy');
                                    if ("publish" != $taskpod->post_status) {
                                        continue;
                                    }
                                    $tasktitle = $taskpod->post_title;
                                    $taskid = $taskpod->ID;
                                    $taskslug = $taskpod->post_name;
                                    if (!$tasktitle) {
                                        continue;
                                    }
                                    if (in_array($taskid, $alreadydone)) {
                                        continue;
                                    }
                                    if (get_post_meta($taskpod->ID, 'external_link', true)) {
                                        $ext = "class='external-link' ";
                                    }
                                    $found = true;
                                    $k++;
                                }
                                $path = "/event/";
                                $pathlen = strlen($path);
                                if (substr($filtered_pagepath, 0, $pathlen) == $path && $events == 'on') {
                                    $pathparts = explode("/", $res[0]);
                                    if (!$pathparts) {
                                        $pathparts = array();
                                    }
                                    if (end($pathparts) == '') {
                                        array_pop($pathparts);
                                    }
                                    $thistask = end($pathparts);
                                    if (in_array($thistask, $stoppages)) {
                                        continue;
                                    }
                                    $tasktitle = false;
                                    $path = 'event/' . $thistask;
                                    $taskpod = get_page_by_path($thistask, OBJECT, 'event');
                                    if ("publish" != $taskpod->post_status) {
                                        continue;
                                    }
                                    $tasktitle = $taskpod->post_title;
                                    $taskid = $taskpod->ID;
                                    $taskslug = $taskpod->post_name;
                                    if (!$tasktitle) {
                                        continue;
                                    }
                                    if (in_array($taskid, $alreadydone)) {
                                        continue;
                                    }
                                    if (get_post_meta($taskpod->ID, 'external_link', true)) {
                                        $ext = "class='external-link' ";
                                    }
                                    $found = true;
                                    $k++;
                                }
                                $path = "/blog/";
                                $pathlen = strlen($path);
                                if (substr($filtered_pagepath, 0, $pathlen) == $path && $blog == 'on') {
                                    $pathparts = explode("/", $res[0]);
                                    if (!$pathparts) {
                                        $pathparts = array();
                                    }
                                    if (end($pathparts) == '') {
                                        array_pop($pathparts);
                                    }
                                    $thistask = end($pathparts);
                                    if (in_array($thistask, $stoppages)) {
                                        continue;
                                    }
                                    $tasktitle = false;
                                    $path = 'blog/' . $thistask;
                                    $taskpod = get_page_by_path($thistask, OBJECT, 'blog');
                                    if ("publish" != $taskpod->post_status) {
                                        continue;
                                    }
                                    $tasktitle = $taskpod->post_title;
                                    $taskid = $taskpod->ID;
                                    $taskslug = $taskpod->post_name;
                                    if (!$tasktitle) {
                                        continue;
                                    }
                                    if (in_array($taskid, $alreadydone)) {
                                        continue;
                                    }
                                    if (get_post_meta($taskpod->ID, 'external_link', true)) {
                                        $ext = "class='external-link' ";
                                    }
                                    $found = true;
                                    $k++;
                                }
                                $path = "/";
                                $pathlen = strlen($path);
                                if ($pages == 'on' && !$found) {
                                    // show pages
                                    $pathparts = explode("/", $res[0]);
                                    if (!$pathparts) {
                                        $pathparts = array();
                                    }
                                    if (end($pathparts) == '') {
                                        array_pop($pathparts);
                                    }
                                    $thistask = end($pathparts);
                                    if (in_array($thistask, $stoppages)) {
                                        continue;
                                    }
                                    $path = $res[0];
                                    $taskpod = get_page_by_path($thistask, OBJECT, 'page');
                                    if ($taskpod) {
                                        if ("publish" != $taskpod->post_status) {
                                            continue;
                                        }
                                        $tasktitle = $taskpod->post_title;
                                        $taskid = $taskpod->ID;
                                        $taskslug = $taskpod->post_name;
                                        if (!$tasktitle) {
                                            continue;
                                        }
                                        if (in_array($taskid, $alreadydone)) {
                                            continue;
                                        }
                                        if (get_post_meta($taskpod->ID, 'external_link', true)) {
                                            $ext = "class='external-link' ";
                                        }
                                        $found = true;
                                        $k++;
                                    }
                                }
                                if ($tasktitle != '') {
                                    $html .= "<li><a " . $ext . "href='" . get_permalink($taskid) . "'>" . $tasktitle . "</a>" . $tasktitlecontext . "</li>";
                                    $transga[] = "<li><a " . $ext . "href='" . get_permalink($taskid) . "'>" . $tasktitle . "</a>" . $tasktitlecontext . "</li>";
                                    $alreadydone[] = $taskid;
                                }
                            }
                        }
                    }
                }
            }
            if (count($transga) > 0) {
                set_transient($gatransient, $transga, $cache * 60 * 60);
            }
            // set cache period
        }
        if ($k) {
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            echo "<ul>" . $html . "</ul>";
            echo $after_widget;
        }
        // end of popular pages
        wp_reset_query();
    }
Пример #24
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $items = intval($instance['items']);
        $pages = $instance['pages'];
        $tasks = $instance['tasks'];
        $projects = $instance['projects'];
        $vacancies = $instance['vacancies'];
        $news = $instance['news'];
        $blog = $instance['blog'];
        $events = $instance['events'];
        $trail = intval($instance['trail']);
        $cache = intval($instance['cache']);
        ?>
              <?php 
        echo $before_widget;
        ?>
                  <?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>



<?php 
        $baseurl = home_url();
        $hc = new Pod('homepage_control');
        $top_pages = $hc->get_field('top_pages');
        $num_top_slots = count($top_pages);
        $to_fill = $items - $num_top_slots;
        $k = 0;
        $alreadydone = array();
        //display top news stories
        $hmtl = '';
        if ($top_pages) {
            foreach ($top_pages as $slot) {
                $k++;
                $alreadydone[] = $slot['ID'];
                $thistitle = govintranetpress_custom_title($slot['post_title']);
                $thisURL = $slot['post_name'];
                $taskpod = new Pod('task', $thistask);
                $tasktitle = govintranetpress_custom_title($slot['post_title']);
                $html .= "<li><a href='" . site_url() . "/task/" . $thisURL . "'>" . $tasktitle . "</a></li>";
            }
            echo "<ul>" . $html . "</ul>";
        }
        $cachedga = get_transient('cached_ga');
        if ($cachedga) {
            // if we have a fresh cache
            $html = '';
            foreach ($cachedga as $result) {
                if (strpos($result['pagePath'], "show=")) {
                    continue;
                }
                if ($k > $items - 1) {
                    break;
                }
                $tasktitle = '';
                if (substr($result['pagePath'], 0, 6) == '/task/' && $result['pagePath'] != '/task/' && $tasks == 'on') {
                    // only show tasks, but not the tasks landing page
                    $pathparts = explode("/", $result['pagePath']);
                    $thistask = $pathparts[2];
                    $tasktitle = false;
                    $taskpod = new Pod('task', $thistask);
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if ($taskpod->get_field('parent_guide')) {
                        //if this is a chapter in a guide, we'll display the parent page
                        continue;
                    }
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskpod->get_field('ID'), $alreadydone)) {
                        continue;
                    }
                    $k++;
                }
                if (substr($result['pagePath'], 0, 10) == '/projects/' && $result['pagePath'] != '/about/projects/' && $projects == 'on') {
                    // only show projects, but not the projects landing page
                    $pathparts = explode("/", $result['pagePath']);
                    $thistask = $pathparts[2];
                    $taskpod = new Pod('projects', $thistask);
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if ($taskpod->get_field('parent_project')) {
                        continue;
                    }
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskpod->get_field('ID'), $alreadydone)) {
                        continue;
                    }
                    $k++;
                }
                if (substr($result['pagePath'], 0, 11) == '/vacancies/' && $result['pagePath'] != '/about/vacancies/' && $vacancies == 'on') {
                    // only show vacancies, but not the vacancies landing page
                    $pathparts = explode("/", $result['pagePath']);
                    $thistask = $pathparts[2];
                    $taskpod = new Pod('vacancies', $thistask);
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskpod->get_field('ID'), $alreadydone)) {
                        continue;
                    }
                    $k++;
                }
                if (substr($result['pagePath'], 0, 6) == '/news/' && $result['pagePath'] != '/news/' && $news == 'on') {
                    // only show news, but not the news landing page
                    $pathparts = explode("/", $result['pagePath']);
                    $thistask = $pathparts[2];
                    $taskpod = new Pod('news', $thistask);
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskpod->get_field('ID'), $alreadydone)) {
                        continue;
                    }
                    $k++;
                }
                if (substr($result['pagePath'], 0, 6) == '/blog/' && $result['pagePath'] != '/blog/' && $blog == 'on') {
                    // only show news, but not the news landing page
                    $pathparts = explode("/", $result['pagePath']);
                    $thistask = $pathparts[2];
                    $taskpod = new Pod('blog', $thistask);
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskpod->get_field('ID'), $alreadydone)) {
                        continue;
                    }
                    $k++;
                }
                if (substr($result['pagePath'], 0, 7) == '/event/' && $result['pagePath'] != '/events/' && $events == 'on') {
                    // only show news, but not the news landing page
                    $pathparts = explode("/", $result['pagePath']);
                    $thistask = $pathparts[2];
                    $taskpod = new Pod('event', $thistask);
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskpod->get_field('ID'), $alreadydone)) {
                        continue;
                    }
                    $k++;
                }
                if ($pages == 'on' && !$tasktitle) {
                    // show pages
                    $pathparts = explode("/", $result['pagePath']);
                    $countparts = count($pathparts) - 2;
                    if ($countparts < 1) {
                        $countparts = 0;
                    }
                    $thistask = $pathparts[intval($countparts)];
                    if (!in_array($thistask, array('how-do-i', 'tasks', 'task-by-category', 'news-by-category', 'newspage', 'tagged', 'atoz', 'about', 'home', 'events', 'blog', 'activate', 'register', 'members', 'activity', 'forums', 'jargon-buster', 'search-staff', 'staff-directory', 'document-finder'))) {
                        $q = "select post_title, ID from wp_posts where post_name = '" . $thistask . "' and post_status='publish' and post_type='page';";
                        global $wpdb;
                        $thispage = $wpdb->get_results($q, ARRAY_A);
                        foreach ($thispage as $t) {
                            //echo $t['post_title'];
                            $tasktitle = govintranetpress_custom_title($t['post_title']);
                            $taskid = $t['ID'];
                        }
                        if (!$tasktitle) {
                            continue;
                        }
                        if (in_array($taskid, $alreadydone)) {
                            continue;
                        }
                        $k++;
                    }
                }
                if ($tasktitle != '') {
                    $html .= "<li><a href='" . $baseurl . $result['pagePath'] . "'>" . $tasktitle . "</a></li>";
                }
            }
        } else {
            ini_set('error_reporting', '0');
            // disable all, for security
            // Developed by Steph Gray http://helpfultechnology.com, December 2009
            // Uses the GAPI library by Stig Manning <*****@*****.**>, version 1.3
            $gs = new Pod('general_intranet');
            $google_analytics_username = $gs->get_field('google_analytics_email');
            $google_analytics_password = $gs->get_field('google_password');
            $google_analytics_profileid = $gs->get_field('google_analytics_profile_id');
            $days_to_trail = $trail;
            if ($days_to_trail < 1) {
                $days_to_trail = 1;
            }
            $gis = "general_intranet_time_zone";
            $tzone = get_option($gis);
            date_default_timezone_set($tzone);
            $start_date = date("Y-m-d", time() - 86400 * $days_to_trail);
            // last x days
            define('ga_email', $google_analytics_username);
            define('ga_password', $google_analytics_password);
            define('ga_profile_id', $google_analytics_profileid);
            $count = $conf['tab1']['garesultcount'] ? $conf['tab1']['garesultcount'] : 50;
            require_once 'gapi.class.php';
            $ga = new gapi(ga_email, ga_password);
            $donefilter = false;
            $filter = '';
            if ($projects == 'on') {
                $filter .= 'ga:pagePath=~/projects/';
                $donefilter = true;
            }
            if ($tasks == 'on') {
                if ($donefilter) {
                    $filter .= "||";
                }
                $filter .= 'ga:pagePath=~/task/';
                $donefilter = true;
            }
            if ($vacancies == 'on') {
                if ($donefilter) {
                    $filter .= "||";
                }
                $filter .= 'ga:pagePath=~/vacancies/';
                $donefilter = true;
            }
            if ($news == 'on') {
                if ($donefilter) {
                    $filter .= "||";
                }
                $filter .= 'ga:pagePath=~/news/';
                $donefilter = true;
            }
            if ($blog == 'on') {
                if ($donefilter) {
                    $filter .= "||";
                }
                $filter .= 'ga:pagePath=~/blog/';
                $donefilter = true;
            }
            if ($events == 'on') {
                if ($donefilter) {
                    $filter .= "||";
                }
                $filter .= 'ga:pagePath=~/event/';
                $donefilter = true;
            }
            if ($pages == 'on') {
                if ($donefilter) {
                    $filter .= "||";
                }
                $filter .= 'ga:pagePath=~/';
                $donefilter = true;
            }
            $ga->requestReportData(ga_profile_id, array('pagePath'), array('uniquePageviews'), "-uniquePageviews", $filter, $start_date, $enddate, "1", $count);
            $transga = array();
            $html = '';
            foreach ($ga->getResults() as $result) {
                if (strpos($result->getPagePath(), "show=")) {
                    continue;
                }
                if ($k > $items - 1) {
                    break;
                }
                $tasktitle = '';
                $filtered_pagepath = str_replace(@explode(",", $conf['tab1']['gatidypaths']), "", $result->getPagePath());
                if (substr($result->getPagePath(), 0, 6) == '/task/' && $result->getPagePath() != '/task/' && $tasks == 'on') {
                    // only show tasks, but not the tasks landing page
                    $pathparts = explode("/", $result->getPagePath());
                    $thistask = $pathparts[2];
                    $tasktitle = false;
                    $taskpod = new Pod('task', $thistask);
                    $taskid = $taskpod->get_field('ID');
                    $taskslug = $taskpod->get_field('post_name');
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if ($taskpod->get_field('parent_guide')) {
                        $parentpod = $taskpod->get_field('parent_guide');
                        $taskpod = new Pod('task', $parentpod[0]['ID']);
                        $taskid = $taskpod->get_field('ID');
                        $taskslug = $taskpod->get_field('post_name');
                        $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    }
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskid, $alreadydone)) {
                        continue;
                    }
                    $k++;
                    $transga[]['uniquePageviews'] = $result->getUniquePageviews();
                    $transga[]['pagePath'] = "/task/" . $taskslug;
                }
                if (substr($result->getPagePath(), 0, 10) == '/projects/' && $result->getPagePath() != '/about/projects/' && $projects == 'on') {
                    // only show projects, but not the projects landing page
                    $pathparts = explode("/", $result->getPagePath());
                    $thistask = $pathparts[2];
                    $taskpod = new Pod('projects', $thistask);
                    $taskid = $taskpod->get_field('ID');
                    $taskslug = $taskpod->get_field('post_name');
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if ($taskpod->get_field('parent_project')) {
                        $parentpod = $taskpod->get_field('parent_project');
                        $taskpod = new Pod('projects', $parentpod[0]['ID']);
                        $taskid = $taskpod->get_field('ID');
                        $taskslug = $taskpod->get_field('post_name');
                        $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    }
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskid, $alreadydone)) {
                        continue;
                    }
                    $k++;
                    $transga[]['uniquePageviews'] = $result->getUniquePageviews();
                    $transga[]['pagePath'] = "/projects/" . $taskslug;
                }
                if (substr($result->getPagePath(), 0, 11) == '/vacancies/' && $result->getPagePath() != '/about/vacancies/' && $vacancies == 'on') {
                    // only show vacancies, but not the vacancies landing page
                    $pathparts = explode("/", $result->getPagePath());
                    $thistask = $pathparts[2];
                    $taskpod = new Pod('vacancies', $thistask);
                    $taskid = $taskpod->get_field('ID');
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskpod->get_field('ID'), $alreadydone)) {
                        continue;
                    }
                    $k++;
                    $transga[]['uniquePageviews'] = $result->getUniquePageviews();
                    $transga[]['pagePath'] = $result->getPagePath();
                }
                if (substr($result->getPagePath(), 0, 6) == '/news/' && $result->getPagePath() != '/news/' && $news == 'on') {
                    // only show news, but not the news landing page
                    $pathparts = explode("/", $result->getPagePath());
                    $thistask = $pathparts[2];
                    $taskpod = new Pod('news', $thistask);
                    $taskid = $taskpod->get_field('ID');
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskpod->get_field('ID'), $alreadydone)) {
                        continue;
                    }
                    $k++;
                    $transga[]['uniquePageviews'] = $result->getUniquePageviews();
                    $transga[]['pagePath'] = $result->getPagePath();
                }
                if (substr($result->getPagePath(), 0, 6) == '/blog/' && $result->getPagePath() != '/blog/' && $blog == 'on') {
                    // only show news, but not the news landing page
                    $pathparts = explode("/", $result->getPagePath());
                    $thistask = $pathparts[2];
                    $taskpod = new Pod('blog', $thistask);
                    $taskid = $taskpod->get_field('ID');
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskpod->get_field('ID'), $alreadydone)) {
                        continue;
                    }
                    $k++;
                    $transga[]['uniquePageviews'] = $result->getUniquePageviews();
                    $transga[]['pagePath'] = $result->getPagePath();
                }
                if (substr($result->getPagePath(), 0, 7) == '/event/' && $result->getPagePath() != '/events/' && $events == 'on') {
                    // only show news, but not the news landing page
                    $pathparts = explode("/", $result->getPagePath());
                    $thistask = $pathparts[2];
                    $taskpod = new Pod('event', $thistask);
                    $taskid = $taskpod->get_field('ID');
                    $tasktitle = govintranetpress_custom_title($taskpod->get_field('title'));
                    if (!$tasktitle) {
                        continue;
                    }
                    if (in_array($taskpod->get_field('ID'), $alreadydone)) {
                        continue;
                    }
                    $k++;
                    $transga[]['uniquePageviews'] = $result->getUniquePageviews();
                    $transga[]['pagePath'] = $result->getPagePath();
                }
                if ($pages == 'on' && !$tasktitle) {
                    // show pages
                    $pathparts = explode("/", $result->getPagePath());
                    $countparts = count($pathparts) - 2;
                    $thistask = $pathparts[intval($countparts)];
                    if (!in_array($thistask, array('how-do-i', 'task-by-category', 'news-by-category', 'newspage', 'tagged', 'atoz', 'about', 'home', 'events', 'blog', 'activate', 'register', 'members', 'activity', 'forums', 'jargon-buster'))) {
                        $q = "select post_title, ID from wp_posts where post_name = '" . $thistask . "' and post_status='publish' and post_type='page';";
                        global $wpdb;
                        $thispage = $wpdb->get_results($q, ARRAY_A);
                        foreach ($thispage as $t) {
                            $tasktitle = govintranetpress_custom_title($t['post_title']);
                            $taskid = $t['ID'];
                        }
                        if (!$tasktitle) {
                            continue;
                        }
                        if (in_array($taskid, $alreadydone)) {
                            continue;
                        }
                        $k++;
                        $transga[]['uniquePageviews'] = $result->getUniquePageviews();
                        $transga[]['pagePath'] = $result->getPagePath();
                    } else {
                        continue;
                    }
                }
                if ($tasktitle != '') {
                    $html .= "<li><a href='" . $baseurl . $result->getPagePath() . "'>" . $tasktitle . "</a></li>";
                    $alreadydone[] = $taskid;
                }
            }
            set_transient('cached_ga', $transga, 60 * 60 * $cache);
            // set cache period
        }
        if ($k == 0) {
            $html = "<li>Looks like nobody has visited the intranet recently.</li>";
        }
        // end of popular pages
        echo "<ul id='ga_" . $_REQUEST['mode'] . "'>" . $html . "</ul>";
        wp_reset_query();
        ?>

              <?php 
        echo $after_widget;
        ?>
        <?php 
    }
Пример #25
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $items = intval($instance['items']);
        $pages = $instance['pages'];
        $tasks = $instance['tasks'];
        $projects = $instance['projects'];
        $vacancies = $instance['vacancies'];
        $news = $instance['news'];
        $blog = $instance['blog'];
        $events = $instance['event'];
        $lastupdated = $instance['lastupdated'];
        ?>
              <?php 
        echo $before_widget;
        ?>
                  <?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>



<?php 
        $donefilter = false;
        $filter = '';
        if ($projects == 'on') {
            $filter .= "post_type = 'projects'";
            $donefilter = true;
        }
        if ($pages == 'on') {
            if ($donefilter) {
                $filter .= " or ";
            }
            $filter .= "post_type = 'page'";
            $donefilter = true;
        }
        if ($tasks == 'on') {
            if ($donefilter) {
                $filter .= " or ";
            }
            $filter .= "post_type = 'task'";
            $donefilter = true;
        }
        if ($vacancies == 'on') {
            if ($donefilter) {
                $filter .= " or ";
            }
            $filter .= "post_type = 'vacancies'";
            $donefilter = true;
        }
        if ($news == 'on') {
            if ($donefilter) {
                $filter .= " or ";
            }
            $filter .= "post_type = 'news'";
            $donefilter = true;
        }
        if ($blog == 'on') {
            if ($donefilter) {
                $filter .= " or ";
            }
            $filter .= "post_type = 'blog'";
            $donefilter = true;
        }
        if ($events == 'on') {
            if ($donefilter) {
                $filter .= " or ";
            }
            $filter .= "post_type = 'event'";
            $donefilter = true;
        }
        if ($lastupdated == 'on') {
            $checkdate = 'post_modified';
        } else {
            $checkdate = 'post_date';
        }
        $q = "\n\tselect * \n\tfrom wp_posts \n\twhere (" . $filter . ") and post_status = 'publish'\n\torder by " . $checkdate . " desc\n\tlimit 50;\n\t";
        global $wpdb;
        $rpublished = $wpdb->get_results($q);
        echo "<ul>";
        $k = 0;
        foreach ($rpublished as $r) {
            if ($r->post_type == 'page') {
                if (in_array($r->post_name, array('how-do-i', 'task-by-category', 'news-by-category', 'newspage', 'tagged', 'atoz', 'about', 'home', 'blogs', 'events'))) {
                    continue;
                }
                $k++;
                echo "<li><a href='" . $r->guid . "'>" . govintranetpress_custom_title(get_the_title($r->ID)) . "</a></li>";
            }
            if ($r->post_type == 'task') {
                $taskpod = new Pod('task', $r->ID);
                if ($taskpod->get_field('page_type') == 'Task') {
                    $k++;
                    echo "<li><a href='" . site_url() . "/task/" . $taskpod->get_field('slug') . "/'>" . govintranetpress_custom_title($taskpod->get_field('post_title')) . "</a></li>";
                } else {
                    if ($taskpod->get_field('page_type') == 'Guide header') {
                        $k++;
                        echo "<li><a href='" . site_url() . "/task/" . $taskpod->get_field('slug') . "/'>" . govintranetpress_custom_title($taskpod->get_field('post_title')) . "</a></li>";
                    } else {
                        $k++;
                        $pguide = $taskpod->get_field('parent_guide');
                        $ptaskpod = new Pod('task', $pguide[0]['ID']);
                        echo "<li><a href='" . site_url() . "/task/" . $taskpod->get_field('slug') . "/'>" . govintranetpress_custom_title($taskpod->get_field('post_title')) . " <small>(" . govintranetpress_custom_title($ptaskpod->get_field('post_title')) . ")</small></a></li>";
                    }
                }
            }
            if ($r->post_type == 'projects') {
                $projpod = new Pod('projects', $r->ID);
                if (!$projpod->get_field('parent_project')) {
                    $k++;
                    echo "<li><a href='" . site_url() . "/projects/" . $projpod->get_field('slug') . "/'>" . govintranetpress_custom_title($projpod->get_field('post_title')) . "</a></li>";
                }
            }
            if ($r->post_type == 'vacancies') {
                $k++;
                $vacpod = new Pod('vacancies', $r->ID);
                echo "<li><a href='" . site_url() . "/vacancies/" . $vacpod->get_field('slug') . "/'>" . govintranetpress_custom_title($vacpod->get_field('post_title')) . "</a></li>";
            }
            if ($r->post_type == 'news') {
                $k++;
                $vacpod = new Pod('news', $r->ID);
                echo "<li><a href='" . site_url() . "/news/" . $vacpod->get_field('slug') . "/'>" . govintranetpress_custom_title($vacpod->get_field('post_title')) . "</a></li>";
            }
            if ($r->post_type == 'blog') {
                $k++;
                $vacpod = new Pod('blog', $r->ID);
                echo "<li><a href='" . site_url() . "/blog/" . $vacpod->get_field('slug') . "/'>" . govintranetpress_custom_title($vacpod->get_field('post_title')) . "</a></li>";
            }
            if ($r->post_type == 'event') {
                $k++;
                $vacpod = new Pod('event', $r->ID);
                echo "<li><a href='" . site_url() . "/event/" . $vacpod->get_field('slug') . "/'>" . govintranetpress_custom_title($vacpod->get_field('post_title')) . "</a></li>";
            }
            if ($k == $items) {
                break;
            }
        }
        echo "</ul>";
        wp_reset_query();
        ?>





              <?php 
        echo $after_widget;
        ?>
        <?php 
    }
Пример #26
0
         }
         echo '<span class="small"><a href="mailto:' . $user_info->user_email . '">' . __('Email', 'govintranet') . ' ' . $user_info->first_name . '</a></small></p></div></div></div>';
         $counter++;
         $tcounter++;
         //end full details
     } else {
         echo "<div class='col-lg-4 col-md-4 col-sm-6 pgrid-item'><div class='indexcard'><a href='" . $userurl . "'><div class='media'>" . $avatarhtml . "<div class='media-body'><strong>" . $displayname . "</strong><br>";
         // display team name(s)
         $team = get_user_meta($userid, 'user_team', true);
         if ($team) {
             foreach ((array) $team as $t) {
                 if ($t == $post->ID) {
                     continue;
                 }
                 $theme = get_post($t);
                 echo govintranetpress_custom_title($theme->post_title) . "<br>";
             }
         }
         if (get_user_meta($userid, 'user_job_title', true)) {
             echo '<span class="small">' . get_user_meta($userid, 'user_job_title', true) . "</span><br>";
         }
         if (get_user_meta($userid, 'user_telephone', true)) {
             echo '<span class="small"><i class="dashicons dashicons-phone"></i> ' . get_user_meta($userid, 'user_telephone', true) . "</span><br>";
         }
         if (get_user_meta($userid, 'user_mobile', true) && $showmobile) {
             echo '<span class="small"><i class="dashicons dashicons-smartphone"></i> ' . get_user_meta($userid, 'user_mobile', true) . "</span>";
         }
         echo "</div></div></div></div></a>";
         $counter++;
     }
 }
Пример #27
0
        }
        //get anything related to this post
        $otherrelated = get_posts(array('post_type' => array('task', 'news', 'project', 'vacancy', 'blog', 'team', 'event'), 'posts_per_page' => -1, 'exclude' => $related, 'meta_query' => array(array('key' => 'related', 'compare' => 'LIKE', 'value' => '"' . $id . '"'))));
        foreach ($otherrelated as $o) {
            if ($o->post_status == 'publish' && $o->ID != $id) {
                $taskparent = $o->post_parent;
                if ($taskparent && in_array($rlink->post_type, array('task', 'project', 'team'))) {
                    $tparent_guide_id = $taskparent;
                    if ($tparent_guide_id) {
                        $taskparent = get_post($tparent_guide_id);
                    }
                    if ($taskparent) {
                        $title_context = " (" . govintranetpress_custom_title($taskparent->post_title) . ")";
                    }
                }
                $html .= "<li><a href='" . get_permalink($rlink->ID) . "'>" . govintranetpress_custom_title($rlink->post_title) . $title_context . "</a></li>";
            }
        }
        if ($related || $otherrelated) {
            echo "<div class='widget-box list'>";
            echo "<h3 class='widget-title'>Related</h3>";
            echo "<ul>";
            echo $html;
            echo "</ul></div>";
        }
        ?>
	</div>

<?php 
    }
}
Пример #28
0
    echo '<h3 class="contacthead">Team</h3>';
    $teamlist = array();
    //build array of hierarchical teams
    foreach ((array) $teams as $t) {
        $team = get_post($t);
        $teamid = $team->ID;
        $teamurl = $team->post_name;
        $teamparent = $team->post_parent;
        while ($teamparent != 0) {
            $parentteam = get_post($teamparent);
            $parentURL = $parentteam->post_name;
            $parentname = govintranetpress_custom_title($parentteam->post_title);
            $teamlist[] = " <a href='" . site_url() . "/team/{$parentURL}/'>" . $parentname . "</a>";
            $teamparent = $parentteam->post_parent;
        }
        $teamlist[] = " <a href='" . site_url() . "/team/{$teamurl}/'>" . govintranetpress_custom_title($team->post_title) . "</a>";
        echo "<strong>Team:</strong> " . implode(" &raquo; ", $teamlist) . "<br>";
        $teamlist = array();
    }
}
$jt = get_user_meta($user_id, 'user_job_title', true);
if ($jt) {
    echo "<strong>Job title: </strong>" . $jt . "<br>";
}
$jt = get_user_meta($user_id, 'user_grade', true);
if ($jt) {
    $jt = get_term($jt, 'grade', ARRAY_A);
    if ($jt['name']) {
        echo "<strong>Grade: </strong>" . $jt['name'] . "";
    }
}
Пример #29
0
         $taskparent = get_post($taskpod);
         $title_context = '';
         if ($taskparent) {
             $title_context = " (" . govintranetpress_custom_title($taskparent->post_title) . ")";
         }
     }
 }
 if ($post_type == 'Project') {
     $context = "project";
     $contexturl = "/about/projects/";
     $icon = "road";
     $projparent = $post->post_parent;
     $title_context = '';
     if ($projparent) {
         $projparent = get_post($projparent);
         $title_context = " (" . govintranetpress_custom_title($projparent->post_title) . ")";
     }
 }
 if ($post_type == 'News') {
     $context = "news";
     $contexturl = "/news/";
     $icon = "star-empty";
 }
 if ($post_type == 'Vacancy') {
     $context = "job vacancy";
     $contexturl = "/about/vacancies/";
     $icon = "random";
 }
 if ($post_type == 'Blog') {
     $context = "blog";
     $contexturl = "/blog/";
Пример #30
0
        }
        if ('open' == $post->comment_status) {
            comments_template('', true);
        }
        ?>
</div> <!--end of first column-->

<div class="col-lg-4 col-md-4 col-sm-4">	

	<?php 
        $podtask = new Pod('projects', $id);
        $related_links = $podtask->get_field('related_projects');
        $html = '';
        foreach ($related_links as $rlink) {
            if ($rlink['post_status'] == 'publish' && $rlink['ID'] != $id) {
                $html .= "<li><a href='" . site_url() . "/projects/" . $rlink['post_name'] . "'>" . govintranetpress_custom_title($rlink['post_title']) . "</a></li>";
            }
        }
        if (taxonomy_exists('team')) {
            $relatedteams = get_the_terms($id, 'team');
        }
        if ($relatedteams) {
            foreach ($relatedteams as $r) {
                $html .= "<li><a href='" . site_url() . "/team/" . $r->slug . "'>" . $r->name . "</a>&nbsp;<span class='glyphicon glyphicon-list-alt'></span></li>";
            }
        }
        if ($html) {
            echo "<div class='widget-box list'>";
            echo "<h3 class='wid\t\tget-title'>Related</h3>";
            echo "<ul>";
            echo $html;