[Support request] Theme and WP Show post integration

Home Forums Support Theme and WP Show post integration

  • This topic has 11 replies, 2 voices, and was last updated 1 year ago by Tom.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1008576
    Francis

    Hi,

    I need assistance with GP theme and wp show post integration. I have a custom post type named property with a taxonomy for-rent status. However the 2 sticky post I had, doesn’t show up on the page’ 1st and second spot. I made sure that “Ignore Sticky Post” is unchecked under settings. On this page https://apartmentsforrentx.com/property-list-for-rent/ , these two sticky posts shows up in 3rd and 4th spot. When it should be on the first and second spot.

    Vacation Transient Condo House near Mines View Baguio City
    Short Term Transient House for Rent in Burnham Baguio City

    Regards,
    Francis
    apartmentsforrentx.com

    #1008816
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    To test, can you create a new WPSP list without changing any settings, and put it on a blank test page. Do those posts become sticky?

    #1010450
    Francis

    Hi Tom,

    Thanks for the response, I followed your instruction and posted it in https://apartmentsforrentx.com/property-list-for-rent/ and another on a test page. But, these two sticky posts below doesnt show on top of the list. Despite of the sticky post enabled for these two:

    Vacation Transient Condo House near Mines View Baguio City
    Short Term Transient House for Rent in Burnham Baguio City

    Regards,
    Francis
    apartmentsforrentx.com

    #1010856
    Tom
    Lead Developer
    Lead Developer

    And just to confirm, that WPSP has no custom settings set? Especially in the “More Settings” tab?

    I’m testing this on my end, and can’t reproduce the issue.

    #1011398
    Francis

    Yes, I’m using a default settings for WPSP. But the sticky post won’t show on top of the list, which is going to be an important feature on our website because, only our premium members would have that privilege.

    I made a staging site to reproduce the issue. My employer wont allow me to grant access to anyone on the live site (contract agreement). How can I send you the login credentials for the staging site?

    I sent you the credentials on your “edge” email address. I hope I got the right one for your email.

    Regards,
    Francis
    apartmentsforrentx.com

    #1011834
    Tom
    Lead Developer
    Lead Developer

    It looks like you’re using a custom post type for this right now. Does it work if you use regular posts?

    #1012453
    Francis

    Yes it’s suppose to be for custom post type. However, it’s the same issue for regular post. Here is another sample page I made for regular post type:

    https://agajardos.com/posticky/

    In this sample “Yes sticky” should be on top of “Sticky No 2”. But, “Sticky No 2 remains on top of the list” Despite that this is WPSP basic settings and ignore sticky post is left unchecked. The problem is still getting in the way.

    Also, if you have the access on the staging ,feel free to make changes add/edit post to troubleshoot the issue. Thanks. Hoping we could resolve it.

    Regards,
    Francis
    apartmentsforrentx.com

    #1012834
    Tom
    Lead Developer
    Lead Developer

    What happens if you deactivate your other plugins (specifically the sticky post related one)? I wonder if it’s conflicting.

    Typically, we’re not able to make changes on customer sites. Too many issues can happen that can cause frustration.

    Let me know 🙂

    #1013448
    Francis

    Done that. That didn’t help or made changes. I found one similar topic online though, I added the code. But didn’t work as expected. Probably, there’s a lacking snippet somewhere?

    https://wordpress.stackexchange.com/questions/219501/wp-query-why-is-sticky-post-not-first-item-in-loop

    The suggestion make sense. Because the sticky only works on default archive like blog page for instance, where some websites uses the blog page as the homepage. And since WPSP has a different way of calling or retrieving the post? Compared to the native function perhaps of how wordpress displays them on default pages like the blog page?

    Regards,
    Francis
    apartmentsforrentx.com

    #1014069
    Tom
    Lead Developer
    Lead Developer

    It’s possible, but it’s working on all of my tests. For example, the first post here is sticky: https://demos.wpshowposts.com/cards/

    That’s just a standard WordPress page with a list on it.

    Do you have any other test sites to try it on?

    #1014424
    Francis

    I am now halfway through the progress of fixing this. I just installed a plugin:
    https://wordpress.org/plugins/custom-post-type-sticky/

    Then, this plugin fixed my regular post type to show the sticky post on top of the list. However it only fixed my regular post type, not the custom post type I wanted. So, I think I’m close to resolving the integration. I just don’t know how to tweak it. Hoping you could assist.

    His explanation goes by this, based from the plugin page:
    “those post id’s will be included in the result of get_option( ‘sticky_posts’ ).”

    I did thought of contacting the plugin developer. But, since what I’m using is WPSP to display post together with GP Premium. He would just refer me back here.

    I’m not good with PHP codes , neither I have no idea what function is used to call the post by WPSP out of the GP theme contents. Hope you can assist me what to do from here.

    Below is the php script of that plugin:

    function cpt_sticky() {
    load_plugin_textdomain( ‘cpt_sticky’, FALSE, basename( dirname( __FILE__ ) ) . ‘/languages/’ );
    }
    add_action( ‘plugins_loaded’, ‘cpt_sticky’ );

    add_action( ‘admin_enqueue_scripts’, ‘cpt_sticky_admin_enqueue_scripts’ );

    function cpt_sticky_admin_enqueue_scripts() {

    $screen = get_current_screen();

    // Only continue if this is an edit screen for a custom post type
    if ( !in_array( $screen->base, array( ‘post’, ‘edit’ ) ) || in_array( $screen->post_type, array( ‘post’, ‘page’ ) ) )
    return;

    // Editing an individual custom post
    if ( $screen->base == ‘post’ ) {
    $is_sticky = is_sticky();
    $js_vars = array(
    ‘screen’ => ‘post’,
    ‘is_sticky’ => $is_sticky ? 1 : 0,
    ‘checked_attribute’ => checked( $is_sticky, true, false ),
    ‘label_text’ => __( ‘Stick this post to the front page’,’cpt_sticky’ ),
    ‘sticky_visibility_text’ => __( ‘Public, Sticky’,’cpt_sticky’ )
    );

    // Browsing custom posts
    } else {
    global $wpdb;

    $sticky_posts = implode( ‘, ‘, array_map( ‘absint’, ( array ) get_option( ‘sticky_posts’ ) ) );
    $sticky_count = $sticky_posts
    ? $wpdb->get_var( $wpdb->prepare( “SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN (‘trash’, ‘auto-draft’) AND ID IN ($sticky_posts)”, $screen->post_type ) )
    : 0;

    $js_vars = array(
    ‘screen’ => ‘edit’,
    ‘post_type’ => $screen->post_type,
    ‘status_label_text’ => __( ‘Status’ ),
    ‘label_text’ => __( ‘Make this post sticky’,’cpt_sticky’ ),
    ‘sticky_text’ => __( ‘Sticky’,’cpt_sticky’ ),
    ‘sticky_count’ => $sticky_count
    );
    }

    // Enqueue js and pass it specified variables
    wp_enqueue_script(
    ‘cptsticky-admin’,
    plugins_url( ‘admin.min.js’, __FILE__ ),
    array( ‘jquery’ )
    );
    wp_localize_script( ‘cptsticky-admin’, ‘sscpt’, $js_vars );

    }

    ?>

    Regards,
    Francis
    apartmentsforrentx.com

    #1014936
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    I’m not familiar with their code, unfortunately. The best thing to do is test on a fresh site to see if it’s something specific to your current site.

    In my tests, it works by default. If we can confirm it’s something on your site, we can begin peeling back the layers until we find the culprit.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.