Creating Ads List [adverts_list]

Posted in: Getting Started

Ads List is a page that will display all posted, active ads. On activation WPAdverts will create “Adverts” page (you can find it in wp-admin / Pages panel).

If the page with ads list for some reason was not created or you want to place the ads on some other page as well you can do this by adding in selected page description following short code [adverts_list].

Note that it is recommended to have one Page with [adverts_list] shortcode set as default (you can do so from wp-admin / Classifieds / Options panel), otherwise you might have problems with some functionality like browsing by category.

Once you will have some ads posted the page should look similar to the one below:

adverts-list

Shortcode Parameters

  • name: string (default “default”) – this is mainly for future use, the name basically should identify shortcode.
  • redirect_to: string (default null) (since 1.0.7) – you can pass either page ID or an URL starting with http://, when searching user will be redirected to this page / URL, ideally the page to which user is redirected to should also have [adverts_list] shortcode.
  • search_bar: string (default “enabled”) (since 1.0.5) – one of “disabled”, “enabled”, allows to hide search bar.
  • show_results: int (default 1) (since 1.0.7) – change value to 0 if you only wish to show search form
  • show_pagination: int (default 1) (since 1.1.2) – change value to 0 if you want to hide pagination below Ads list.
  • columns: int (default 2) – a number of columns on the list, it’s best to use either 2 or 3.
  • paged: int (default 1) – current page number, set it only if you want to start with page different than first.
  • allow_sorting: int (default 0) – if set to 1 then at the bottom of search bar there will be a dropdown field which will allow change sorting order. There are 3 sorting options available by default: by date, by price and by title. You can sort both ascending and descending. It will look like on the image below
  • order_by: string (default ‘date-desc’) – how the Ads should be sorted by default, allowed options are: date-desc, date-asc, price-desc, price-asc, title-desc, title-asc. That is you can sort by: publish date, price and title either descending or ascending.
  • posts_per_page: int (default: 20) – number of items per page
  • category: int (default null) – allows displaying ads only from selected category
  • author: int (default: null) (since 1.0.8) – user ID, setting this parameter allows listing all Ads posted by a selected user
  • display: string (default ‘grid’) (since 1.0.8) – allows to select if Ads should be displayed in a grid (2 or more per row) or as a list
  • switch_views: int (default 0) (since 1.0.8) –  setting this param value to 1 will show 2 icons in the search bar which will allow user to switch between grid and list view.
    wpadverts-list-switch-views
  • list_type: string (default ‘all’) (since 1.2.1) – allowed values are: featured, normal and all. Depending on selection the list will only show Featured, Normal or All Ads. Note this option is available only if the Featured Ads module is enabled.

Example Usage

List with 3 columns and total of 40 items per page

[adverts_list columns="3" posts_per_page="40"]

Free Extensions

After downloading you can install the extensions from wp-admin / Plugins / Add New / Upload panel like any other WordPress plugin.

  • Search By Category – Adds Category dropdown into Adverts search form. Download.
  • Search By Price – Adds “Price Min.” and “Price Max.” fields into Adverts search form. Download.