I’m entirely new to OOP, but trying to dip my toe in by creating a simple Recipes plugin. I have added a Recipes custom post type and a few meta fields to go along with it, and now I am trying to create a few template files for displaying the recipe meta and content. To do this, I am thinking it would be useful to create a class to get all the meta for a particular post.
To test, I created a template file that is meant to echo one sentence with a single meta value after the post content:
And I created a new file in plugin-dir > public called “class-wp-recipes-recipe.php” that contains the following:
I think I need to add some code to specify to include my new file, but I am just not sure where to put it. I have tried putting a “require_once” for the file in the load_dependencies() function in the includes folder. No matter what I try, the meta value I am trying to display does not display, and the only noticeable effect from my efforts is that the wp admin bar no longer displays.
I may be going about this completely the wrong way, but any guidance would be greatly appreciated! Thanks!
- Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
- Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
- Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.
Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com