Something like this should work:
$sticky = get_option( 'sticky_posts' );
if ( !empty( $sticky ) ) { // don't show anything if there are no sticky posts
$args = array(
'posts_per_page' => -1, // show all sticky posts
'post__in' => $sticky,
'ignore_sticky_posts' => 1
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
$query->the_post();
// display your sticky post here (however you like to do it)
}
}
You should place this in your front-page.php
file. It will select all sticky posts and show them.
Related Posts:
- When to use is_home() vs is_front_page()?
- How does WordPress decide what template to use as frontpage
- Set front page as static page [closed]
- Disable front-page.php template
- Set a static front-page as a landing page programmatically
- Displaying recent post excerpts on static front page
- Keep sticky posts out of query unless they have featured image
- How to Find the Page the Front Page is Using?
- How to set wp_options in functions.php for removeing the Default Front Page
- is_home and is_frontpage always true
- Theme Development -> Specific Homepage
- What is the need for the static front page [closed]
- What is the best way to build home pages with a lot of sections for distributable themes [closed]
- Confused by the behaviour of “front page” / “home” templates
- static front page ONLY for certain themes?
- is_front_page use in sidebar.php
- 1 post per category on homepage and counting those posts
- 3 x 3 grid of posts on the home page
- What is the advantage of using home.php over index.php for the front page
- How to create .pot files with POedit?
- How do I get the theme URL in PHP?
- What is the difference between wp_register_sidebar_widget and register_widget?
- How to enqueue script if widget is displayed on page?
- Custom Image section in Customizer
- Get 10 posts from a WP_Query. If less than 10, get the remainder from elsewhere
- get_stylesheet_directory() returns wrong URI… localhost/using vhosts
- How Do I Programmatically Force Custom Permalinks with My Theme?
- wp_get_attachment_image_attributes not working for me
- How to edit an existing WordPress theme? [closed]
- Where is default wp_head() implemented?
- Questions about WordPress.org theme review
- Excluding categories from “Manage Categories” using a get_terms filter
- Feature Survey – What would you want in a resume theme?
- Select menu on browser resize
- Hard-coded Audio Player
- How should I store global information such as a phone number so that it is editable through the CMS?
- WordPress nav_menu_css_class theme filter is not being called
- How do I locally enqeue the mediaelement.js file into a wordpress theme
- Cannot get full thumbnail size using the_post_thumbnail
- Is it safe to enqueue a font style without putting http or https?
- Is there a way to activate different theme for specified users? [closed]
- current_user_can Not Always Working Properly
- using jQuery Cycle by Malsup with WordPress Page and Gallery
- Can’t select my block by clicking on it
- Is it possible to use Twitter intents with the post’s image in WordPress?
- How to add infinite scroll?
- How can I have a page on a site that isn’t a ‘Page’ in the WordPress sense?
- Category specific themes?
- Missing tested up to on readme text validator
- Posting page on all subdomains
- How do I build a post_thumbnail based archive? [closed]
- WordPress Unite Theme: Footer isn’t sticking [closed]
- How to set a correct $content_width when there are two content widths on one page?
- How to enqueue javascript for WP Customize options sidebar?
- WordPress 500 Internal server error when activating custom theme [closed]
- Do not display post images on front page
- Customize how a WordPress theme looks like in the Theme Selector
- Images not showing after path specified in header.php
- Template for landing pages
- Wpautop in wp_editor not working
- Comment status shows ‘closed’ in db, but it shows ‘open’ when i echo it
- How to show a manageable list of images on a post?
- html5-reset theme does not show the image [closed]
- WordPress HTML5 Gallery Support – Convert HTML4 -> HTML5
- Theme options save routine clashes with plugin save
- Contact Form Security
- Where do you add code in custom fuctions so it works on a specific page?
- Customizer Color Control Not Working
- where to start with WordPress theme development [closed]
- Create a Grid/List Toggle in WordPress Archive
- Fixed button and slideshow in template upload per page
- Unable to add widgets to sidebars in custom theme
- Non-standard (new) theme file
- Best Practice for Server Processing
- How do I display a greyed out next_post_link when there is no next post
- What is the difference between Twenty eleven & roots framework?
- WordPress Show Single Post on Home Page with previous/ Next Button
- Is there any way to store single.php wordpress file into a php variable
- Woocommerce AJAX filters option loading spiner – problem on mobile device
- How to Modify WP_Includes/blocks/latest_posts.php
- Page For Specific Posts
- How can I show a custom WordPress menu anywhere I want on my website?
- Menu is in Reversed order
- How to connect two child themes on different sub domains to the same base theme
- Group several custom global page templates in sub-folder
- Should I detect the device or the page first?
- Query wp_postmeta into an array based on post_id
- Theme not uploading showing maximum upload size on live site
- WordPress Theme Developments – Start from another theme
- Access meta box checked value in another file
- Best way to access variables in template markup
- How do I get my theme scripts to load in a custom theme built from Bootstrap
- How to convert that page to a wordpress template? [closed]
- JQuery Equal Height in Rows Conflicts Only Works without Registering wp_footer();
- Add rel to all images in a post
- WordPress theme Modifications not showing up on live server
- Incorrect sidebar showing on WooCommerce Store page [closed]
- How to Create a Multi Purpose Theme?
- customize functionality of share buttons under each blog post [closed]
- How to Enable Hot Module Replacement with Webpack