Space between lines – Can't remove them?!
-
Hi all,
I have tried and tried to do this, but I’m a bit of a novice and I need some direction. Thanks in advance to anyone who might be able to help.
The site is: https://www.thegymbuzz.com
The current issue is: Half way down the page, where it says “Browse by Well-Known Brands”, the categories that are in there have some space between each line. I can’t seem to remove it.
I believe the coding for this is in the plugin itself and not the theme (but, of course, I might be wrong.) I have been into the coding and taken out what I didn’t need and experimented removing different bits to see what worked but nothing has.
The code is:
<?php /* Plugin Name: Category Post List Plugin URI: https://www.jameswilkesdesign.co.uk/wordpress-plugin-to-display-all-posts-in-all-categories/ Description: Gives a complete list of categories and all the posts in them. Version: 1.3 Author: James Wilkes Author URI: https://www.jameswilkesdesign.co.uk/ License: GPL3 Copyright (c) 2010 James Wilkes https://www.jameswilkesdesign.co.uk/ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ set_time_limit(20); ini_set("memory_limit","128M"); function jameswilkes_catpostlist_content_handler ($content) { $tag = "[jwcatpostlist"; $closetag = "]"; $i = -1 + stripos("x" . $content, $tag); $j = -1 + stripos("x" . $content, $closetag, $i + 15); if (($i >= 0) && ($j >= 0)) { $before = substr($content, 0, $i); $after = substr($content, $j + strlen($closetag), strlen($content) - $j - strlen($closetag)); $tagcontent = substr($content, $i + 1, $j - $i - strlen($closetag)); $categorylist = array(); $postlist = array(); $orderby = "date"; $order = "asc"; $orderby_accepted_values = array('date', 'modified', 'title'); $order_accepted_values = array('asc', 'desc'); $params = explode(" ", strtolower($tagcontent)); $gotincludecats = false; $includecats = array(); $excludecats = array(); foreach ($params as $param) { $name = ""; $value = ""; if (strpos($param, "=") > 0) { $name = substr($param, 0, strpos($param, "=")); $value = substr($param, strpos($param, "=") + 1); } if ($name == "orderby") { if (in_array($value, $orderby_accepted_values)) { $orderby = $value; } } else if ($name == "order") { if (in_array($value, $order_accepted_values)) { $order = $value; } } else if ($name == "includecats") { $includecats = explode(",", $value); $gotincludecats = true; } else if ($name == "excludecats") { $excludecats = explode(",", $value); } } $posts = get_posts("orderby=" . $orderby . "&order=" . $order . "&numberposts=9999"); foreach ($posts as $post) { $postname = get_the_title($post->ID); $postlink = get_permalink($post->ID); $categories = get_the_category($post->ID); $postlist[$postlink] = array($postname, $categories); foreach($categories as $cat) { $catID = $cat->cat_ID; $catname = $cat->cat_name; if (!array_key_exists($catname, $categorylist)) { $categorylist[$catname] = $catID; } } } // get list of category IDs ordered by name $sortedcats = array(); foreach ($categorylist as $catname=>$catID) { array_push($sortedcats, $catname); } sort($sortedcats); foreach ($sortedcats as $catname) { $catID = $categorylist[$catname]; $usecat = true; if ($gotincludecats) { $usecat = in_array("" . $catID, $includecats); } if (in_array("" . $catID, $excludecats)) { $usecat = false; } if ($usecat) { $postlisttext .= "<class=\"jwcatpostlist\"><a href=\"" . get_category_link($catID) . "\">$catname</a>\n"; $postlisttext .= "<ul class=\"jwcatpostlist\">\n"; foreach ($postlist as $postlink=>$postdata) { $found = false; foreach($postdata[1] as $postcat) { if ($postcat->cat_ID == $catID) { $found = true; } } if ($found) { } } $postlisttext .= "</ul>"; } } $content = $before . $postlisttext . $after; } return $content; } add_filter('the_content', 'jameswilkes_catpostlist_content_handler'); ?>
Thanks and hopefully someone can guide me here.
- The topic ‘Space between lines – Can't remove them?!’ is closed to new replies.