Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Setting up WordPress in 2023
Toby Inkster
Toby Inkster

Posted on • Originally published attoby.ink on

     

Setting up WordPress in 2023

Here is my recipe for quickly spinning up a WordPress site with:

  • Plugins and themes managed by PHP Composer, so they can be checked into version control.
  • Several of my favourite plugins installed, includingFooGallery andAdvanced Custom Fields.
  • A minimal theme combiningRoots Sage 10 andBootstrap 5.2 (at the time of writing this article 5.3 was an alpha release). and making use of the plugins in places.
  • Avoiding shiny WYSIWYG things like the WordPress block editor, page builder GUIs, etc.

Assumptions

  • You have SSH access to a Linux+Apache web host
  • You have a blank MySQL/MariaDB database
  • PHP and PHP Composer are installed and working on the web host, along with any optional components WordPress and Roots Sage need
  • You have a domain name (or subdomain) pointed at the host
  • Node JS, npm, and yarn are installed and working on the web host
  • git is installed and working on the web host

WordPress Setup

Let’s clone a skeleton site from Github. This includes ourcomposer.json file along with a minimalindex.php and an examplewp-config.php file.

cd $HOME/sites/test.site.examplegit clone https://github.com/tobyink/wp-base2023.git .composer installcp wp-config.php.example wp-config.php
Enter fullscreen modeExit fullscreen mode

Now we editwp-config.php to add:

  • The domain name
  • Database connection info
  • Fresh salt fromhere

That should be enough for us to be able to visithttps://$domain/wordpress/wp-admin/ in a browser and complete WordPress’s browser-based setup procedure.

Theme Setup

My minimal theme is calledThyme. It’s based on Roots Sage 10 and is pretty flexible in terms of appearance.

If you plan on using a different theme, you can skip straight to theconclusion.

To installThyme:

cd $HOME/sites/test.site.examplecd wp-content/plugins/git clone https://github.com/roots/acorn.git acorncd acorngit checkout 2.xcomposer installcd ../../..git clone https://github.com/tobyink/wp-thyme-theme.git thymecd wp-content/themes/ln -s ../../thyme/ thymecd ../../thyme/composer installyarn installyarn buildchmod -R ugo+rwX public/ resources/styles/common/_wp_theme.scss
Enter fullscreen modeExit fullscreen mode

Yes, that’s a fair few commands, but don’t let them scare you.

Once it’s installed, go toPlugins in the WordPress backend and make sure the following key plugins are activated (because the theme needs them!):

  • Acorn
  • Advanced Custom Fields
  • Classic Editor

Onlyafter activating these plugins should you activate the theme.

Some optional features of the theme require these plugins to be activated:

  • Breadcrumb NavXT
  • FooGallery

After activating the theme, you can use theTheme Options andSections forms in the backend to customize site appearance. After making any changes, all your CSS and Javascript files are automatically recompiled.

(There’s currently a bug inThyme where recompilation is broken until you’ve gone toTheme Options andSections and hit “Update” on both. This is because there’s a few nulls hanging around in the default values which breaks SASS syntax causing CSS compilation errors. Visiting both pages and setting some values flushes out the nulls.)

Conclusion

This is a pretty simple way to set up an easily-manageable no-nonsense WordPress blog.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Most of the articles I publish here can also be found on my own website, with slightly better formatting.
  • Location
    Darlington, UK
  • Joined

More fromToby Inkster

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp