Gallery for page author

Hi, Please, I`m using this shortcode and I would love to change the media_author and the context_id for the current author of the page, is it possible? [rtmedia_gallery global=“false” context=“profile” context_id=“6” media_type=“photo” media_author=“6”] Really thanks for your help. Wonderfull plugin, I’m loving it.

Hello @dobleclic,

To change the media_author, we need to get current author of the page which can be passed to fetch page media.

So, we can not use predefined shortcode to pass dynamic media_author.

Instead, you can call shortcode manually. Technically you need to follow below steps :

  • Create a page template.
  • Get current author of the page
  • Call gallery shortcode from page template by passing user-id.

Thank you.

1 Like

Hey there @pranalipatel, I hope you’re having a great day!

Can I get the ID from the current page if I have set the author of the page before? Thanks for your time!

Regards, Albert.

Hello @dobleclic,

You can get current post-id for example using WordPress function get_the_ID();

From that id you can fetch post_author for that page.

Thank you.