Recent Posts From Category

Community Forums Forums Design Tips and Tricks Recent Posts From Category

This topic is: not resolved

This topic contains 3 replies, has 3 voices, and was last updated by  braddalton 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #42164

    fortyfivecreative
    Participant
    Post count: 10

    Hi, wondered if anyone could help with this. Am trying to show a list of the 3 latest posts, excluding category 6, however my $projects array is not working. ie The posts are displayed but are not limited to 3 and category 6 is not being excluded.

     

    ////* 45: Add [recent_projects] shortcode */
    function ff_recent_projects_list() {
    ob_start();
    echo ‘<ul>’;
    $projects = array( ‘numberposts’ => 3, ‘exclude’ => 6 );
    $recent_projects= wp_get_recent_posts( $projects );
    foreach( $recent_projects as $recent ){
    echo ‘<li><a href=”‘ . get_permalink($recent["ID"]) . ‘” title=”Look ‘.$recent["post_title"].’” >’ .   $recent["post_title"].’</a> </li> ‘;
    }
    echo ‘</ul>’;
    return ob_get_clean();
    }
    add_shortcode( ‘recent_projects’, ‘ff_recent_projects_list’ );

     

    Thanks!
    David

    #57629

    Susan
    Moderator
    Post count: 7495

    Hi! I’m working through the older unanswered posts today. As this thread is over three months old, I hope you have been able to get a resolution to your question. If not, can you please check in, and I will get it escalated for you.


    Susan @ Graphically Designing I’d love to customize your website! I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

    #57860

    fortyfivecreative
    Participant
    Post count: 10

    Hi Susan,

    Best of luck with the unanswered posts! Unfortunately I haven’t had a response so any help would be appreciated.

    Thanks

    #58083

    braddalton
    Participant
    Post count: 7470

    You can use the blog page template on the home page using the Reading Settings and exclude posts from any categories using the Genesis > Theme Settings > Blog Page Template.


    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.