Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example Page Template for showing featured posts [NS Featured Posts]
@atomgroom

This comment has been minimized.

Copy link

commented Aug 26, 2015

If you want an example of how query everything except the featured post, here's how my team accomplished this:

your content
@horria

This comment has been minimized.

Copy link

commented May 25, 2016

For me the working solution for not showing featured posts was:

`<?php
$args = array(
'post_type'=>'events',
'order'=>'DESC',
'suppress_filters'=>0,
'meta_query' => array(
array(
'key' => '_is_ns_featured_post',
'compare' => 'NOT EXISTS'
)
)
);
$postslist = get_posts( $args );

foreach ($postslist as $post) :
setup_postdata($post);
?>`

@pixelpuur

This comment has been minimized.

Copy link

commented Oct 4, 2017

man how can i see the posts that are not featured with the upper code of featured.php

@pixelpuur

This comment has been minimized.

Copy link

commented Oct 4, 2017

Making one page template with two section

Upper section show feat post

section below show the non feat posts

cant get it working

[code]

'bedrijf', 'meta_key' => '_is_ns_featured_post', 'meta_value' => 'yes', ); // Get current page and append to custom query parameters array $custom_query_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;

$custom_query = new WP_Query( $custom_query_args ); ?>

Featured

have_posts() ) : ?> have_posts() ) : $custom_query->the_post(); ?> max_num_pages ); ?>

'bedrijf', 'meta_key' => '_is_ns_featured_post', 'meta_value' => 'yes', ); // Get current page and append to custom query parameters array $custom_query_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;

$custom_query = new WP_Query( $custom_query_args ); ?>

Niet Featured

have_posts() ) : ?> have_posts() ) : $custom_query->the_post(); ?> max_num_pages ); ?>

get_footer();
?>

[/code]

now both shop feat posts any suggestions?

@amitsarker89

This comment has been minimized.

Copy link

commented Dec 6, 2017

I can show the featured posts by using <?php $query = new WP_Query( array( 'meta_key' => '_is_ns_featured_post', 'meta_value' => 'yes' ) );?>
I want to not show the featured posts. How I can hide the featured posts in all the posts ?

@wpfangirl

This comment has been minimized.

Copy link

commented Dec 28, 2017

@amitsarker89 Try changing the args so that 'meta_value' => 'no'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.