You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress无限滚动插件选择器求助:如何获取正确选择器?

Fixing Infinite Scroll Selector Issues for Your WordPress Site

Hey there! Let's sort out those tricky selectors for your infinite scroll plugin—no more trial-and-error guesswork. Based on the code snippet you shared, here's how to lock in the right ones:

First, let's break down the three key selectors most infinite scroll plugins require:

  • A selector for your post content blocks (the elements holding each individual blog post)
  • A selector for the "Next Page" link (the link that triggers loading more posts)
  • A selector for the pagination container (the full pagination section we'll hide once infinite scroll is active)

Let's map these directly to your site's structure:

  1. Post Content Selector
    Your posts are wrapped in <article> elements. Since your pagination uses the .mh-loop-pagination class (common in MH Themes), your posts are likely inside a matching parent container. Try this first:

    .mh-loop-content article
    

    If you're unsure about the parent container, start simple with just:

    article
    

    Pro tip: Use your browser's DevTools (F12) to right-click an article, then copy its full selector for pinpoint accuracy.

  2. Next Page Link Selector
    WordPress uses standard classes for pagination. Your next page link is almost certainly inside .nav-links with a next class. Use this:

    .nav-links .next.page-numbers
    

    If that doesn't work, target any link in the pagination section that isn't the "Previous" link:

    .navigation.pagination .nav-links a:not(.prev)
    
  3. Pagination Container Selector
    The entire pagination block is wrapped in .mh-loop-pagination—this is the element we want the plugin to hide once infinite scroll takes over. Use:

    .mh-loop-pagination
    

Quick Testing Tips

  1. Plug these selectors into your infinite scroll plugin's settings
  2. Load your blog page, scroll to the bottom, and check if new posts load automatically
  3. If it still fails, double-check the selectors in DevTools to ensure they only target the elements you need (no extra unrelated elements)

内容的提问来源于stack exchange,提问作者S R

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 03:30:35