Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ul id="category_menu">
- <!-- BEGIN Home Menu Item -->
- <li class="home" style="width:82px;"><a href="http://www.livinghealthynews.org" title="Living Healthy News."><b> Home</b></a></li>
- <!-- End Home Menu Item -->
- <?php
- class cat_style_sex
- {
- public $link_style_tag = 'class="cat_sex"';
- public $text_style_tag = 'text_cat_sex';
- public $border_top_style_tag = 'cat_sex_li';
- public $border_bottom_style_tag = 'border-bottom: solid 4px #EE2C21;';
- }
- class cat_style_spirit
- {
- public $link_style_tag = 'class="cat_spirit"';
- public $text_style_tag = 'text_cat_spirit';
- public $border_top_style_tag = 'cat_spirit_li';
- public $border_bottom_style_tag = 'border-bottom: solid 4px #66ccff;';
- }
- class cat_style_great
- {
- public $link_style_tag = 'class="cat_great"';
- public $text_style_tag = 'text_cat_great';
- public $border_top_style_tag = 'cat_great_li';
- public $border_bottom_style_tag = 'border-bottom: solid 4px #a97d5d;';
- }
- class cat_style_well
- {
- public $link_style_tag = 'class="cat_well"';
- public $text_style_tag = 'text_cat_well';
- public $border_top_style_tag = 'cat_well_li';
- public $border_bottom_style_tag = 'border-bottom: solid 4px #ffa500;';
- }
- class cat_style_active
- {
- public $link_style_tag = 'class="cat_active"';
- public $text_style_tag = 'text_cat_active';
- public $border_top_style_tag = 'cat_active_li';
- public $border_bottom_style_tag = 'border-bottom: solid 4px #00cc33;';
- }
- $lrIdx = 1; //left align tab dropdown if less than 4, else right align by appending _l or _r to class="dropdown_2columns"
- $idx_offset = 0;
- $cat_args = array(
- 'orderby' => 'name',
- 'order' => 'ASC'
- );
- $categories = get_categories($cat_args);
- $parent_categories = Array();
- foreach ($categories as $category) {
- if ($category->parent == 0) {
- $parent_categories[] = $category;
- } //$category->parent == 0
- } //$categories as $category
- //for each category, show 5 posts
- foreach ($parent_categories as $category) {
- $style_modifier_class = null;
- $style_class_exists = False;
- $cat_args = array(
- 'type' => 'post',
- 'child_of' => $category->term_id,
- 'orderby' => 'name',
- 'order' => 'ASC',
- 'hide_empty' => 1,
- 'hierarchical' => 1,
- 'exclude' => '',
- 'include' => '',
- 'number' => '',
- 'taxonomy' => 'category',
- 'pad_counts' => false
- );
- $sub_categories = get_categories($cat_args);
- $sub_cat_ids = Array();
- foreach ($sub_categories as $sub_category) {
- array_push($sub_cat_ids, $sub_category->term_id);
- } //$sub_categories as $sub_category
- array_push($sub_cat_ids, $category->term_id);
- $post_args = array( //EDIT: question: are these the args for 'get_posts()' later in the code?
- 'numberposts' => 5,
- 'category__in' => $sub_cat_ids,
- 'caller_get_posts' => 1,
- 'orderby' => 'post_date',
- 'order' => 'DESC',
- 'post_status' => 'publish',
- 'suppress_filters' => true
- );
- $split = explode(' ', strtolower($category->name));
- $style_mod_class_pfx = $split[count($split) - 1];
- if (class_exists('cat_style_' . $style_mod_class_pfx)) {
- $class = new ReflectionClass('cat_style_' . $style_mod_class_pfx);
- $style_modifier_class = $class->newInstanceArgs();
- $style_class_exists = True;
- } //class_exists('cat_style_' . $style_mod_class_pfx)
- $dyn_style_tag_menu = '';
- $dyn_style_tag_menu_text = '';
- $dyn_style_tag_menu_border = '';
- $dyn_style_tag_menu_border_btm = '';
- if ($style_class_exists == True) {
- $dyn_style_tag_menu = $style_modifier_class->link_style_tag;
- $dyn_style_tag_menu_text = $style_modifier_class->text_style_tag;
- $dyn_style_tag_menu_border = $style_modifier_class->border_style_tag;
- $dyn_style_tag_menu_border_btm = $style_modifier_class->border_bottom_style_tag;
- } //$style_class_exists == True
- // category tab
- echo '<!-- BEGIN ' . $category->name . ' Menu Item -->';
- echo '<li class="' . $dyn_style_tag_menu_border . '"><a href="' . get_category_link($category->term_id) . '" title="' . strip_tags(category_description($category->term_id)) . '" ';
- echo '>'; //$dyn_style_tag_menu . '>';
- echo $category->name;
- echo '</a>';
- // set the
- $posit_offset = -$lrIdx;
- $posit_offset *= 128.2;
- $posit_offset += 120;
- $lrIdx++;
- ?>
- <div class="dropdown_2columns" style="left:<?php
- echo $posit_offset;
- ?>px;<?php
- echo $dyn_style_tag_menu_border;
- ?>;<?php
- echo $dyn_style_tag_menu_border_btm;
- ?>"><!-- BEGIN 2 COLUMN MENU DROPDOWN CONTAINER -->
- <div class="dropdown_2columns_inner_lft"><!-- BEGIN LEFT COLUMN -->
- <?php
- $posts = get_posts($args); //EDIT: where is $args defined? is that meant to be $post_args ??//
- shuffle($posts);
- $numItems = count($posts);
- $i = 0;
- if ($posts) {
- foreach ($posts as $post) {
- setup_postdata($post);
- ?>
- <div class="<?php
- echo (++$i == $numItems) ? 'col_1_last' : 'col_1';
- ?>">
- <h3 class="category_menu_post_excerpt_title"><a class="category_menu_tab_link" href="<?php
- echo get_permalink($post->ID); //EDIT changed to 'get_permalink();'
- ?>" rel="bookmark" title="<?php
- the_title_attribute();
- ?>"><?php
- the_title();
- ?></a></h3><!-- Post Title -->
- <p class="category_menu_post_excerpt_byline"><?php
- the_time('F jS, Y');
- ?> by <?php
- the_author();
- ?></p>
- <p class="category_menu_post_excerpt"><?php
- the_excerpt();
- ?></p> <!-- Post Excerpt -->
- </div>
- <?php
- } // foreach ($posts as $post)
- ?>
- <div class="dropdown_2columns_inner_lft_btm, <?php
- echo $dyn_style_tag_menu_text;
- ?>">
- <a href="<?php
- echo get_category_link($category->term_id);
- ?>" title="<?php
- echo strip_tags(category_description($category->term_id));
- ?>">
- Go to <?php
- echo $category->name;
- ?> >
- </a>
- </div>
- <?php
- } // if ($posts)
- ?>
- </div><!-- END LEFT COLUMN -->
- <div class="dropdown_2columns_inner_rt"><!-- BEGIN RIGHT COLUMN -->
- <?php
- if (count($sub_categories) > 0) {
- ?>
- <p class="dropdown_2columns_inner_rt_title, <?php
- echo $dyn_style_tag_menu_text;
- ?>">More in <?php
- echo $category->name;
- ?></p>
- <?php
- } // if(count
- ?>
- <?php
- foreach ($sub_categories as $sub_category) {
- ?>
- <div class="col_2_subcategory, col_2">
- <?php
- echo '<a href="' . get_category_link($sub_category->term_id) . '" class="col_2_subcategory, ' . $dyn_style_tag_menu_text . '" title="' . strip_tags(category_description($sub_category->term_id)) . '" >' . trim($sub_category->name) . '</a>';
- ?>
- </div>
- <?php
- } //foreach($sub_categories as $sub_category)
- ?>
- <div class="col_2_tags" >
- <p class="dropdown_2columns_inner_rt_title, <?php
- echo $dyn_style_tag_menu_text;
- ?>"><span>Trending in <?php
- echo $category->name;
- ?></span></p>
- <?php
- $args = array(
- 'smallest' => 10,
- 'largest' => 12,
- 'unit' => 'pt',
- 'number' => 8,
- 'format' => 'flat',
- 'orderby' => 'name',
- 'order' => 'ASC',
- 'exclude' => '',
- 'include' => '',
- 'cat' => $category->term_id
- );
- tdotf_cat_tag_cloud($args);
- ?>
- <?php
- } // foreach($categories
- wp_reset_query();
- ?>
- </div>
- </div>
- <!-- END RIGHT COLUMN -->
- </div><!-- END 2 COLUMN MENU DROPDOWN CONTAINER -->
- </li><!-- End <?php
- $category->name;
- ?> Menu Item -->
- </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement