Difference between revisions of "Wordpress"
From Wasya Wiki
(→Move Wordpress) |
|||
| Line 6: | Line 6: | ||
sudo apt-get install php5-mysqlnd-ms | sudo apt-get install php5-mysqlnd-ms | ||
| + | |||
| + | === List Categories === | ||
| + | From: https://stackoverflow.com/questions/39704715/how-to-display-all-categories-in-wordpress/43927536 | ||
| + | <pre> | ||
| + | $args = array( | ||
| + | 'child_of' => 0, | ||
| + | 'current_category' => 0, | ||
| + | 'depth' => 0, | ||
| + | 'echo' => 1, | ||
| + | 'exclude' => '', | ||
| + | 'exclude_tree' => '', | ||
| + | 'feed' => '', | ||
| + | 'feed_image' => '', | ||
| + | 'feed_type' => '', | ||
| + | 'hide_empty' => 0, | ||
| + | 'hide_title_if_empty' => false, | ||
| + | 'hierarchical' => true, | ||
| + | 'order' => 'ASC', | ||
| + | 'orderby' => 'name', | ||
| + | 'separator' => '<br />', | ||
| + | 'show_count' => 0, | ||
| + | 'show_option_all' => '', | ||
| + | 'show_option_none' => __( 'No categories' ), | ||
| + | 'style' => 'list', | ||
| + | 'taxonomy' => 'category', | ||
| + | 'title_li' => __( 'Categories' ), | ||
| + | 'use_desc_for_title' => 1, | ||
| + | ); | ||
| + | var_dump( wp_list_categories($args) ); | ||
| + | </pre> | ||
| + | |||
=== REPL === | === REPL === | ||
Revision as of 20:03, 9 September 2018
Contents
Plugins
- wp-subtitle
Develop
sudo apt-get install php5-mysqlnd-ms
List Categories
From: https://stackoverflow.com/questions/39704715/how-to-display-all-categories-in-wordpress/43927536
$args = array(
'child_of' => 0,
'current_category' => 0,
'depth' => 0,
'echo' => 1,
'exclude' => '',
'exclude_tree' => '',
'feed' => '',
'feed_image' => '',
'feed_type' => '',
'hide_empty' => 0,
'hide_title_if_empty' => false,
'hierarchical' => true,
'order' => 'ASC',
'orderby' => 'name',
'separator' => '<br />',
'show_count' => 0,
'show_option_all' => '',
'show_option_none' => __( 'No categories' ),
'style' => 'list',
'taxonomy' => 'category',
'title_li' => __( 'Categories' ),
'use_desc_for_title' => 1,
);
var_dump( wp_list_categories($args) );
REPL
php -a
define('WP_USE_THEMES', false);
require('./wp-load.php');
$loop = get_posts( 'numberposts=1' );
$subtitle = new WP_Subtitle( 185 );
var_dump( $subtitle->get_raw_subtitle() );
Move Wordpress
- move database
- move wp-content
-
update wp_options set option_value='http://staging.annesque.com' where option_id in (2, 1);
- that's for options 'siteurl' and 'home'
-
cat 20180529_annesque_wp.sql | sed 's/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/' > out.sql
-
chown www-data:www-data <the wp dir>
-
sudo apt-get install php5-mysqlnd-ms
-
sudo apt-get install libapache2-mod-php5
Troubleshoot
Wordpress plugin install: Could not create directory
sudo chown -R www-data:www-data ../../wordpress_webdevzine/
Trash
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar php wp-cli.phar theme activate FoundationPress
https://s3.amazonaws.com/ish-backups/wordpress/blogwasyaco.wordpress.2016-01-06.xml php wp-cli.phar plugin install wordpress-importer --activate php wp-cli.phar import blogwasyaco.wordpress.2016-01-06.xml --authors=create