Jump to content

wpgaijin

New Members
  • Posts

    2
  • Joined

  • Last visited

wpgaijin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. What I would suggest is to split your code up into template files and functionality. Use the theme for all your front end templates, meaning anything that is going to show on the front end. Then put all custom functionality into a plugin. This allows the functionality to be easily reused when the theme is changed. Take a look at http://wppb.io/ for a plugin boilerplate. This is a very popular plugin boilerplate that is great for getting into developing WordPress plugins. If you don't want to use the boilerplate, just use the plugin as a more flexible functions.php file. You can code in any style you like. Though OOP with an autoloader is a good way to go. Also, remember to always prefix your classes and functions, or use namespacing. Next, don't reinvent the wheel. There are a lot of built-in functionality in WordPress core. Your example of $template->get->cssDir() is done with get_template_directory_uri() . '/css' Which compiles out to path/to/your/theme/css If you start creating your own code for doing things that are already built into WordPress. You run the risk of something changing in WordPress and breaking your code, and it's just completely useless to a more experienced WordPress developer. I've had to just completely scrap themes before because the previous developer created everything with their own custom code instead of using the baked in functionality. Lastly, get familiar with the WordPress Codex https://codex.wordpress.org/. This will be your lifeblood while developing for WordPress.
  2. I'm making plugin with a repeatable field group in the settings. I've been all over trying to figure out why I can't get those fields to save. If anyone can take a look at my code and help me out I'd really appreciate it. Here's a link to a GitHub Gist with the code in question. https://gist.github.com/jawittdesigns/166d0ba0d23c8b068415
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.