• Resolved tfowles

    (@tfowles)


    Hello,

    I really like this plugin and it is working pretty well. I have multiple meta requirements that I want my code to pass. The first is that the post is less recent than when the page loads. The second is that the scrollcontent_page meta_key is a certain value (which I calculate in php).

    I used the shortcode builder and my meta_compare=”<:=”. When I use the less than symbol, the shortcode returns the text of the shortcode, as opposed to any posts. I know it is the less than symbol because when I remove it, it loads fine, but the comparison doesn’t work as I need it to.

    Here is the relevant code I have:

    if ( !isset($time)){
        $time = ( isset($_GET['pagestamp']) ? $_GET['pagestamp'] : time() );
    }
    $scrollcontent_page = get_post_meta( get_the_ID(), 'scrollcontent_page', true );
    echo do_shortcode('
        [ajax_load_more
        post_type="scrollcontent"
        post_format="standard"
        meta_key="scrollcontent_pagestamp:scrollcontent_page"
        meta_value="'.$time.':'.$scrollcontent_page.'"
        meta_compare="<:="
        meta_relation="AND"
        orderby="meta_value_num"
        order="desc"
        offset="0"
        posts_per_page="8"
        scroll_distance="-300"
        max_pages="0"
        transition="fade"
        button_label="Loading Fun..."]
    ');

    This is on http://www.memerize.net. I can put it to the less than symbol if you want to see the message for yourself.

    Thanks!

    https://ww.wp.xz.cn/plugins/ajax-load-more/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tfowles

    (@tfowles)

    Ok, I did more digging and I believe I know what is going on:

    1. The less than sign was causing the shortcode to not execute. I don’t believe this is the fault of the plugin (at least directly), and I was able to get around it by placing the html code for it as the value.
    2. I was using 0 as a value to compare against, and your code using !empty(meta_value), which was causing the array to be missing half of the meta comparison. I changed my code to not use 0 anymore and it is working now
    3. Hope that may help someone else in the future!

    Thread Starter tfowles

    (@tfowles)

    I think this can be counted as closed

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘meta_compare is breaking’ is closed to new replies.