最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - Some questions about best practices for custom code

programmeradmin4浏览0评论

im really new to wordpress so it's currently hard to decide which approaches are better.

I'm a developer and there are some wordpress principles im struggling with.

What is the best way to implement custom backend code? Par example calling an API and show the results on the page.

I red about different techniques like adding a shortcode, using hooks, edit child theme-files directly, there is also this REST-API from wordpress.

  1. Maybe someone can point out, some typicall use-cases or examples when to use which technique and which is giving the most freedom?

  2. What is when i use an Page-Builder like Elementor, then everything is stored in the database. How would i add some backend code here?

  3. Currently Im using the free version of woocommerce for making a multi-vendor marketplace. Therefore i need a frontend product upload. What is the best way to implemen this? Writing directly into the database or using the woocommerce api?

Concept of having some page-related stuff in files and others in database (which make versioning harder) is somehow against my intuition as a developer.

Thanks in advance

im really new to wordpress so it's currently hard to decide which approaches are better.

I'm a developer and there are some wordpress principles im struggling with.

What is the best way to implement custom backend code? Par example calling an API and show the results on the page.

I red about different techniques like adding a shortcode, using hooks, edit child theme-files directly, there is also this REST-API from wordpress.

  1. Maybe someone can point out, some typicall use-cases or examples when to use which technique and which is giving the most freedom?

  2. What is when i use an Page-Builder like Elementor, then everything is stored in the database. How would i add some backend code here?

  3. Currently Im using the free version of woocommerce for making a multi-vendor marketplace. Therefore i need a frontend product upload. What is the best way to implemen this? Writing directly into the database or using the woocommerce api?

Concept of having some page-related stuff in files and others in database (which make versioning harder) is somehow against my intuition as a developer.

Thanks in advance

Share Improve this question asked Jan 13, 2020 at 16:24 nitsuj1001nitsuj1001 133 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Regarding question #1:

It's difficult to answer because WordPress is flexible so there are different ways to do things (I know this is vague) and it depends on what your skills are (are you more skilled at React and JS or PHP? ), how much time you are willing to spend learning, and other circumstances, and like freedom for whom (the developer or the end user? Usually freedom for one comes at the cost of the other).

Customizing Backend code: this is generally recommended to be done with plugins.

Shortcodes (here's a great overview of shortcodes by wpshout) are used generally to input more complex content. If you are working with many co-workers and want to give them some flexibility on adding content like maps without manually copying and pasting html, css, php, and js, you could use shortcodes.

Note, that the block-editor (known as Gutenberg), is aimed to replace shortcodes and can do the same thing although the block-editor uses React and is a remarkable change from using php.

发布评论

评论列表(0)

  1. 暂无评论