use a plugin's category slug to pull back posts specific to that plugin (1 post)

  1. martyn.ppsee
    Posted 2 years ago #


    I am a bit stuck trying to create a custom widget on a sidebar for retrieving information from a specific jobs plug-in. The widget can be hardcoded onto the sidebar, it's my only work around with this theme as the theme authors seem to have left out the normal sidebar widget area.

    I know the slug name and taxonomy but cannot seem to retrieve any data, for this example I am going to call the slug "featured-jobs".

    The php I am using is below, I am simply trying to get the post titles and excerpts for the moment in a list as a proof of concept to style later but I am not sure what I have missed or where my error is:

    global $post;
    $args = array( 'numberposts' => 5, 'category_name' => 'featured-jobs' );
    $posts = get_posts( $args );
    foreach( $posts as $post ): setup_postdata($post); 
    echo "<div>";
    echo "<?php the_title() ?>";
    echo "<?php the_excerpt() ?>";
    echo "</div>";

Topic Closed

This topic has been closed to new replies.

About this Topic