- This topic has 11 replies, 2 voices, and was last updated 4 years, 7 months ago by Tom.
-
AuthorPosts
-
September 13, 2019 at 6:07 am #1008576Francis
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 CitySeptember 13, 2019 at 9:18 am #1008816TomLead DeveloperLead DeveloperHi 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?
September 16, 2019 at 3:50 am #1010450FrancisHi 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 CitySeptember 16, 2019 at 9:58 am #1010856TomLead DeveloperLead DeveloperAnd 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.
September 17, 2019 at 3:58 am #1011398FrancisYes, 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.
September 17, 2019 at 10:35 am #1011834TomLead DeveloperLead DeveloperIt looks like you’re using a custom post type for this right now. Does it work if you use regular posts?
September 18, 2019 at 5:52 am #1012453FrancisYes 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.
September 18, 2019 at 10:16 am #1012834TomLead DeveloperLead DeveloperWhat 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 🙂
September 19, 2019 at 5:47 am #1013448FrancisDone 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?
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?
September 19, 2019 at 6:18 pm #1014069TomLead DeveloperLead DeveloperIt’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?
September 20, 2019 at 6:57 am #1014424FrancisI 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 );}
?>
September 20, 2019 at 7:09 pm #1014936TomLead DeveloperLead DeveloperHi 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.
-
AuthorPosts
- You must be logged in to reply to this topic.