Flyfish's Blog

See post count on dashboard

hanki provided this useful trick, but I still think it's too complicated. Using the following code allows you to show post count on your dashboard directly.

Preview

Put them on footer of the customise option will do the trick.

<script>
if (document.querySelector(".post-list") != null) {
    document.querySelector("main").insertBefore(
      Object.assign(
        document.createElement("div"), {
          id: "post-count",
          innerHTML: document.querySelectorAll('.post-list li').length.toString() + " posts in total.",
          style: "color:var(--subtext-color);margin:1em 0;"
        }),
      document.querySelector(".post-list")
    )
  }
</script>

#bearblog #code #post