在 td 中查询 WordPress 帖子,其中帖子日期等于 td rel 属性


Query WordPress post in td where the post date is equal to td rel attribute

我的wordpress网站上有一个日历,其中每天都有一个表示日期的rel属性。如果帖子日期与rel属性匹配,是否可以查询wordpress帖子?我希望日历显示帖子缩略图,当您将鼠标悬停在其上时,会在叠加div 中显示图像、标题和摘录。

这可能吗?请帮忙

下面是日历函数获取输出的代码。

    <table class='calendar'>
        <caption>January 2016</caption>
        <tr>
            <th class='header'>S</th>
            <th class='header'>M</th>
            <th class='header'>T</th>
            <th class='header'>W</th>
            <th class='header'>T</th>
            <th class='header'>F</th>
            <th class='header'>S</th>
        </tr>
        <tr>
            <td colspan='5'>&nbsp;</td>
            <td class='day' rel='2016-01-01'>1</td>
            <td class='day' rel='2016-01-02'>2</td>
        </tr>
        <tr>
            <td class='day' rel='2016-01-03'>3</td>
            <td class='day' rel='2016-01-04'>4</td>
            <td class='day' rel='2016-01-05'>5</td>
            <td class='day' rel='2016-01-06'>6</td>
            <td class='day' rel='2016-01-07'>7</td>
            <td class='day' rel='2016-01-08'>8</td>
            <td class='day' rel='2016-01-09'>9</td>
        </tr>
        <tr>
            <td class='day' rel='2016-01-10'>10</td>
            <td class='day' rel='2016-01-11'>11... and so on.

你可以尝试使用 jQuery 来做到这一点。检索 rel 属性的组合:$(selector).attr('rel');

并将其发送到您编写的函数(也许在您的函数中.php该函数会将您的帖子作为用于显示信息的 JSON 对象返回?