Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

timhysniu/wp-cli-template

Quick links: Installing | Usage | Contributing

Installing

Installing this package requires WP-CLI v0.23.0 or greater. Update to the latest stable release with wp cli update.

Once you've done so, you can install this package with wp package install timhysniu/wp-cli-template

Usage

For list_all and find you may use a --format to specify the format. Default format is table but you may change that to json or csv.

wp template list_all --format=json

list_all

This sub-command will list all templates that are currently in use.

wp template list_all
wp template list_all --grep=home.php --format=json

find

This sub-command will find all pages that are using a template. You may specify more than one template and can also filter post ID's (comma separated for more than one)

wp template find default home.php page-template1.php

The output that you will see should look something like this if format is not csv or json:

+---------+----------+
| post_id | template |
+---------+----------+
| 2       | default  |
| 454     | default  |
| 771     | default  |
| 1029    | default  |
+---------+----------+

change

This sub-command will change template for all posts if at least one of the filters is used. You use any of the filters: post_id - comma separated list of post ID's template - current template

This exampe will change the template to "page-template1.php" for all posts that have "default" template selected:

wp template change page-template-1.php --template=default
Success: Sucessfully executed. 4 posts updated
wp template change default --post_id=454,2
Success: Sucessfully executed. 2 posts updated

About

Find, list and update templates for WP-CLI

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.