4

I'm not very used to working with Wix and I realized that it has a certain limit regarding the Blog layout. I would like to add the author of each post next to the post, but it would be too much work to do post by post.

So I created an HTML box to get the image and name of the author of the post. But I know I'm not doing it right. See:

post

Looking in the documentation the most I found was the function getPost() which returns various information from the post page, but 'author' or 'writer' is not among them.

My question is: is there any way to get the author data to display it in this box? Or, is there a simpler way to get to this desired layout?

Author information doesn't necessarily need to be inside an HTML box, if there's another way to do that, that's fine too!!

Adão Gama
  • 122
  • 1
  • 13
  • 1
    I'm afraid this is not possible. Not only because indeed Velo does not allow you to access the author's name, also because there's no alternative. The alternative would be to get the details of the blog post item from the blog collection, but the particular data is not stored there. – user1098973 Jun 24 '21 at 14:27
  • 1
    Actually I found a code that might help, I just don't know how to use it: [Custom Post Page](https://www.wix.com/velo/example/custom-post-page) – ARNON Jun 24 '21 at 23:51

1 Answers1

0

As seen on https://www.wix.com/velo/example/custom-post-page

You can get the ID of the post - which you already demonstrated you know how to do via getPost() then use that ID to retrieve the extra post data - which includes the currentPost.author entity that you are looking for. You can also see on the same page how this, and other data from that extra post data, can be brought into the page:

function assignPostDataToUIElements() {
    $w("#authorName").text = `Written by: ${currentPost.author}`
}

User @Arnon De Paula definitely pointed us in the right direction with their link and should receive the bounty if this ends up being the answer you were looking for.

Cfomodz
  • 532
  • 4
  • 17
  • 1
    Actually I already tried to do it. But the object, text, or whatever seems not to receive the Author's name. Using [text box](https://ibb.co/yNL1S9H) or [HTML box](https://ibb.co/Tb5JHgn), I don't know why it simply doesn't work. – Adão Gama Jun 26 '21 at 01:01