Gallery shortcodes


My need is that I need to display images of (i) the current user from a (ii) particular album but I am stuck with the first one itself. I have tried: (A)

<? $user_ID = get_current_user_id(); echo do_shortcode('[[rtmedia_gallery global="false" media_author="'.$user_id.'"]]'); ?>

But media files are not being shown.

The only way it works for me now is :

<? $user_ID = get_current_user_id(); echo do_shortcode('[[rtmedia_gallery global="true"]]'); ?>

But this is not what I am looking for

(B) In you docs, there is album id as well. How would I know what is the album id…how do I find album_id.


Hi @Navinachettri,

( A ) You can use following sample code :

$user_id = get_current_user_id();
echo do_shortcode('[rtmedia_gallery context="profile" context_id="'.$user_id.'"]');

( B ) You can check your album gallery under media tab and from there you will get to know which album id it is. For example, suppose you have album url like this {site_url}/members/admin/media/2179/ than 2179 is the album id of that album.

For example with album_id you can try following sample code :

$user_id = get_current_user_id();
$album_id = 1; //Album_id
echo do_shortcode('[rtmedia_gallery context="profile" context_id="'.$user_id.'" album_id="'.$album_id.'"]');

For more details you can refer documentaion here ->

Thank you.

Hi @pranalipatel

Thanks for the help. Sometimes for novices like me, the docs are painful to go through.

BTW is there a way I can get the album ID by its name? Is there a function similar to get_user_ID


Hi @Navinachettri,

To get album-id by its name is not possible, because there may exist two albums with same name.

Thank you.