Example #1
0
/**
 * Fix active class in nav for shop page.
 *
 * @param array $menu_items
 * @param array $args
 * @return array
 */
function projects_nav_menu_item_classes($menu_items, $args)
{
    if (!is_projects()) {
        return $menu_items;
    }
    $projects_page = (int) projects_get_page_id('projects');
    $page_for_posts = (int) get_option('page_for_posts');
    foreach ((array) $menu_items as $key => $menu_item) {
        $classes = (array) $menu_item->classes;
        // Unset active class for blog page
        if ($page_for_posts == $menu_item->object_id) {
            $menu_items[$key]->current = false;
            if (in_array('current_page_parent', $classes)) {
                unset($classes[array_search('current_page_parent', $classes)]);
            }
            if (in_array('current-menu-item', $classes)) {
                unset($classes[array_search('current-menu-item', $classes)]);
            }
            // Set active state if this is the shop page link
        } elseif (is_projects() && $projects_page == $menu_item->object_id) {
            $menu_items[$key]->current = true;
            $classes[] = 'current-menu-item';
            $classes[] = 'current_page_item';
            // Set parent state if this is a product page
        } elseif (is_singular('project') && $projects_page == $menu_item->object_id) {
            $classes[] = 'current_page_parent';
        }
        $menu_items[$key]->classes = array_unique($classes);
    }
    return $menu_items;
}
/**
 * Add body classes for Projects pages
 *
 * @param  array $classes
 * @return array
 */
function woo_projects_body_class($classes)
{
    $classes = (array) $classes;
    if (is_projects()) {
        $classes[] = 'projects';
        $classes[] = 'projects-page';
    }
    if (is_project()) {
        $attachments = count(projects_get_gallery_attachment_ids());
        if ($attachments > 0) {
            $classes[] = 'has-gallery';
        } else {
            $classes[] = 'no-gallery';
        }
        if (!has_post_thumbnail()) {
            $classes[] = 'no-cover-image';
        }
    }
    return array_unique($classes);
}
Example #3
0
		<?php 
    next_post_link('<div id="single-nav-left">%link</div>', '<i class="fa fa-chevron-right"></i>', false);
    ?>
	</nav><!-- /single-nav -->

		<?php 
    corpobox_breadcrumb();
}
?>

<?php 
/**
 * Template Projects
 */
if (class_exists('Projects')) {
    if (is_projects() && !is_single()) {
        ?>
			<h1 class="page-title"><?php 
        projects_page_title();
        ?>
</h1>
			<div class="taxonomy-description"><?php 
        do_action('projects_archive_description');
        ?>
</div>
<?php 
    }
}
?>

<?php