lp__post_featured

lp__post_featured is a custom query parameter in the Launchpad Core plugin that allows you to filter and retrieve posts marked as “featured.” Unlike the standard approach of using post meta (wp_postmeta), Launchpad Core stores this information in a custom database table instead of the WordPress postmeta table.


Product


How it Works

In Launchpad Core and dependent plugins like Malcolm, custom post types (CPTs) are registered using the LP__CPT object. This object provides various functionalities, including the ability to mark posts as featured.

Because the featured status is stored in a custom table rather than wp_postmeta, the lp__post_featured parameter enables optimized filtering without requiring meta_query. It works seamlessly within WP_Query, allowing you to retrieve featured posts efficiently while still supporting WordPress’ built-in query parameters.


Accepted Values

lp__post_featured accepts boolean-like values:

  • true (1 – integer): Includes only posts marked as “featured.”
  • false (0 – integer): Includes only posts that are not marked as “featured.

Usage

You can use lp__post_featured in your code to filter and retrieve posts that are marked as featured. This parameter acts as a binary flag, allowing you to determine whether posts should be included in the query based on their featured status.


Example

$args = array(
    'post_type' => 'rep_listing', // Replace with your actual custom post type.
    'lp__post_featured' => true, // Retrieve only featured posts.
);

$query = new WP_Query( $args );

In this example, the query will return a list of posts of the ‘rep_listing’ post type where the ‘featured’ custom field is set to ‘true’. These are the posts that are marked as featured in your custom post type.

Result

The result of the query in the provided example will be a list of posts of the ‘rep_listing’ post type where the ‘featured’ custom field is set to ‘true’.
Please note that the example is for reference only and may need adjustments depending on the structure of your code.

Related

Use to filter posts based on their proximity to a specific geographic location.

Use to determine the meta key by which you want to order your query results

Use to define an array of meta query conditions, including custom field keys, values, comparison operators, and data types.

Use to control the visibility of posts in your queries.

Use to filter posts based on various criteria.

Use to filter posts based on various criteria.