0

I've been using shortcodes for cutting down on the amount of html I have in my visual editor.

I have a shortcode [person] with features name, age, location, phone, and description. I want to list my 50 friends on a page. Each feature of the person needs to be styled in html and the same on all. Each person returns the same info with about 10 different tags, etc.

Is it super inefficient (processing) to have a page with 50 people:

[person name="Doug Vander" age="60" location="United States" phone="1119992929"]Doug has been my friend for a long time.......[/person]

.... [person name="Lastperson"].......[/person]

Is there a better way to list info I re-use all the time?

0

For Non-WordPress Person: It solely depends on what plugin are you using or what theme are you using. There are a lot of tools to check whether your page is doing well on the internet or not. One of them I use is GTmetrix. Enter your page URL and it will give you brief report. Good news is its totally FREE. There you can see what is the page load time and how many requests your page is doing. You should always try to reduce external requests and then internal like images. If your page loads below 4s is good sign that even if you have more than 50 requests, you site still perform better.

For WordPress Professional Person: If you are WordPress Developer and try to dig into deep then my suggestion to you to use REST API. And try to load more Friends on a scroll. This way you load only a few of them first and try to load rest on a scroll.

I hope it will help.

  • My short code function is just in my functions.php file – jonbon Mar 30 '17 at 5:50
0

Since it's just a 100 users, it may not have more effect on your loading time or server usage.

However, FYI since every shortcode call is a function call then process the instructions, repeating this for 1000 people will take time and you may need to consider using database with foreach loop or pagination.

  • The only way I know how to do this would be to make each person into a post, but I don't want to have a post for each user or have to edit them on separate pages, etc.. Plus all the short code is doing is adding HTML around the different attributes of person. Is there a better way to do this? When you say database in general, I'm not sure what you mean – jonbon Mar 30 '17 at 5:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.