WP-CLI allows you to use the command line to effectively maintain your WordPress websites. To change the website theme in WordPress using WP-CLI, we recommend that you follow the steps described below.

Listing the installed themes

- Log in to the server via SSH with the cPanel user who owns the website for which you want to display the themes.

- Use the cd command to access the root folder of your website eg:

cd public_html/website

Replace public_html/website with the real path to the root folder of your website.


Run the following subcommand to list the installed themes:

wp theme list

- The command will return an output similar to the one below, in which we can see 4 installed themes:

[email protected] [~/public_html]# wp theme list +-----------------+----------+--------+---------+ | name            | status   | update | version | +-----------------+----------+--------+---------+ | boldgrid-primas | inactive | none   | 1.23.1  | | boldgrid-swifty | active   | none   | 1.1.1   | | twentyfifteen   | inactive | none   | 1.9     | | twentyseventeen | inactive | none   | 1.4     | | twentysixteen   | inactive | none   | 1.4     | +-----------------+----------+--------+---------+

Below the status column, the theme that is currently activated for the respective website appears as having active status.

Next, after listing the themes, follow the instructions to change the active theme of the website with one of the listed themes.

Changing themes

If you want to change the website theme, use the wp theme command to activate it.

- Log in to the server via SSH with the cPanel user who owns the website for which you want to display the themes.

- Use the cd command to access the root folder of your website eg:

cd public_html/website

Replace public_html/website with the real path to the root folder of your website.


Run the following subcommand to list the installed themes:

wp theme activate boldgrid-primas

After activating the theme, you will receive a successful installation message, similar to:

[email protected] [~/public_html]# wp theme activate boldgrid-primas Success: Switched to 'Primas' theme.

 

For assistance in applying the above instructions on HostX servers please contact us. HostX offers the fastest WordPress hosting and can help you solve your problems.

Cette réponse était-elle pertinente? 0 Utilisateurs l'ont trouvée utile (0 Votes)