Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Using URL arguments in dynamic data?

  • Is there a way to make the dynamic data even more dynamic? 🙂

    For example, I want to display info from a user based on the user_id that’s specified as a user parameter.

    {{user_meta id:GET_FROM_URL_PARAM|key:display_name}}

    Thanks!

  • Hi there,

    For example, I want to display info from a user based on the user_id that’s specified as a user parameter.

    Can you explain some more?

    1. Where do you want to pull the date? On a page/post or in a GP element? if it’s the latter, what element type is it?

    2. Where do you specify the user_id?

  • Sure.

    1. For this example, let’s say we want to pull this data in a Text/Headline block.

    2. As a URL parameter.

  • There isn’t a URL parameter, I still don’t understand your question.

    Can you first let me know what environment is the text block in? Refer to my #1 question here:
    https://generate.support/topic/using-url-arguments-in-dynamic-data/#post-148224

  • Sorry for the confusion. I meant /profile/?user-id=1234 where user-id is the URL parameter.

    The Text block is inside a page.

  • What is the relationship between the page and the user?

    Or how you plan to connect the page and the user?

  • There is no relationship between the page and the user.

    The dynamic content inside Generateblocaks allows to display something like this: {{user_meta id:3|key:display_name}} but I want the id to be a dynamic value the is extracted from the URL.

  • What’s the relationship between the page and the user profile URL?

    Dynamic data requires the data has a connection with the current page or post, how would it know what user ID to pull if there’s no connection?

    I do not understand it.

  • I think you need to have a second look at how the dynamic content works. Inside the dynamic content option you can specify a specific user (or post for the matter). The data will be pulled for that user. So there doesn’t need to be any relationship with the current page / post. Does that make sense?

  • That’s not “dynamic” data, but static data although it can be achieved by specifying the ID.

    My question is how do you plan to get that ID “dynamically”? Or do you just want to add the ID manually?

    I still don’t get your question. Can you try to describe the use case so I can have a better understanding?

  • Okay so maybe we have a semantic issue about what dynamic and static data is. Lets skip over that for a moment 🙂

    The use case is simple. There’s a page /profile/?user-id=1234 which displays information about the WordPress user with that id.

    You navigate to this page through a directory page /profiles that has a list of all the current wordpress users.

    In order to build this single user /profile/ page you need to be able to specify the id inside {{user_meta id:3|key:display_name}} dynamically based on the value this is specified in the URL.

  • There’s a page /profile/?user-id=1234 which displays information about the WordPress user with that id.

    Are you referring to the admin user profile page (dashboard > users > individual user) and trying to modify it with GB’s dynamic data?

  • No, I’m referring to a custom page that displays user information on the front-end.

  • Is it a static page or it’s a custom post type?

    This information is important, can you link me to the page?

  • It’s a static page. I can’t share a public link.

  • if it’s a static page, how do you define the URL to make it show a user ID? I’m so confused, i will have to know your setup to provide more suggestions.

Viewing 16 posts - 1 through 16 (of 26 total)
  • You must be logged in to reply to this topic.