在Wordpress中使用AJAX进行a-z发布查询 [英] a-z post query using AJAX in Wordpress

查看:69
本文介绍了在Wordpress中使用AJAX进行a-z发布查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种用于导航帖子的导航,以查询所有帖子并返回以某个字母开头的帖子.我希望它是基于AJAX的,以免重新加载页面.

I'm looking to create a navigation for posts that queries all posts and returns those starting with a certain letter. I'd like this to be AJAX-based, so as to avoid reloading the page.

导航将是简单的<ul>,看起来像:

The navigation would be a simple < ul > and look like:

[#] [A] [B] [C] ... [Z]

[ # ] [ A ] [ B ] [ C ] ... [ Z ]

在每个<上点击一次li>,将查询所有帖子,并且post_title以<开头的帖子li>的信将被退回.

As one clicks on each < li >, all posts would be queried, and those whose post_title starts with the < li > 's letter would be returned.

如何实现这样的系统?

推荐答案

  • 使用 range('A','Z')列出列表
  • 运行一个MySQL查询,其中 SUBSTRING(1,1)== {escapedChar}
    • Use range('A', 'Z') to make the list
    • Run a MySQL query where SUBSTRING(1, 1) == {escapedChar}
    • 这篇关于在Wordpress中使用AJAX进行a-z发布查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆