Questions tagged [sticky-post]

When a post is sticky, it (generally) remains at the top of the published posts list, even if there are newer posts. It is possible to have more than one sticky post.

44 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
1answer
108 views

Sticky posts not working when a specific category is set

I would like to show sticky posts at the top of an archive list for a specific category on the top page as well as on archive pages. I've been Googling for a working solution and found a few clues ...
1
vote
1answer
74 views

How to remove sticky post capability for a specific user role?

All is in the title. Does someone know a way to do that ? Thanks !
1
vote
0answers
555 views

Sticky Post default functionality with WP_Query is ignored when using AJAX

I am writing custom ajax pagination for a Blog archive page and I am running into an issue with sticky posts. The default functionality of sticky posts when using a WP_Query call is to sort all ...
1
vote
1answer
283 views

Include sticky posts on the static page front page

I have a static front page that lists out news. Right now, it ignores the stickiness of a post, and justs lists it. I want it to work the same way as my blog posts page does. I want it to list out all ...
1
vote
0answers
226 views

Sticky posts per category

I need: to have the ability to set one post as sticky in one category and not the others. Example: So let's say i have this three categories: "one" "two" and "three". and i have a post named "sticky ...
1
vote
0answers
345 views

Blog page Server error 500 with stick post loop in query.php

Using sticky post on site near about 5000 sticky post i have. In wp-includes/query.php here i have bellow snippet code.on line 3748 to 3760.If i comment this code the blog page work properly. if ...
1
vote
0answers
57 views

Make sticky post on save

I am trying to make a post sticky on publish or update based on a custom field. I use the code below but it doesn't work. What am I doing wrong? function stick_post_on_save( $post_id ) { $...
1
vote
0answers
811 views

WP Query to have sticky posts first, with pagination and having a joint 'posts per page' arg with main loop

I am building a Wordpress site and have come to a bit of a wall while using a WP_Query, it started out quite simple but then sticky posts got thrown into the mix and it's becoming a bit harder to ...
1
vote
1answer
804 views

Pin a post to the top of a page, other than the home page

I'm using a static home page, so my posts go to a different page. How can I pin a post to the top of the page the posts go to (not the home page)? Originally I thought it was as easy as using the edit ...
1
vote
1answer
2k views

How to use custom fields to enable sticky posts on custom post types?

Background: The Wordpress Answers site has two questions which ask about how to enable sticky posts on custom post types (see how to make custom posts sticky? and Enable sticky posts to custom ...
1
vote
0answers
938 views

Showing sticky posts with get_posts()

I'm using this to retrieve posts on my index page: <?php $posts = get_posts( "category=13&numberposts=2" ); ?> <?php if( $posts ) : ?> <?php foreach( $posts as $post ) : ...
1
vote
0answers
101 views

Difficulty with PHP function that displays a post's format in WordPress

I am working on a WordPress theme using Bones. I would like to be able to show some text just above the title of each post if the post is either featured, password protected or private. So far I came ...
0
votes
0answers
11 views

How can I make the sticky pricing table in Divi theme without plugin?

I need to make a pricing table top row sticky relative to that pricing table main div like this Demo with javascript code or jquery code. I am using Divi theme where CSS position sticky is not ...
0
votes
1answer
19 views

Exclude categories with only sticky posts OR count sticky post of specific category

I want to create a page which displays all categories with posts. My goal is to exclude categories which only has sticky post(s). That's the part which isn't working so far. My current results looks ...
0
votes
0answers
32 views

Display Specific Posts at Start of Loop

I'm attempting to mimic 'sticky' functionality on a custom post type using a simple ACF true/false field. I'd like to use pre_get_posts to modify my query to first show my 'sticky' posts at the top ...
0
votes
0answers
127 views

How to enable sticky post for custom post type with enabled Gutenberg editor?

I was using https://wordpress.org/plugins/custom-post-type-sticky/ for enable sticky post for custom post types. But it doesn't work with new Gutenberg editor. Is there any easy way how to make it ...
0
votes
1answer
34 views

How to display sticky post always at the top (before regular post) in wordpress?

I am working on a wordpress code as shown below in which the modified post displays at the top. $temp_args = [ 'post_type' => array('current-channel', 'post', 'current-episodes'), '...
0
votes
0answers
23 views

Query for get the “Sticky post” of a CPT with 2 taxonomies

I am new in WordPress and I am doing tests, I have created a CPT called ('company') with two taxonomies ('zone' and 'sector'), I want to show me the companies with a certain sector (sector term such ...
0
votes
1answer
20 views

Function for Sticky Post on Categories causes issues with 404 behavior

I want to how sticky posts on category pages and I am using a code on my function.php file in order to manage it. The sticky posts are being shown on the category pages, everything is OK. But with ...
0
votes
0answers
36 views

Display the Latest Sticky Posts from a category in a widget

I could do it using a code I found, then editing it a litle bit, so i could add css classes on it. Inserted it inside "PHP Everywhere" plugin, and it worked. I made another site, with the same ...
0
votes
0answers
45 views

Staggering featured post using 'sticky'

So I have Custom post type that occasionally will have posts marked as 'featured' Client would like to use the 'sticky' feature of WordPress to pick which posts from the CPT are classed as featured ...
0
votes
1answer
25 views

Add to search posts query array with post IDS which will appear first

Is there a way to add array of post IDS to set posts to be on top of search results? Something like adding a param top_post_ids inside the search hool: $query->set( 'top_post_ids', [45, 78, 94 ] )...
0
votes
1answer
174 views

Make sticky post with FacetWP

I have WordPress posts in combination with Advanced Custom Fields and FacetWP for filtering. WordPress has an option to make a post sticky, I did this and nothing happenend so I tried to change my ...
0
votes
1answer
113 views

Pin to Top Functionality using orderby custom field then event date

I need to accomplish the following: pull CPT tribe_events sort by custom field "pin_to_top" in DESC order get posts from today's date & any in the future sort remaining posts in ASC order My ...
0
votes
0answers
202 views

counting post from a wp-query using sticky_post

I'm trying to count the number of sticky_posts inside a specific category. first I get all the sticky posts : $sticky = get_option( 'sticky_posts' ); then here are my args : $args_sticky = array( '...
0
votes
1answer
49 views

WP_Query causing links to not work

adding this line of code and adjusting my if statement has damaged my links in the loop. I really don't understand why this has happened. What is wrong with the line of code? <?php $query ...
0
votes
0answers
396 views

WP Query with sticky posts and tax_query

I have this query; $posts = new WP_Query(array( 'post_type' => 'post', 'posts_per_page' => 5, )); Which correctly places sticky posts at the beginning. However, ...
0
votes
1answer
111 views

Sticky post of current viewing author?

How to show sticky post of current browsing author on author.php template? $sticky = get_option( 'sticky_posts' ); rsort( $sticky ); $sticky = array_slice( $sticky, 0, 5000 ); query_posts( array( '...
0
votes
1answer
93 views

Trying to Exclude Sticky Posts From date_query

<?php $lastThirty = date('Y-m-d', strtotime('today - 30 days')); $currentMonth = date('M Y'); $t = date('d-m-Y'); $today = date("D",strtotime($t)); $lastThirty = array( 'date_query' => ...
0
votes
1answer
58 views

Add something after all sticky posts in The Loop

Let's say I've got some posts and some of them are sticky. The sticky posts are displayed at the very top in The Loop. while( have_posts() ) { the_post(); get_template_part(); } How can I add ...
0
votes
1answer
60 views

Show sticky blog post on homepage

Is there a bit of PHP I can use to grab the sticky blog post (there will only ever be one) to drop into my homepage template file?
0
votes
0answers
117 views

Blog Displays Only Sticky Posts

I set my home page to show the latest three sticky posts from the blog. The problem is, if you publish a post that's not sticky, it doesn't show up in the blog page. How could I fix it? The code ...
0
votes
0answers
225 views

Show sticky post before other WP_Query

$recent_posts = new WP_Query( array('posts_per_page' => $blog_num_posts, 'paged' => $paged, 'post_type' => 'post', 'post_status' ...
0
votes
1answer
125 views

Insert/sticky multiple posts in multiple positions

I'm attempting to do this but with multiple posts and specific positions. The post positions are hard coded right now, but will be pulled in from post meta. This code is only being ran on the homepage ...
0
votes
0answers
916 views

Limit Number of Sticky Posts to Show

I'm using sticky posts as features posts on home page. I'd like to limit the number of sticky posts to show two the latest two. I found this code, but it makes only on latest sticky post to show. I'd ...
0
votes
1answer
250 views

Jquery and Sticky

I have a trouble with jquery and sticky in a div in my website. I have included jQuery core in my page, inside the tag "head": <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery....
0
votes
1answer
69 views

Randomly placed sticky custom posts complemented by blog posts

On my index.php file I am showing the most recent posts using the standard index.php file. However, I'd like to include a custom post type (named products) in this standard loop. Have about 6 products ...
0
votes
1answer
364 views

Exclude sticky posts from query

I used orderby=date and orderby=comment_count to show my recent post and popular post, but sticky post is always there on the top. How can exclude sticky posts?
0
votes
1answer
202 views

Display latest sticky post or display nothing

On my Blog http://flattrendz.com/, I currently want to display the latest sticky post. I used the code of http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress &...
0
votes
2answers
202 views

Create thumbs only when a post is sticky or any other way?

I have a slider and I want to create thumb of specific sizes for my slider but only when the post post is sticky or if there is any other way so it won't create all these sizes I set for the slider ...
0
votes
2answers
370 views

How can I display only sticky posts from a parent category on the homepage?

On my homepage, I have 3 columns showing varying amounts of information from posts in specific categories (first 2 of them child categories, the third column displays posts from various child ...
0
votes
2answers
231 views

How to display only sticky posts on my automatically generated front page?

I want to display only the sticky posts on my front page. Right now it's possible to do a setting where the sticky posts are displayed at the top followed by the rest of the posts. I don't want to ...
0
votes
2answers
358 views

Images for sticky posts

I have a sticky post that gets the image from background URL, but doesn't resize the image and leaves my blog heavy. Here is the code: // is sticky if ( ( is_home() || is_front_page() ) ) { $...
-1
votes
2answers
1k views

First post outside of loop, homepage only?

Because of the way my templates are structured, I need to pull the first/sticky post from the site outside of the standard loop, just on the homepage. I'm using _s (underscores.me) as a base, so the ...