Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Display limited number of Custom Post Types titles in sidebar.

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33642
    jonedwards
    Participant

    Hi there

    I have a couple of different custom post types in my site – for job vacancies and tenders respectively. I need to display just the titles of of each post in a particular post type in the the sidebar.

    I have done so by using the following:


    'vacancies', 'posts_per_page' => 3 ) ); ?>

    Vacancies


    /vacancies/">View all job openings




      have_posts() ) : $sidebar_vacancies_loop->the_post(); ?>
    • ">



    This works well, but I need to display alternate content if there are no vacancies.

    • Either by having an alternate li that simply says, ‘No vacancies’
    • Or just not displaying the entire section if there are none.

    Any help would be appreciated.

    Thanks in advance.

    #84033
    ddliu
    Member

    How about:


    have_posts()):?>
    have_posts() ) : $sidebar_vacancies_loop->the_post(); ?>
  • ">



  • No vacancies


  • #86564
    jonedwards
    Participant

    I got this working eventually. Pretty similar to the above, so thanks ddliu.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.