By using Elementorforum.com’s services you agree to our Cookies Use and Data Transfer outside the EU.
We and our partners operate globally and use cookies, including for analytics, personalisation, ads and Newsletters.

  • Join the Best Unofficial Elementor Support forum

    Provide or get advice on everything Elementor and Wordpress, ask questions, gain confirmation or just become apart of a friendly, like minded community who love Wordpress and Elementor


    Join us!
elementor official

Question How to process a page with custom URL and parameter?

A

andrew_zol

New Member
Hi, I'm new to the Elementor. And I believe that's will be an easy question to answer for exports, however I didn't find any information.

How do I create a page with custom URL parameter with elementor? For example I need to create a page with url /person/(personId) and wan't to display on this page elementor widget displaying info about person with give personId. I know that there is a url rewrite possibilities in WP, but I didn't find how to get this working along with Elementor.

Thank You,
Andrew
 
elementor official
sms-design

sms-design

Member
Some more information about version of

  • wordpress
  • elementor free/pro
  • widget
  • theme
  • Web browser
  • OS mac/pc/linux

Screenshot or site url may help people answer your questions.
 
elementor official
A

andrew_zol

New Member
My environment is:
  1. Elementor v2.7.5
  2. Elementor Pro v2.7.3
  3. WordPress 5.3
 
elementor official
sms-design

sms-design

Member
Still not clear on what you are looking achieve what's the purpose of the website, there are many ways to get the custom url
 
elementor official
A

andrew_zol

New Member
Probably I don't understand how does custom urls works in Wordpress.
Let me describe. Let's say I have a number of persons stored in my third-party system, I access them through Rest API in my WP plugin.
I developed a Elementor Widget that can query my API and retrive person info by person Id.
What I want to do is to create a Elementor template (which contains my widget) which will serve /person/(personId) urls to display person.

What I can do by default is just to create a /person page, but I need one template serving a lot of differerent persons.
Thanks for your help. Feel free to ask me any question.
 
elementor official
sms-design

sms-design

Member
If you think of your personid as an author_id you could looking into using get_author_posts_url()

This may help as well

 
elementor official
A

andrew_zol

New Member
No, personId is not related to Wordpress, this is Id of some entity stored in another system. Here is what I did:
Code:
function rewrite_init(){add_rewrite_rule('/person/([0-9]+)?$', 'index.php?tag=person_page&order_id=$matches[1]', 'top');
}
add_action( 'init', 'rewrite_init' );
function person_query_vars( $query_vars ){$query_vars[] = 'person_id';
    return $query_vars;
}
add_filter( 'query_vars', 'person_query_vars' );
.

And then in my widget I do the following to retrieve person_id:
Code:
get_query_var('person_id')
But unfortunately when I flush permalinks cache and try to open for example /person/123234, I'm getting redirected to /person/ (correct page where widget is, but without parameter).
I suspect that I do something wrong in add_rewrite_rule. Because it is not supposed to do a redirect, it should just do a url rewrite, maintaining all query_vars.

I hope I explained it more or less well :)
 
elementor official
sms-design

sms-design

Member
Andrew I would suggest SO (stackoverflow) or maybe this plugin could answer many headaches.

https://en-gb.wordpress.org/plugins/participants-database/ which I used as a quick access solution for a company of 500 people who need to know first-aiders / fire marshalls / People on site etc etc

Also used it for a simple lead generator interface on tablets for trade shows connected to website held on Samsung Note4 phone at the show.

Without fully understanding your widget and purpose try the above
 
elementor official
A

andrew_zol

New Member
Thanks for the answer, by "person" I meant not only persons, it could be any data stored in another system.
As I said I already have the system which stores all the data I need to display. Anyways, thanks, I'll be searching what I do wrong.
 
elementor official
sms-design

sms-design

Member
StackOverflow as long as your explanation is good you will get excellent feedback, you could try FB Elementor Community there are a few good devs / and GIThub Elementor Devs.

But from my experience StackOverflow.

But maybe this https://gist.github.com/carlodaniele/1ca4110fa06902123349a0651d454057

Would be interested to see what it is your working on if it's going to be public.

Regards
 
elementor official
Last edited:

Latest posts

Other Elementor Resources

elementor official
elementor official
Top