CSS for Top Post and Pages widget

  • Unknown's avatar

    I am using the Zuki theme and it require you set up a page called “Front” to use as your home page. Because of this, the “Top Posts and Pages Widget” includes the “Front” page in its list of top viewed articles. On my website, I refer to it as trending articles. So basically I have my home page appearing in this list.

    A while back someone gave me a neat bit of CSS code which eliminates the Front page off the “Top Posts and Pages” list of trending articles:

    .widget-area .widget ul li:nth-child(1) {
    display: none;
    }

    What it does is remove the top article from the list and it works quite well.

    My problem is that the code affects all the widgets. So when I use the author display list, the first author is removed. If I list my categories, the first category listed does not appear as well. It basically removes all the first listed in the other widgets as well as the “Top Post and Pages” widget.

    Is it possible to have that code work for the “Top Posts and Pages” widget only and not affect the other widgets?

    Thanks for any help.

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hi @foxdog1020, I’m not seeing your front page listed in the Top Posts & Pages widget in your sidebar under Trending Articles. I took a look at the CSS, and I see no classes or distinctions that I could use to block pages from that widget. All the entries in it have the exact same CSS classes.

  • Unknown's avatar

    Thanks for your response. I don’t think I explained myself very well.

    I am using this code and what it does is remove the Top viewed article from the list on “Top Pages and Posts.” At the moment, “Front” is the top viewed article and it is not appearing.

    The code is below:

    .widget-area .widget ul li:nth-child(1) {
    display: none;
    }

    If I have a trending article and “Front” is the second most viewed article all I have to do is change “child(1)” to “child(2)” and “Front” which is the second most viewed article is removed from the “Top Posts and Pages” widget.

    The problem is that this code affects all the widgets that display text in order. For example, it affects the Author display widget and if I have it set for “child(1)” it removes the first author in the list. If I have it set for “child(2)” it removes the second author from the author list.

    It also affects the category list removing either the first or second category depending how I have “child(1)” set.

    Is their anyway to have this code only change the “Top Posts and Pages” widget and not affect all the other widgets?

    Thanks

  • Unknown's avatar

    @foxdog1020, sorry I misunderstood. We can target that specific widget by its css widget id like this.

    .widget-area #top-posts-2 ul li:nth-child(1) {
        display: none;
    }
  • Unknown's avatar

    That did the trick….

    Thanks so much, works great.

  • Unknown's avatar

    Hooray and you are welcome. :)

  • The topic ‘CSS for Top Post and Pages widget’ is closed to new replies.