wordpress count widgets

前端 未结 2 667
失恋的感觉
失恋的感觉 2021-02-04 13:02

Hi I am trying to figure out as to how can we get the count of widgets published in a given sidebar position.

For example I have a sidebar called UTILITY which is a hori

2条回答
  •  轮回少年
    2021-02-04 13:28

    When you are building the sidebar, there should be a list containing the sidebar contents; you are iterating over it to add those items to the generated page. Just use the count() function on this list to find the number of items you're displaying.

提交回复
热议问题