adding custom product category plugin
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 16 Dec 2015 14:22:57 +0000 (09:22 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 16 Dec 2015 14:22:57 +0000 (09:22 -0500)
archive-miproduct.php [new file with mode: 0644]
archive.php
functions.php
parts/top-bar.php
single-miproduct.php [new file with mode: 0644]

diff --git a/archive-miproduct.php b/archive-miproduct.php
new file mode 100644 (file)
index 0000000..39e1547
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+/**
+ * Template Name: Page of Products
+ *
+ * Selectable from a dropdown menu on the edit page screen.
+ */
+?>
+<?php get_header(); ?>
+<main class="blog-archive">
+    
+    <article <?php post_class() ?> id="interior">
+
+    </article>
+    <div class="row">
+     
+    <li id="categories">
+        <h2><?php _e( 'Categories:' ); ?></h2>
+        <form id="category-select" class="category-select" action="<?php echo esc_url( home_url( '/' ) ); ?>" method="get">
+            <?php wp_dropdown_categories( array(
+               
+                'taxonomy'        => 'michsci_category',
+              
+                'hierarchical'    => true,
+                
+                'hide_empty'      => true
+                ) ); ?>
+            <input type="submit" name="submit" value="view" />
+        </form>
+    </li>
+        <div id="blog-posts-over" class="small-12 medium-3 columns">
+            <?php if(have_posts()) : while(have_posts()): the_post();?>
+           
+            <div class="row content blog-posts-container product">
+             
+                <div class="small-11 columns">
+                    <?php if( count(get_post_ancestors($post->ID)) == 0 ) { ?>
+                    <article id="<?php the_ID()?>" <?php post_class()?>>
+                    
+                        <header class="entry-header">
+                         <h1 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h1>
+                <!--                            <span class="meta date"><?php //the_time('F jS, Y') ?></span>-->
+                </header>
+                        <?php $thumbnail = get_the_post_thumbnail($post->ID, 'blog-feed-front'); ?>
+                        <?php echo $thumbnail; ?>
+                       <?php } ?>
+                   
+                    
+                       
+<!--                     
+                        <?php echo (function_exists('the_advanced_excerpt')) ? the_advanced_excerpt(): the_excerpt(); ?>
+                        <footer class="entry-meta small-12 medium-6 medium-push-3 center">
+                            <?php $post_categories = wp_get_post_categories( get_the_ID() );
+                            $cats = array();
+                            echo 'This entry was posted ';
+                            if (has_category()) {
+                                echo 'in';
+                                foreach($post_categories as $c){
+                         
+                                    $cat = get_category( $c );
+                                    $cats[] = array( 'name' => $cat->name, 'slug' => $cat->slug );
+                                    echo ', <a rel="category" title="View all posts in '. $cat->name . ' " href="'. $cat->slug .'">'. $cat->name .'</a>';
+                                }
+                                echo '.';
+                            }
+                            ?>
+                        </footer>
+-->
+                    </article>
+                </div>
+            </div>
+            <?php endwhile; ?>
+            <div class="navigation">
+                <span class="newer"><?php previous_posts_link(__('« Newer','example')) ?></span> <span class="older"><?php next_posts_link(__('Older »','example')) ?></span>
+            </div><!-- /.navigation -->
+            <?php else: ?>
+            <div id="post-404" class="noposts">
+                <p><?php _e('Sorry, no results were found.');?></p>
+            </div><!-- /#post-404 -->
+            <?php endif;?>
+        </div>
+       
+    </div>
+    <?php get_footer(); ?>
index 1f706c9..93e336f 100644 (file)
@@ -1,7 +1,7 @@
 <?php get_header(); ?>
 <main class="blog-archive">
     <article <?php post_class() ?> id="interior">
-        <?php GLM_get_header(); ?>
+        
     </article>
     <div class="row">
         <div id="blog-posts-over" class="small-12 medium-9 columns">
index 6d3e572..37a59c5 100644 (file)
@@ -24,6 +24,7 @@ if (!function_exists('glm_quicksite_widget_init')) {
 
 }
 
+
 /**
  * get_menu_options
  *
@@ -40,7 +41,7 @@ function glm_get_menu_options()
     return $menu_options;
 }
 
-/**
+
 register_nav_menus(array(
   'top-bar' => 'Site Navigation',
   //'mobile-off-canvas' => 'Mobile',
@@ -60,7 +61,7 @@ if ( ! function_exists( 'michsci_top_bar' ) ) {
           'after' => '',                                  // after each link </a>
           'link_before' => '',                            // before each link text
           'link_after' => '',                             // after each link text
-          'depth' => 3,                                   // limit the depth of the nav
+                                            // limit the depth of the nav
           'fallback_cb' => false,                         // fallback function (see below)
           'walker' => new MichiganSci_Top_Bar_Walker()
       ));
@@ -81,7 +82,7 @@ class MichiganSci_Top_Bar_Walker extends Walker_Nav_Menu {
        }
 }
 endif;
-*/    
+
 /**
  * glm_page_menu
  *
@@ -276,3 +277,6 @@ function mytheme_search_loop() {
 add_action('thematic_searchloop', 'mytheme_search_loop');
 // End of the Contextual/Highlight Search functions
 ?>
+
+
+
index d154377..23e9429 100644 (file)
@@ -1,6 +1,6 @@
 <nav class="top-bar text-center show-for-large-up" data-topbar role="navigation">
     <section class="top-bar-section">
-        <?php glm_page_menu(); ?>
+        <?php michsci_top_bar(); ?>
     </section>
 </nav>
 <nav class="tab-bar show-for-medium-down">
diff --git a/single-miproduct.php b/single-miproduct.php
new file mode 100644 (file)
index 0000000..4310587
--- /dev/null
@@ -0,0 +1,67 @@
+<?php get_header(); ?>
+<header>
+    <?php get_template_part('parts/top-bar_main');?>
+    <?php get_template_part('parts/head-image');?>
+</header>
+<?php get_template_part('parts/off-canvas_main');?>
+<main class="blog-single">    
+    <div class="row">
+        <div id="blog-posts-over" class="small-12 medium-9 columns">
+            <?php if(have_posts()) : while(have_posts()): the_post();?>
+            <div class="row blog-post-container">
+                <div class="small-11 small-centered columns">
+                    <div class="row">
+                        <div class="small-12 columns">
+                            <article id="<?php the_ID()?>" <?php post_class()?>>
+                                <header class="entry-header">
+                                    <?php $category = get_the_category($post->ID); ?>
+                                    
+                                    <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h2>
+                                    <?php if ( has_post_thumbnail() ):?>
+                                    <div class="featured-image-wrap"><?php the_post_thumbnail("large"); ?></div>
+                                    <?php endif; ?>
+                                    <span class="meta date">Posted on <?php the_time('F jS, Y') ?></span>
+                                </header>
+
+                                <?php echo the_content(); ?>
+                                <footer class="entry-meta small-12 medium-6 medium-push-3 center">
+                                    <?php $post_categories = wp_get_post_categories( get_the_ID() );
+                                    $cats = array();
+                                    echo 'This entry was posted ';
+                                    if (has_category()) {
+                                        echo 'in ';
+                                        foreach($post_categories as $c){
+                                            $cat = get_category( $c );
+                                            $cats[] = array( 'name' => $cat->name, 'slug' => $cat->slug );
+                                            echo '<a rel="category" title="View all posts in '. $cat->name . ' " href="'. $cat->slug .'">'. $cat->name .'</a>, ';
+                                        }
+                                    }
+                                    $post_tags = wp_get_post_tags( get_the_ID() );
+                                    $tags = array();
+                                    if (has_tag( )) {
+                                        echo ' and tagged ';
+                                        foreach($post_tags as $t){
+                                            $tag = get_tag( $t );
+                                            $tags[] = array( 'name' => $tag->name, 'slug' => $tag->slug );
+                                            echo '<a rel="category" title="View all posts in '. $tag->name . ' " href="'. $tag->slug .'">'. $tag->name .'</a>, ';
+                                        }
+                                    }
+                                    echo ' on ';
+                                    echo ' <span class="meta date"> ' . the_time('F jS, Y') . '</span>';
+                                    ?>
+                                </footer>
+                            </article>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <?php endwhile; ?>
+            <?php else: ?>
+            <div id="post-404" class="noposts">
+                <p><?php _e('Sorry, no results were found.');?></p>
+            </div><!-- /#post-404 -->
+            <?php endif;?>
+        </div>
+        <?php get_template_part('parts/blog-sidebar-r'); ?>
+    </div>
+    <?php get_footer(); ?>