BuddyDev

Search

This is a work in progress, if you note any issue, please let us know via the contact form

MediaPress provides easy to use shortcode with infinite flexibility to list media like photos, videos etc.

Shortcode:-

[mpp-list-media]

It has around 30 options to list media. We will see all of these in example below.
The default syntax is:-
[mpp-list-media option_name=some value option1_name = some other value … ]

Allowed Options:-

type:- Allowed gallery/media type. Possible values are

  • all
  • photo
  • audio
  • video
  • doc

Using ‘all‘ will return all types of media and is strongly not recommended. You can use ‘photo‘, ‘audio‘, ‘video‘ , ‘doc‘ to list only photos,  audio or videos etc.

Component Parameters:-

component:- The allowed components for which a gallery can be created.
Possible values are:-

  • members
  • groups
  • sitewide

Using component=members will only list media from users. Using ‘groups‘ will list group media. Using component=sitewide will list sitewide media. If you don’t specify a value, It will list media from all components.
component_id:- Component id can be used to get media from specific users or groups. It depends on the ‘component’ option. The component option must be specified if you want to use this option. If component is ‘members’ or ‘sitewide’ then the component_id is treated as user id else group id.

Status Parameters:-

status:- Status limits media with particular status to be listed. If you don’t specify it, default is ‘public’.
Possible status values are:-

  • public
  • private
  • loggedin
  • friendsonly
  • followers
  • following

The last two ( followers, following) is only applicable when BuddyPress Followers plugin is enabled. Also, even if you specified an status and that status is not enabled in the MediaPress settigs, then that will have no effect.

gallery_id:- Specific gallery id. Only media from this gallery will be listed.

galleries:- specify all the galleries whose media should be listed

galleries_exclude:- specify one or more gallery whose media will not be included.

Media Parameters:-

id:- Specific media id which you want to list. Only one media will be listed
slug:- Only a media with this slug will be listed.
in:- Comma separated list of media ids which you want to include in the list. Only these media will be listed.
exclude: Comma separated list of media ids which you don’t want to include in the listing.

User specific parameters:-

user_id:- You can specify the numeric user ID. It will return all media for the given user
user_name:- You can use user’s login name(username) instead of the id as above.
include_users:- A comma separated list of numeric users ids. It will limit the media to be listed from only these users.

Example:-
[mpp-list-media include_user=’1,2,3,4,5′] will list media for the specified 5 users.

exclude_users:- A comma separated list of numeric user ids. It excludes media from the specified users in the current media list.

Example:-
[mpp-list-media exclude_users=’1,2,3′]   won’t list media from users with ID 1 or 2 or 3.

for:- Specify dynamic user context to list the media from a particular user. Possible values are ‘logged’, ‘displayed’, ‘author. Available since 1.3.5.

Example:- List media for the logged in user only

[mpp-list-media for=”logged” type=”photo”]

It will list photos of the currently logged in user. If the user is not logged in, It will not show anything

Example:-  List media for displayed user.

[mpp-list-media for=”displayed” type=”photo”]

It will list the photos of the users only if we are using it on a user’s profile.

To show the photos of an author(post author), you can use the following shortcode.

[mpp-list-media for=”author” type=”photo”]

It won’t work outside the post context.

Search Parameters:-

search_terms:- You can use it to list the media whose title or description matches the given value.

Example:-
[mpp-list-media search_terms=’life’] will only list media that have the word ‘life’ in either title or description.

Date Parameters:-

year:- List media created in the given year.

Example:-
[mpp-list-media year=2015] will only list the media uploaded in the year 2015.

month:- List the media uploaded in a particular month. Possible values are 1-12.

Example:
[mpp-list-media month=2] will only list the media which were added in the month of February.

week:- You can specify the week number from which the media should be listed.
Possible values are from 1-53

For other possible values, please take a loo at WP_Query Date Parameter for possible values and their meaning. date_query parameter is not supported at the moment.

Custom Fields Parameters:-

The shortcode supports meta_key and meta_value parameter. The MPP_Media_Query (documentation coming soon) supports meta_query parameter but it is not supported in shortcode.

Please take a look at WP_Query documentation for custom fields section here to understand it.

Example:-
[mpp-list-media meta_key=’is_featured’] will only list media that have a meta key named ‘is_featured’

View Parameters:-

view:- Any of the registered/enabled view

  • type:- string
  • default: ‘grid’
  • possible values:- ‘grid’, ‘playlist’, ‘list’ or any registered view identifier

column:-(Only applies in grid view)

  • type:- integer
  • default: 4
  • It is used to display the gallery list in grid. Default value is 4. it defines how many gmedia should be listed per row.

 

Pagination Parameters:-

per_page:-

  • type: integer
  • controls how many media to list per page

offset:-

  • type: integer
  • how many media from the list to offset/displace( exclude from beginning of the original list)

page:- It is same as the ‘paged’ parameter of WP_Query, Which page of result you want to display.

nopaging:- If you want to list all media. Please avoid it as It can lead to degraded performance. Always use per_page instead.

Reference:- WP_Query Pagination Parameters.

Media Creator Parameters:-

show_creator:-

  • type: integer, default 0.
  • controls whether to show the media uploader/creator or not.

before_creator:-

  • type: string
  • Use any markup or string you want to put before the gallery creator’s name.

after_creator:-

  • type: string
  • Use any markup or string you want to put after the gallery creator’s name.

Example:-

[mpp-list-media show_creator=1 before_creator=”By: ” ]