The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
21 views

Include Sticky Posts in Page Post Count for custom query

This link solves the problem but it's only for the main query. What if you are using a custom query? How can you modify the answer below: add_action('pre_get_posts', 'ad_custom_query'); function ...
1
vote
1answer
1k views

How can I make a custom post type sticky?

I installed the "Sticky Custom Post Types" plugin, and I added this code to my function.php: function wpb_cpt_sticky_at_top( $posts ) { // apply it on the archives only if ( is_main_query() ...
0
votes
2answers
625 views

Only display sticky post or latest post in custom loop

I'm new to Wordpress and PHP and I've been battling with this for a while now. What I have for the moment is 2 loops. I want to first loop to only ever show 1 post: either a sticky post, or the ...
1
vote
2answers
2k views

Sticky post for each category on category pages

I think the title is self explanitory. I would like to show category.php a post I set as sticky post for that category. Do you know a good plugin or a code to do this? Thanks, Sarit
2
votes
2answers
40 views

Query sticky posts with thumbnails

I need to display max 5 latest sticky posts that have a thumbnail. And I need to have accurate counting of the displayed posts. I've tried to exclude sticky posts without a thumbnail with meta_query, ...
1
vote
1answer
27 views

Show Sticky Post at the top but do not show again in the loop?

Regarding wordpress.org - sticky posts are displayed at the top but they also appear again in the loop. For the main loop on my homepage I want to display the sticky posts at the top BUT I don't ...
0
votes
0answers
126 views

Manage sticky post content via the admin panel

I'm working on a theme that I try to make from scratch. Now I want to have two sticky post in my theme which uses for ads purpose. So I want the site owner to have the ability to change the sticky ...
1
vote
2answers
558 views

Sticky post appears twice

I am trying to modify the number of posts_per_page in the loop. This way: function posts_per_page($query) { $query->query_vars['posts_per_page'] = 3; } add_filter('pre_get_posts', ...
0
votes
2answers
55 views

Knowing if a post is sticky in the 'save_post' action. Where do I have to hook?

I'm using this plugin (FantasticElasticSearch) to index content when it's published. So far it was strightforward and an easy task but, now that I tried to index a flag saying if a post is sticky, I'm ...
1
vote
1answer
57 views

All sticky posts are returned in custom query

I have the following code: $recommended_args = array( 'post_type' => 'post', 'posts_per_page' => 3, 'post__in' => get_option('sticky_posts'), ...
1
vote
1answer
73 views

WP_Query doesn't get sticky post at the top, when used in a page template

I'm creating a theme in which I've created a page template called page_default-blog.php to be used for creating a blog page. In this file I have the following code: $paged = (get_query_var('page')) ? ...
1
vote
2answers
66 views

“Sticky” posts for each category (archive.php)

I need to have the ability to have Sticky posts for each category. The simplest way to do this appeared to be to just create two loops on the page. This is what I wrote: <?php //Custom "sticky" ...
1
vote
0answers
55 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 ...
2
votes
2answers
2k views

Adding Sticky functionality to Custom Post Type Archives

In WordPress, Custom Post Types do not have Sticky functionality as a core feature. It is possible, I'm sure, to create it in certain cases—and I'm working on a project that requires it for ...
2
votes
1answer
186 views

Include sticky posts in 'Blog pages show at most' X number of posts?

I'm using the default Loop Code. I've set the 'Blog pages show at most' option in Settings > Reading to 11. In my home page -set to show Latest Posts- whenever I mark a post as 'Sticky' it's being ...
0
votes
2answers
126 views

Ignore sticky posts if post is not in meta query

I have such a wp query args: $args = array( 'post_type'=> 'myposttype', 'posts_per_page' => 10, 'meta_query' => array( 'relation' => 'AND', array('key' => ...
0
votes
0answers
37 views

Sticky Post or Featured Post on every page

I'm using a sticky post to display some custom text on a blog homepage. It is the blue bar at the top. When I click on a blog post to read it (example), the sticky post goes away. Is there a way ...
0
votes
1answer
21 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( ...
2
votes
1answer
157 views

Sticky posts on home page, search, tag and archives without plugin

I have a question today. I am looking for a solution to make sticky post available on my website. But, i just got it work on homepage with the code below. function wpb_latest_sticky() { /* Get all ...
0
votes
0answers
26 views

Sticking a post or page to the top of all WordPress pages, posts, index pages, etc

I'm trying to add the same common content (like an announcement, banner, or slider) to the top of all WordPress pages, posts, category archives, etc. Standard WordPress sticky posts are displayed only ...
1
vote
1answer
265 views

How to make post sticky in the admin page?

i work with restaurant plugin that use custom post type. the question is, if it possible to select some post and make him sticky (always be in the top) in the admin? i need this because when you add ...
0
votes
2answers
41 views

Remove old sticky post on publish

I'm optimizing a WordPress site. For this, I have created a function that remove the old sticky posts. This function doesn't work correctly in some cases. Sometimes all sticky's are removed (so no ...
2
votes
1answer
168 views

Include Sticky Post in Page Posts Count?

I would like 7 posts showing on my homepage. I would like to be able to manually choose those posts by stickying them. Currently, I have my posts per page set to '7' in WP Admin. However, this does ...
0
votes
0answers
60 views

Theme code to display all sticky posts

I found this code to show one sticky post at the side of the page: <?php $sticky = get_option( 'sticky_posts' ); $the_query = new WP_Query( 'p=' . $sticky[0] ); while ...
0
votes
1answer
185 views

3 Posts in Loop, Show Stickies First

Okay I am starting to wonder if it is even possible to do this! As I've found very little info on the matter online. This is a fresh WP install that I've been experimenting on so that I can work in a ...
3
votes
2answers
4k views

Wordpress 3.1 - How does one add sticky post capabilities to post types

In wordpress 3.1 they finally added the option of allowing posts belonging to a custom post type to be marked as "sticky"... what I can't figure out though is how to enable this so the admin menu ...
0
votes
1answer
39 views

Show image if a post is featured

I know that posts that are sticky show on top but I want to add an image to show that is featured is there any code I could use
0
votes
1answer
89 views

Loop for sticky posts

I used Justin Tadlock's tutorial on how to create a loop consisting only sticky posts. The code looked more or less like this: $sticky = get_option( 'sticky_posts' ); rsort( $sticky ); $sticky = ...
0
votes
1answer
157 views

How to Order Sticky Posts? [duplicate]

I've got a sticky post that i would like to move down to third position in between my regular posts on my site and for it to stay there permanently? I've already downloaded a few different sticky ...
0
votes
1answer
52 views

Check if parent post is sticky on attachment page?

I use this code on post template (single.php) to check if current post is sticky: <?php if ( is_sticky() ) echo 'Post is sticky.'; ?> But it is not working on attachment page template ...
1
vote
0answers
193 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 ...
0
votes
1answer
46 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' => ...
12
votes
2answers
2k views

Sticky Posts exceed posts per page limit

I'm using pre_get_posts to adjust the number of posts displayed on my homepage. function lifelounge_query_adjust( $query ) { if ( is_home() ) { set_query_var( 'posts_per_page', 12 ); ...
0
votes
0answers
72 views

How to get sticky-posts on front-page working with category query

Im using the front-page.php to display some static content as well as my 5 latest posts in the category "Forsiden" (Frontpage). But the "sticky" post option, is ignored when categorising the posts on ...
0
votes
1answer
37 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
37 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
15 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
136 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
0answers
28 views

Let user feature a specific post on the front page

I am making a WordPress template with a static front page. I want to feature a single post on the "About" section of this front page. This will be a preview with a featured image and a link to a full ...
0
votes
1answer
127 views

Where is the sticky post option?

So I finally need to include sticky posts in a theme but it looks like the feature is gone. When I create a new post, and click "visiblity", the sticky option is missing. I checked a couple other ...
0
votes
0answers
75 views

Sticky Custom Post Types - Query returns nothing if no post marked as sticky

I am having an issue with sticky posts and custom post types. I want to display a sticky custom post type, but if there are no sticky posts, I simply want to display the latest post in that custom ...
1
vote
2answers
624 views

sticky post in custom loop

I have a problem with showing sticky posts in a custom loop. This is the code I'm using to for the custom loop: <?php $post_from_cat_a = new WP_Query(array( 'category_name' => ...
0
votes
1answer
302 views

Set custom field value when reaching expiration date

I had the idea to make sticky posts expire after a certain period of time. FYI, I am using a custom post type along with custom field suite and created sticky posts by creating a boolean custom ...
0
votes
0answers
73 views

global wp_query returning wrong post vars

I am currently filtering the_posts to recreate wordPress' "sticky post" function for custom post types. I also have to make sure that the sticky post is attached to a certain taxonomy term that ...
0
votes
1answer
57 views

Display image for first sticky post only

Working on news paper site here i am using sticky.I want display first 6 sticky post its displaying very good but problem is that every sticky showing there post image(feature image) here i just want ...
0
votes
1answer
47 views

Issue with first top post display order

Here i am trying to display top 6 post recent added post.But the problem is that first top post not displaying code is displaying top 6 post from top 2nd post except the top 1st post. Bellow is ...
0
votes
1answer
530 views

ignore_sticky_posts not working with word press version 3.9.1

I am trying to display a sticky post by its category id. The sticky post is displayed, but the problem is that the published sticky post is displayed twice. You can see from the snap shot below that ...
1
vote
2answers
1k views

Front page should display only one category of posts including sticky post with custom featured post box

I need code to get one category - including its sticky post and a custom featured post box on my front page. I am using twenty twelve. I have created a child theme. I have wordpress 3.6 on a ...
0
votes
2answers
103 views

Exclude Current and Sticky Post

On a single Post page I have a side bar displaying up to three other, related posts. How can I exclude both Sticky Posts and the Current post? I know how to exclude the Current post and how to ...
0
votes
1answer
70 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 ...