First item in each category list is not a link

The question:

After the last update of the plugin “List Category Posts” the first post item under each category is just text, no link. This request is made at the request of the plugin author as per the help file associated with the plugin as the means to get answers from HIM.

See example here: http://oneangrycitizen.me/categories/

So the category links work but the post links are not working on the first link…

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

The first link was displaying incorrectly because of a bug with a ” sign. On line 60 of ListCatDisplayer.php, there was a wrong “:

$this->lcp_output .= '<' . $tag;
        if (isset($this->params['class'])): $this->lcp_output .= ' class="' . $this->params['class']; endif;
        $this->lcp_output .= '">';

As you can see, I was always adding the ” when closing the tag. So this produced:
First item in each category list is not a link
And if you specified a class and added more parameters, the wrong ” made the whole markup to be wrong.

I’ve fixed it to add the ” only on the class line:

$this->lcp_output .= '<' . $tag;
        if (isset($this->params['class'])): $this->lcp_output .= ' class="' . $this->params['class'] . '"'; endif;
        $this->lcp_output .= '>';

It was fixed in version 0.20.2, now ready for update. Sorry for the inconvenience, and sorry you didn’t get much help in the comments. Usually users tend to be friendlier over here.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment