• Hello everyone ??

    I creating (temporary offline) my website on WordPress with Elementor and Astra theme (if that makes any difference) contain blog page and page with user listings. Every listing i will add manually as would like to keep control over listings as listing are free ^^

    I looking for method to add 2 options of featured listings which will be added to home page: 1. Featured for 5 days, 2. Featured without time limit.

    Also i would like to display every post(listing) on home page for 10 days but featured listings on top.

    Should i add every listing as listing (way like directories plugin) or do that in posts? I think to add 3 categories like: trusted sellers (and make separate page for each seller), private sellers, all listings (both categories together). I don’t have idea how to organize my ideas and what plugins should i use. 

    I appreciate every help. 

    • This topic was modified 1 year, 8 months ago by tomis69.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You can use a custom post type for listings, or use regular posts. If you have a different need for posts, like a blog, then a custom post type would be a good choice. If you’ve no other use for posts, then you can use posts for listings.

    There are various plugins that will help you create custom post types, but the code required isn’t too onerous. You could likely copy/paste from examples and only do minor code editing.

    I cannot tell you how to organize your listings, I don’t have enough information to make a proper judgement. You can either organize by taxonomy or post meta. Post meta is good for data that’s unique to a post. Data that is in common with multiple posts is better managed by taxonomy terms. There are two general types of taxonomies, hierarchical like categories (child terms allowed); and flat like tags (no child terms allowed). Use these to organize as you best see fit. Besides the default category and tag taxonomies, custom taxonomies can be created.

    WP manages featured posts by whether they are “sticky” or not. By default they are manually designated. Sticky posts are saved as an array of post IDs in the options table. It’d be feasible for code to periodically alter this array based on arbitrary criteria like a “time to live” meta value. A wp-cron task could be developed that would handle this.

    I don’t know if a plugin to do this already exists, but it’s certainly feasible to do with some custom coding.

    Thread Starter tomis69

    (@tomis69)

    Thank you for your post.

    I’m totally new in WordPress so your informations are understandable but not idea how to event start. Simply i don’t have “vision” how to make it live. What informations do you need to make proper judgement?

    Let me try to explain my idea.

    On home screen page galery with listing thumbnails and under photo i would like to have categories like: brand, seller name they should direct (works like button) user to list with choosen categories like brand or seller. Also need 2 type of posts to be visible on this page: 1st – visible for 10 days, 2nd visible as long as i will not delete this post.
    I think 2nd post Type we can Mark as featured post (how to display together featured posts and 1st Type of posts in the same place? can’t use fixed container as amount of listings will get changed often so size can be bigger or smaller).

    Before i added php code to plugin but it was displaying all posts for 10 days from published date.

    Every new post should be visible for 10 days (1st type of post). For yrusted sellers i would like to choose 2 or 3 listings (from each seller) to be visible on home page as long as listing will be ON.

    I understand i should use taxonomy and custom post type.

    • This reply was modified 1 year, 8 months ago by tomis69.
    Moderator bcworkz

    (@bcworkz)

    choosen categories like brand or seller

    Sounds to me like you’ve now determined how your custom posts should be organized ?? These can each be a custom taxonomy, or parent category terms in the default category taxonomy. Individual brands or sellers could be the child terms under their respective parent term. The only outward difference is the sort of URL that is used. /brand/foo/ vs. /category/brand/foo/

    For the manually assigned/removed featured post you can simply mark it/them as sticky and WP will place it at the top of category lists. The time sensitive posts could be queried separately, such as any “listing” post type newer than X days and tagged “featured”. Posts found could be output prior to the main loop, or inserted into the top of the found posts array which drives the main loop. Or the post IDs can be dynamically added the the sticky posts array when WP gets the related saved option.

    Templates can style featured posts differently if desired. Sticky posts will have a “sticky” class assigned that CSS selectors can use to properly style featured posts. Outputting time sensitive posts prior to the main loop can also be easily styled differently. If the posts are inserted into the main found posts array it’s more difficult to style them differently, but it’s still feasible.

    Plugins to help you with custom taxonomies and post types are available. I’m less confident about availability of time sensitive featured posts. Try out a few plugins that look promising from a featured posts plugin search.

    If you can find a plugin that works for you, it doesn’t really matter what it does to do what you want. But if no suitable plugin is to found, the above approaches will work in a custom coded solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display featured posts time limited.’ is closed to new replies.