Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
20 views

Don't move sticky posts to the first page

After I sticky post, it automatically moves post to the first page and I'd like it to stay at it's recent place. Don't want it to move. How can I do this? I just need sticky post option (i've got an ...
0
votes
1answer
26 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 ...
0
votes
1answer
21 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
14 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
9 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
18 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
33 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
18 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
2answers
140 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
0answers
26 views

All sticky posts are displaying on home.php and ignoring tax_query

I'm trying to query the main loop on my home.php template to display posts which are only in a specific taxonomy 'issue-41'. I'm using the pre_get_posts function to achieve this but when testing it, ...
0
votes
1answer
98 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
35 views

Latest Sticky Posts with Grid Thumbnails for static front page

i want to make very simple thumbnails grid 4 or 5 images only to show the latest sticky posts with " shortcode to be easy add anywhere " Thanks!
-1
votes
2answers
72 views

Different style for first two (sticky) posts

I'm currently facing a few loose ends while dealing with the homepage of a theme I am working on. I got my loop set up to show the most recent posts in a certain style and it works perfectly. Now I ...
1
vote
1answer
53 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 !
0
votes
1answer
121 views

How to remove only the latest sticky post from the loop

I know how to remove all of the sticky posts from a loop using the following argument 'post__not_in' => get_option( 'sticky_posts' ), But I am stuck in a problem. I want the loop to load all of ...
1
vote
2answers
128 views

Store sticky post's ids in a transient

I'm developing a theme that has a featured posts section before the main loop of posts. Cool and fresh, right?:) All sticky posts with a featured image in place must be displayed in that section and ...
0
votes
0answers
54 views

What's difference between “ignore_sticky_posts” and “post__not_in”=>$sticky_posts [duplicate]

what's the difference in results from: new WP_Query( array( 'post__not_in' => get_option( 'sticky_posts' ) ) ); and new WP_Query( array( 'ignore_sticky_posts' => 1 ) ); ?
0
votes
1answer
97 views

get_previous_post() while accounting for sticky posts

Let's say I have the posts foo, bar and baz. They are published in the following order: 1. foo 2. bar 3. baz If I call get_previous_post() while on the single.php of baz, I'll get bar. I set bar as ...
0
votes
1answer
379 views

Stick multiple posts in a single category

How to stick multiple posts in a single category to show on top of that category? Tried Ideas: I tried to use "Category Sticky Post" plugin, but it only allows me to pin one post for each category. ...
8
votes
1answer
5k views

why ignore_sticky_posts in sticky post query

We all know that ignore_sticky_posts is used to exclude sticky post from your custom query. But why on codex page https://codex.wordpress.org/Sticky_Posts, they use ignore_sticky_posts in querying ...
1
vote
1answer
200 views

Variable if post is sticky in functions.php

I'm building a shortcode to display certain posts in a page. So far it looks like this: function bloghome( $atts ) { extract( shortcode_atts( array( 'id' => 17 // Add the *default ...
3
votes
3answers
588 views

Disable sticky posts feature

I need to create a custom WordPress admin interface for a client. I want to completely disable the sticky post feature from admin area. I found some posts on the internet that suggest to hide the ...
0
votes
4answers
230 views

How can I allow sticky posts but cap the query to 1 post?

I have a partial that I call around the website at various points. This partial simply displays the latest Post. It looks like so: <?php $args = array( 'posts_per_page' => 1, '...
0
votes
1answer
30 views

Seach and categories not working when ignoring sticky posts in main loop

My search does not work anymore, the same goes for my categories. It now shows literally all the posts until the page limit is reached, instead of the specified ones. This happened after I made sure ...
1
vote
1answer
226 views

Change sticky status of posts from phpMyAdmin

I have many sticky posts in my database. Is there any SQL function which I could use from phpMyAdmin to change (remove) sticky status of posts, if post is sticky to change it to not sicky.
0
votes
1answer
94 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
2answers
170 views

How to modify query on category pages to show only sticky posts?

I'm using the following code to filter posts on category pages so only sticky posts are displayed. add_action( 'pre_get_posts', function( \WP_Query $q ) { if( ! is_admin() && $q->...
0
votes
1answer
94 views

Pull posts from all categories if quantity is not met?

I have a modified theme that displays CPT posts. I am creating a slider that will cycle through all the sticky posts and display them at the top of the page. So far so good. The problem. When I ...
1
vote
0answers
459 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 ...
0
votes
0answers
177 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
39 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
1answer
799 views

How to display only sticky posts on category pages?

I would really appreciate it if someone could help me with this. I'm trying to get category pages to show only sticky posts from the current category. I was hoping there might be a plugin to do this ...
1
vote
1answer
241 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
202 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 ...
5
votes
1answer
382 views

Set sticky posts schedule (Automatic)

EDIT: It is currently working when I set a sticky post and set it's date at 07/07/2016. My code so far: I've added this to change the post date of the post when it become sticky : // Update ...
0
votes
0answers
321 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, ...
4
votes
1answer
77 views

Add a single featured post to all pages?

Within wp-admin, we need the ability to select a single post as the featured post. This featured post will be displayed on all pages. I know I can make a post "sticky" but we would like to have only ...
0
votes
2answers
152 views

Exclude duplicated $sticky post from combined loop content

Since Wordpress sticky posts feature allow the post checked as sticky in post publish panel to be placed at the top of the front page of posts. I was also intended to style the sticky post differently ...
0
votes
1answer
232 views

Sticky Post from page 2 and on

Today I updated an old blog post and set it to sticky to show info about the latest changes. It’s a typical post with Site Updates as the title for a log of a sort you could say, with past changes ...
0
votes
1answer
51 views

Why Wordpress CMS uses an array in wp_options instead of a field for Sticky posts?

In WordPress we can pin (sticky) a post. Wordpress uses an option in wp_options table named 'sticky_posts' with an array list of sticky posts! As a normal condition WordPress should add a field ...
6
votes
1answer
2k views

WP_Query: Why is sticky post not first item in loop?

I've got a custom WP_Query loop based of meta_value variables: $meta_cat = get_sub_field('category'); $posts = new WP_Query( array( 'cat' => $meta_cat, 'posts_per_page' => get_sub_field(...
0
votes
1answer
63 views

Make posts non-sticky

I have around 200 posts. I want to make all posts non-sticky except 4 posts. I know the id of those 4 posts. How can I do it? Using plugin or sql query?
4
votes
1answer
141 views

Apply styling only to first page sticky posts

I'm using the following bit of code to highlight sticky posts: <?php if (is_sticky()) : ?> <div class="col-md-12 box-01"> <div class="content"> <?php endif; ?> The ...
1
vote
0answers
310 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 ...
0
votes
2answers
318 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
vote
0answers
56 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 ) { $...
2
votes
1answer
281 views

Exclude expired sticky posts

I use the following code to exclude expired posts and it works fine but it doesn't exclude expired sticky posts. //* Exclude expired posts add_action( 'pre_get_posts', 'exclude_expired_posts' ); ...
0
votes
1answer
247 views

Update a post to remove sticky option

I'm working on a plugin that we'll remove posts from the 'sticky posts'. I'll use the post ID to find it. What function should i use to remove the sticky option after i get this post? Something like ...
2
votes
1answer
7k views

Query *only* sticky posts

I've been using the following query to try to output only posts that are marked as stickies: <?php $args = array( 'post_type' => 'post', 'posts_per_page' => 2, '...
0
votes
1answer
3k views

Exclude first post (sticky or not) from the loop using query_posts()

I'm using query_posts( 'offset=1' ); to exclude the first post from the loop. However, if the first post is a sticky post it will be shown and the second (non-sticky) post will not be shown. Is there ...