Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Call Wordpress Function get_categories ();
- $args = array(
- 'type' => 'post',
- 'orderby' => 'name',
- 'hide_empty' => 0,
- 'hierarchical' => 1,
- 'exclude' => '6, 1,16,17,18,19,20,15',
- 'taxonomy' => 'category',
- 'pad_counts' => false
- );
- $categories = get_categories($args);
- foreach($categories as $category) {
- // Input Construction
- // Grab each Category
- $catch_variable = $category->term_id;
- // Get the Category Description
- $description_content = category_description($catch_variable);
- // Limit amount of returned characters to break at the word level (not character)
- $limit_excerpt = substr($description_content, 0, strpos($description_content, ' ', 260));
- // Link to Category Archive, Excerpt I trimmed, & Second Link
- $cleancode = $limit_excerpt . ' …' . ' <a href="' . get_category_link( $category->term_id ) . '" ' . '>' . ' Topic Overview →'.'</a>';
- // Construction of Output
- echo '<p class="topic-link-heading"><a href="' . get_category_link( $category->term_id ) . '" ' .
- 'id="topic-link"' . '>' . $category->name.'</a> </p>';
- $removephtml = substr($cleancode, 3);
- echo '<p class="topic-list">' . $removephtml . '</p>';
- // Need Help Here
- $category = $category->term_id;
- echo $category;
- // Outputs the correct Category ID
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement