示例#1
0
 *
 */
?>

<?php 
get_header();
?>

<div class="box-container">
<div class="box">

<?php 
// The single page is a wordpress built-in, therefore we can't get
// the page custom field section like normal, so use the constants since
// we already know for sure it's part of news
$ikit_section_news = ikit_get_post_by_slug(IKIT_SLUG_IKIT_SECTION_NEWS, IKIT_POST_TYPE_IKIT_SECTION);
ikit_one_render_banner_header($ikit_section_news);
?>

<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        global $id;
        ?>

    <div class="box-section">

        <div class="box-top-empty-spacer"></div>

        <div class="box-section-title"><h1><?php 
/**
 * Reads in the pages RSS feed as determined by the settings
 * and adds/updates/deletes based on that feed, also sets
 * the external source for the item so that it doesn't get deleted
 * or edited by the user. The page content can then be placed
 * within other pages using the ikit page shortcode.
 */
function ikit_national_remote_fetch_page()
{
    $page_feed_url = IKIT_NATIONAL_FEED_PAGE_URL;
    // Use SimplePie to parse the feeds
    // note that we turn off cacheing, because this fetch
    // is called at the proper interval and should always
    // be freshest
    $feed = new SimplePie();
    $feed->set_feed_url($page_feed_url);
    $feed->enable_cache(false);
    $feed->strip_attributes(false);
    $feed->init();
    $feed->handle_content_type();
    $feed_page_slugs = array();
    foreach ($feed->get_items() as $item) {
        $page_title = $item->get_title();
        $page_description = $item->get_description();
        // Extract the slug
        $page_slug_el = $item->get_item_tags(IKIT_XML_NAMESPACE_URI, 'pageSlug');
        $page_slug = $page_slug_el[0]['data'];
        $feed_page_slugs[$page_slug] = true;
        // Add or update existing sponsor
        $associated_post = array('post_title' => $page_title, 'post_name' => $page_slug, 'post_type' => 'page', 'post_status' => 'publish', 'post_content' => $page_description);
        $existing_associated_post = ikit_get_post_by_slug($page_slug, 'page');
        if ($existing_associated_post == null) {
            $new_associated_post_id = wp_insert_post($associated_post);
            if ($new_associated_post_id > 0) {
                // Add custom fields
                add_post_meta($new_associated_post_id, IKIT_CUSTOM_FIELD_GENERIC_EXTERNAL_SOURCE, IKIT_EXTERNAL_SOURCE_NATIONAL, true);
            }
        } else {
            $associated_post['ID'] = $existing_associated_post->ID;
            $updated_associated_post_id = wp_update_post($associated_post);
            if ($updated_associated_post_id > 0) {
                ikit_add_or_update_post_meta($updated_associated_post_id, IKIT_CUSTOM_FIELD_GENERIC_EXTERNAL_SOURCE, IKIT_EXTERNAL_SOURCE_NATIONAL, true);
            }
        }
    }
    if (count($feed_page_slugs) > 0 && count($feed->get_items()) == count($feed_page_slugs)) {
        // Safety check to not just delete randomly, should be at least one page in the feed
        // Delete any non-existing sponsors marked with same external source
        $args = array('post_type' => 'page', 'meta_key' => IKIT_CUSTOM_FIELD_GENERIC_EXTERNAL_SOURCE, 'meta_value' => IKIT_EXTERNAL_SOURCE_NATIONAL);
        $pages = get_posts($args);
        foreach ($pages as $page) {
            if (array_key_exists($page->post_name, $feed_page_slugs) == false) {
                // Delete
                wp_delete_post($page->ID, true);
            }
        }
    }
}
示例#3
0
    </td>
    <td class="header-col2">
        <a class="header-nav-menu-button" href="javascript:void(0);">Menu</a>
    </td>
    </tr>
    </table>

</div>

<?php 
if (is_home() || is_front_page()) {
    ?>

<?php 
    $image_gallery_featured = ikit_get_post_by_slug(IKIT_SLUG_IKIT_IMAGE_GALLERY_FEATURED, IKIT_POST_TYPE_IKIT_IMAGE_GALLERY);
    $image_gallery = get_field(IKIT_CUSTOM_FIELD_IKIT_IMAGE_GALLERY_IMAGE_GALLERY, $image_gallery_featured->ID);
    if ($image_gallery_featured->post_status == 'publish' && count($image_gallery) > 0) {
        ?>

<div class="feature">

    <div class="image-gallery flex-container hero-image" image_gallery_type="featured" image_gallery_autoplay="<?php 
        if ($g_theme_options[IKIT_TWO_THEME_OPTION_FEATURED_IMAGE_GALLERY_AUTOPLAY]) {
            echo "true";
        } else {
            echo "false";
        }
        ?>
">
示例#4
0
function ikit_updates()
{
    // 20150608, update the eyeondesign feed
    if (!get_option('ikit_update_eyeondesign_feed_20150608')) {
        update_option('ikit_update_eyeondesign_feed_20150608', 1);
        ikit_social_remote_fetch_eyeondesign_rss();
    }
    // 20150505, change the page template of "events" to use the table of contents
    // this is okay for ikit one and two themes
    if (!get_option('ikit_update_events_template_20150505')) {
        update_option('ikit_update_events_template_20150505', 1);
        $events_page = get_page_by_path('events');
        if ($events_page != null) {
            print_r($events_page);
            update_post_meta($events_page->ID, '_wp_page_template', 'section_toc.php');
        }
    }
    // 20141030, update the membership rates page template
    if (!get_option('ikit_update_membershiprates_template_20141030')) {
        update_option('ikit_update_membershiprates_template_20141030', 1);
        $membership_rates_page = get_page_by_path(IKIT_SLUG_PAGE_MEMBERSHIP . '/' . IKIT_SLUG_PAGE_MEMBERSHIP_RATES);
        if ($membership_rates_page != null) {
            update_post_meta($membership_rates_page->ID, '_wp_page_template', 'membership_rates.php');
        }
    }
    // 20120809, update the menu items
    if (!get_option('ikit_update_menu_items_20120809')) {
        update_option('ikit_update_menu_items_20120809', 1);
        $nav_menu_locations = get_nav_menu_locations();
        $nav_menu = wp_get_nav_menu_object($nav_menu_locations['nav-menu-main']);
        $nav_menu_items = wp_get_nav_menu_items($nav_menu->term_id);
        foreach ((array) $nav_menu_items as $key => $nav_menu_item) {
            // Correct the link for Living Principles (it has an extra http// in it)
            if ($nav_menu_item->title == 'The Living Princples') {
                $post = array();
                $post['ID'] = $nav_menu_item->ID;
                $post['post_title'] = 'The Living Principles';
                wp_update_post($post);
                ikit_add_or_update_post_meta($nav_menu_item->ID, '_menu_item_url', 'http://www.livingprinciples.org/', true);
            }
        }
    }
    // 20120621, add a one time flush rewrite as permalink
    // structure changed for event single and job single.
    if (!get_option('ikit_update_flush_rewrite_rules_20120621')) {
        update_option('ikit_update_flush_rewrite_rules_20120621', 1);
        flush_rewrite_rules();
    }
    // 20120710, update the menu items
    if (!get_option('ikit_update_menu_items_20120710')) {
        update_option('ikit_update_menu_items_20120710', 1);
        $nav_menu_locations = get_nav_menu_locations();
        $nav_menu = wp_get_nav_menu_object($nav_menu_locations['nav-menu-main']);
        $nav_menu_items = wp_get_nav_menu_items($nav_menu->term_id);
        foreach ((array) $nav_menu_items as $key => $nav_menu_item) {
            // Update events archive to past events
            if ($nav_menu_item->title == 'Events Archive') {
                $post = array();
                $post['ID'] = $nav_menu_item->ID;
                $post['post_title'] = 'Past Events';
                wp_update_post($post);
            }
            // Delete Design Forum; it no longer exists.
            if ($nav_menu_item->title == 'Design Forum') {
                wp_delete_post($nav_menu_item->ID);
            }
            // Change the link for Design & Business to  http://www.aiga.org/Resources/
            if ($nav_menu_item->title == 'Design & Business') {
                ikit_add_or_update_post_meta($nav_menu_item->ID, '_menu_item_url', 'http://www.aiga.org/resources/', true);
            }
            // Change Design Salary Survey to AIGA | Aquent Survey of Design Salaries
            if ($nav_menu_item->title == 'Design Salary Survey') {
                $post = array();
                $post['ID'] = $nav_menu_item->ID;
                $post['post_title'] = 'AIGA | Aquent Survey of Design Salaries';
                wp_update_post($post);
            }
            // Correct the link for Living Principles (it has an extra http// in it)
            if ($nav_menu_item->title == 'Living Principles') {
                ikit_add_or_update_post_meta($nav_menu_item->ID, '_menu_item_url', 'http://www.livingprinciples.org/', true);
            }
        }
    }
    // 20130128, delete all acf groups, we will use the code instead to register them so they are easily updateable
    if (!get_option('ikit_update_acf_20130128')) {
        update_option('ikit_update_acf_20130128', 1);
        ikit_delete_posts('acf');
    }
    // 20130203, update the slug of the featured image gallery if not set properly
    if (!get_option('ikit_update_image_gallery_featured_20130203')) {
        update_option('ikit_update_image_gallery_featured_20130203', 1);
        $args = array('post_type' => IKIT_POST_TYPE_IKIT_IMAGE_GALLERY);
        $posts = get_posts($args);
        foreach ($posts as $post) {
            if ($post->post_name = 'featured') {
                $post->post_name = IKIT_SLUG_IKIT_IMAGE_GALLERY_FEATURED;
                wp_update_post($post);
                break;
            }
        }
    }
    // 20130206, add member directory page, and then assign to about us menu
    if (!get_option('ikit_update_member_directory_20130206')) {
        global $g_options;
        // Only perform is an imus chapter is set, otherwise
        // we would display to users a blank members page
        $imus_chapter = null;
        if (ikit_isset_not_empty($g_options[IKIT_PLUGIN_OPTION_FILTER_IKIT_IMUS_CHAPTER])) {
            update_option('ikit_update_member_directory_20130206', 1);
            $member_directory_page = ikit_get_post_by_slug(IKIT_SLUG_PAGE_MEMBER_DIRECTORY, 'page');
            if ($member_directory_page == null) {
                // Create member directory page
                $member_directory_page['post_type'] = 'page';
                $member_directory_page['post_status'] = 'publish';
                $member_directory_page['post_title'] = 'Member Directory';
                $member_directory_page['post_name'] = IKIT_SLUG_PAGE_MEMBER_DIRECTORY;
                // Assign about us as parent
                $membership_page = ikit_get_post_by_slug(IKIT_SLUG_PAGE_MEMBERSHIP, 'page');
                $member_directory_page['post_parent'] = $membership_page->ID;
                $member_directory_page_id = wp_insert_post($member_directory_page);
                if ($member_directory_page_id == 0) {
                    // If error, try again next time
                    update_option('ikit_update_member_directory_20130206', 0);
                } else {
                    // Assign member directory template
                    update_post_meta($member_directory_page_id, '_wp_page_template', 'member_directory.php');
                    // Add to about us menu item
                    $nav_menu_locations = get_nav_menu_locations();
                    $nav_menu = wp_get_nav_menu_object($nav_menu_locations['nav-menu-main']);
                    $nav_menu_items = wp_get_nav_menu_items($nav_menu->term_id);
                    foreach ((array) $nav_menu_items as $key => $nav_menu_item) {
                        if ($nav_menu_item->title == 'Membership') {
                            wp_update_nav_menu_item($nav_menu->term_id, 0, array('menu-item-title' => __('Member Directory'), 'menu-item-parent-id' => $nav_menu_item->ID, 'menu-item-object' => 'page', 'menu-item-object-id' => $member_directory_page_id, 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish'));
                            break;
                        }
                    }
                    // Force pull of member feed
                    // ikit_national_remote_fetch_member_feed();
                }
            }
        }
    }
    // 20130212, update member directory
    if (!get_option('ikit_update_member_directory_20130212')) {
        update_option('ikit_update_member_directory_20130212', 1);
        // Force pull of member feed
        // ikit_national_remote_fetch_member_feed();
    }
    // 20130213, update member directory post NimbleUser fix
    if (!get_option('ikit_update_member_directory_20130213')) {
        update_option('ikit_update_member_directory_20130213', 1);
        // Force pull of member feed
        // ikit_national_remote_fetch_member_feed();
    }
    // 20130219, update member directory as 999 limit was too small for certain chapters
    if (!get_option('ikit_update_member_directory_20130219')) {
        update_option('ikit_update_member_directory_20130219', 1);
        // Force pull of member feed
        // ikit_national_remote_fetch_member_feed();
    }
    // 20130227, update about description to be 67 chapters
    if (!get_option('ikit_update_about_description_20130227')) {
        update_option('ikit_update_about_description_20130227', 1);
        $nav_menu_locations = get_nav_menu_locations();
        $nav_menu = wp_get_nav_menu_object($nav_menu_locations['nav-menu-main']);
        $nav_menu_items = wp_get_nav_menu_items($nav_menu->term_id);
        foreach ((array) $nav_menu_items as $key => $nav_menu_item) {
            // Update events archive to past events
            if ($nav_menu_item->title == 'About Us') {
                $updated_post_content = str_replace('66', '67', $nav_menu_item->post_content);
                $nav_menu_item->post_content = $updated_post_content;
                wp_update_post($nav_menu_item);
                break;
            }
        }
    }
    // 20130408, update member directory as there is now a new database for it
    if (!get_option('ikit_update_member_database_20130408')) {
        update_option('ikit_update_member_database_20130408', 1);
        ikit_member_remote_fetch();
    }
    // 20130521, recover from error with datagram where can't access chapters.aiga.org portfolio feed, so truncated portfolios, this update checks if no portfolios, and if so repopulates
    if (!get_option('ikit_update_portfolios_if_empty_20130521')) {
        update_option('ikit_update_portfolios_if_empty_20130521', 1);
        global $wpdb;
        $project_table_name = $wpdb->prefix . IKIT_PORTFOLIO_PROJECT_TABLE_NAME;
        $rows_affected = $wpdb->query("select * from {$project_table_name}");
        if ($rows_affected == 0) {
            ikit_portfolio_remote_fetch();
        }
    }
    // 20130624, set the status of published events to 'Live', future pulls will auto-set from etouches
    // note that we know published events are either 'Live' or 'Sold Out', either of which are fine to display
    if (!get_option('ikit_update_event_status_published_to_live_20130624')) {
        update_option('ikit_update_event_status_published_to_live_20130624', 1);
        // Get the sponsors
        $args = array('numberposts' => 999, 'offset' => 0, 'order' => 'ASC', 'post_type' => IKIT_POST_TYPE_IKIT_EVENT, 'post_status' => 'publish');
        $events = get_posts($args);
        foreach ($events as $event) {
            ikit_add_or_update_post_meta($event->ID, IKIT_CUSTOM_FIELD_IKIT_EVENT_STATUS, 'Live', true);
        }
    }
    // 20131017, save the post orderings, this is a special meta field which holds
    // a special ordering field that can be used to order events and posts, the
    // new display priority field will appear for admins for events and posts
    if (!get_option('ikit_update_save_post_orderings_20131017')) {
        update_option('ikit_update_save_post_orderings_20131017', 1);
        ikit_save_post_orderings();
    }
    // 20131101, update wp_ikit_event entries with service eventbrite
    if (!get_option('ikit_update_eventdb_setservice_20131101')) {
        update_option('ikit_update_eventdb_setservice_20131101', 1);
        global $wpdb;
        $event_table_name = $wpdb->prefix . IKIT_EVENT_ETOUCHES_TABLE_NAME;
        $wpdb->query("update {$event_table_name} set service = 'etouches'");
    }
    // 20131101, update event service meta for existing events
    if (!get_option('ikit_update_eventservicemeta_20131101')) {
        update_option('ikit_update_eventservicemeta_20131101', 1);
        $events = get_posts(array('post_type' => array(IKIT_POST_TYPE_IKIT_EVENT), 'posts_per_page' => 9999));
        foreach ($events as $event) {
            ikit_add_or_update_post_meta($event->ID, IKIT_CUSTOM_FIELD_IKIT_EVENT_SERVICE, IKIT_EVENT_SERVICE_ETOUCHES, true);
        }
    }
    // 20131105, update the member id to a varchar instead of int, as it has leading zeroes, so refresh the feed
    if (!get_option('ikit_update_updatedmemberid_20131105')) {
        update_option('ikit_update_updatedmemberid_20131105', 1);
        ikit_member_remote_fetch();
    }
    // 20130227, update about description to be 67 chapters
    if (!get_option('ikit_update_about_description_20140712')) {
        update_option('ikit_update_about_description_20140712', 1);
        $nav_menu_locations = get_nav_menu_locations();
        $nav_menu = wp_get_nav_menu_object($nav_menu_locations['nav-menu-main']);
        $nav_menu_items = wp_get_nav_menu_items($nav_menu->term_id);
        foreach ((array) $nav_menu_items as $key => $nav_menu_item) {
            // Update events archive to past events
            if ($nav_menu_item->title == 'About Us') {
                $updated_post_content = str_replace('67', '68', $nav_menu_item->post_content);
                $nav_menu_item->post_content = $updated_post_content;
                wp_update_post($nav_menu_item);
                break;
            }
        }
    }
    // 20141119, update about description to be 69 chapters
    if (!get_option('ikit_update_about_description_20141119')) {
        update_option('ikit_update_about_description_20141119', 1);
        $nav_menu_locations = get_nav_menu_locations();
        $nav_menu = wp_get_nav_menu_object($nav_menu_locations['nav-menu-main']);
        $nav_menu_items = wp_get_nav_menu_items($nav_menu->term_id);
        foreach ((array) $nav_menu_items as $key => $nav_menu_item) {
            // Update events archive to past events
            if ($nav_menu_item->title == 'About Us') {
                $updated_post_content = str_replace('67', '69', $nav_menu_item->post_content);
                $nav_menu_item->post_content = $updated_post_content;
                wp_update_post($nav_menu_item);
                $updated_post_content = str_replace('68', '69', $nav_menu_item->post_content);
                $nav_menu_item->post_content = $updated_post_content;
                wp_update_post($nav_menu_item);
                break;
            }
        }
    }
}
$args['meta_key'] = IKIT_CUSTOM_FIELD_GENERIC_ORDERING_DISPLAY_PRIORITY;
$args['meta_query'] = array(array('key' => IKIT_CUSTOM_FIELD_IKIT_EVENT_END_DATE, 'value' => date_i18n("Y-m-d"), 'compare' => '>=', 'type' => 'DATE'), array('key' => IKIT_CUSTOM_FIELD_IKIT_EVENT_STATUS, 'value' => 'Closed', 'compare' => '!=', 'type' => 'CHAR'));
query_posts($args);
// If no featured, show latest
if (have_posts() == false) {
    $args['category_name'] = null;
    query_posts($args);
}
if (have_posts()) {
    ?>

    <div class="box-container index-featured-events">
    <div class="box">

    <?php 
    $ikit_section_events = ikit_get_post_by_slug(IKIT_SLUG_IKIT_SECTION_EVENT, IKIT_POST_TYPE_IKIT_SECTION);
    ikit_one_render_banner_header($ikit_section_events);
    while (have_posts()) {
        the_post();
        global $id;
        $ikit_event_meta = ikit_event_get_meta($id);
        $event_image = ikit_event_get_image_url($id, $ikit_event_meta, ikit_one_get_event_image_default());
        $event_start_date = mysql2date('l, F j, Y', get_gmt_from_date($ikit_event_meta->start_date), false);
        $event_end_date = mysql2date('l, F j, Y', get_gmt_from_date($ikit_event_meta->end_date), false);
        $event_description = $ikit_event_meta->description;
        $event_location_city = null;
        $event_url = get_permalink($id);
        $event_url_target = '_self';
        if ($ikit_event_meta->service == IKIT_EVENT_SERVICE_EVENTBRITE) {
            $event_location_city = $ikit_event_meta->venue_city;
            $event_description = ikit_strip_style_attributes($event_description);
 */
?>

<?php 
get_header();
?>

<div class="box-container">
<div class="box">
<div class="box-top-empty-spacer"></div>

<?php 
// The single page is a wordpress built-in, therefore we can't get
// the page custom field section like normal, so use the constants since
// we already know for sure it's part of news
$ikit_section_jobs = ikit_get_post_by_slug(IKIT_SLUG_IKIT_SECTION_JOB, IKIT_POST_TYPE_IKIT_SECTION);
ikit_one_render_banner_header($ikit_section_jobs);
?>

<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        global $id;
        $ikit_job_meta = ikit_job_get_meta($id);
        ?>

    <div class="box-section">


/**
 * Insert post content given post slug and optional post type
 */
function ikit_post_content_shortcode($atts)
{
    extract(shortcode_atts(array('slug' => null, 'post_type' => 'post'), $atts));
    $post = ikit_get_post_by_slug($slug, $post_type);
    return $post->post_content;
}