WordPress.org

Forums

Adding a feature category functionality (3 posts)

  1. ecsancho
    Member
    Posted 1 year ago #

    Greetings I'm new to WP and was wondering if the community can point me in the right direction on how to accomplish some added functionality.

    What my client wants is 3 different categories (ie movies, music, tech) with the latest post per category featured on the homepage. So 3 different post from 3 different categories showing.

    1) In my head how I would go abouts doing this is add extra column in the wp_terms table that is Boolean type for feature category.

    2) In edit-tags.php add checkbox for featured category, then when update button click somehow saved checkbox value in the new column created in the wp_terms table. Still need to do RnD on this.

    3)In the front end, first search if any featured categories are true and grab the latest post in that category and display the results.

    So this is how I plan on tackling this feature, but if anyone can give suggestions on how to do this or suggest a pluggin I would be grateful. Thanks

  2. Hamed Hosseini
    Member
    Posted 1 year ago #

    hi , for lastest post from custom category you can try this code :

    <?php
    $catquery = new WP_Query( 'cat=3&posts_per_page=10' );
    while($catquery->have_posts()) : $catquery->the_post();
    ?>
    
    <ul>
    <li><h3><a>" rel="bookmark"><?php the_title(); ?></a></h3>
    <ul>
    <li><?php the_content(); ?></li>
    </ul>
    </li>
    </ul>
    <?php endwhile; ?>
  3. ecsancho
    Member
    Posted 1 year ago #

    Cool thanks for response. Now is the workflow I mention above the correct way of adding the Feature Category through admin side correct?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.