apache_conf 这是我对WordPress的非常自以为是的安装脚本 - 你需要安装wp-cli才能工作 - 我把它包装成一个

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf 这是我对WordPress的非常自以为是的安装脚本 - 你需要安装wp-cli才能工作 - 我把它包装成一个相关的知识,希望对你有一定的参考价值。

# -------------------------------------------------------------------
# Wordpress
# -------------------------------------------------------------------

fucntion wpinstall(){
    mkdir -p ~/Sites/"$@" && cd ~/Sites/"$@"
    projectroot=$(pwd)

    echo -e "$fg_bold[blue]---------------------------------------------------------------------------------"
    echo -e "$fg_bold[blue] Project Root --> $projectroot "
    echo -e "$fg_bold[blue]---------------------------------------------------------------------------------$reset_color"

    wp core download
    wp core config --dbname="$@" --dbuser=root --dbpass=root --dbprefix=rdm_ --extra-php <<PHP
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'AUTOSAVE_INTERVAL', '120' ); /** AutoSave every 2 minute */
    define( 'WP_POST_REVISIONS', false ); /** Disable Post Revisions. */
    define( 'MEDIA_TRASH', true ); /** Trash can for Media Library */
    define( 'WP_AUTO_UPDATE_CORE', 'minor' ); /** Auto Update only on minor releases */
    define( 'DISALLOW_FILE_EDIT', true ); /** No Plugin or Theme editor */

PHP
    wp db create
    wp core install --url="http://$@.dev" --title="$@" --admin_user=ginfuru --admin_password=Passw0rd --admin_email="ed@rainyday.media"

    # create pages and menus
    wp post create --post_type=page --post_title=Home --post_status=publish --post_author=$(wp user get ginfuru --field=ID --format=ids)
    wp post create --post_type=page --post_title=About --post_status=publish --post_author$(wp user get ginfuru --field=ID --format=ids)
    wp post create --post_type=page --post_title=Contact --post_status=publish --post_author$(wp user get ginfuru --field=ID --format=ids)

    wp menu create "Main Navigation" # create a navigation bar
    # add pages to navigation
    export IFS=" "
    for pageid in $(wp post list --order="ASC" --orderby="date" --post_type=page --post_status=publish --posts_per_page=-1 --field=ID --format=ids); do
        wp menu item add-post main-navigation $pageid
    done

    # assign navigaiton to primary location
    wp menu location assign main-navigation primary
    # update options
    wp option update show_on_front 'page'
    wp option update page_on_front $(wp post list --post_type=page --post_status=publish --posts_per_page=1 --pagename=home --field=ID --format=ids)
    wp option update blogdescription ''
    wp option update start_of_week 0
    wp option update timezone_string 'America/New_York'
    wp option update permalink_structure '/%postname%'

    # delete stupid stuff like plugins/themes
    wp post delete 1 2--force # delete WP sample post/page
    wp plugin delete akismet
    wp plugin delete hello
    wp theme delete twentytwelve
    wp theme delete twentythirteen
    wp theme delete twentyfourteen
    wp theme delete twentyfifteen

    # installing some good plugins and starter theme
    wp theme install https://github.com/RainyDayMedia/flux/archive/master.zip # RDM Flux
    wp plugin install wordpress-seo  --activate # Yoast SEO
    wp plugin install members --activate # Members
    wp plugin install advanced-custom-fields # ACF
    wp plugin install piklist --activate # Piklist - slowing migrating Flux away from ACF
    wp plugin install wp-helpers --activate # Piklist WP Helper
    wp plugin install adminimize --activate # Adminimize
    wp plugin install ~/Dropbox\ \(Rainy\ Day\ Media\)/Company\ Info/Operations/Documents/Processes/webStandards/Wordpress_Standards/Plugins/GravityForms/gravityforms.zip --activate
    wp plugin install ~/Dropbox\ \(Rainy\ Day\ Media\)/Company\ Info/Operations/Documents/Processes/webStandards/Wordpress_Standards/Plugins/iThemes/backupbuddy.zip
    wp plugin install amr-shortcode-any-widget # Widget Stuff
    wp plugin install user-switching # user switching
    wp plugin install regenerate-thumbnails # regenerate thumbnails
    wp plugin install social-networks-auto-poster-facebook-twitter-g

    rm -rf readme.html license.txt wp-config-sample.php;

    echo -e "$fg_bold[yellow]---------------------------------------------------------------------------------"
    echo -e "$fg_bold[yellow] SETTING UP GIT"
    echo -e "$fg_bold[yellow]---------------------------------------------------------------------------------$reset_color"

    git init;
    #setting up local-wp-config.php to avoid
    var=$(cat <<EOF >> local-wp-config.php
<?php
    define( 'DB_NAME', '"$@"' );
    define( 'DB_USER', 'root' );
    define( 'DB_PASSWORD', 'root' );
    define( 'DB_HOST', 'localhost' );
EOF
    )


    echo -e "$fg_bold[red]---------------------------------------------------------------------------------"
    echo -e "$fg_bold[red] HAPPY HACKING!"
    echo -e "$fg_bold[red]---------------------------------------------------------------------------------$reset_color"

    /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -b . && open . && subl wp-config.php;

}
# -------------------------------------------------------------------
# This file live inside of your ~/.wp-cli
# -------------------------------------------------------------------

# path: cms  # this is the path to your WordPress files
core install:
  admin_user: <YOUR ADMIN USERNAME>
  admin_password: <YOUR ADMIN PASSWORD>
  admin_email: <YOUR ADMIN EMAIL>
  title: The Next Big Deal in WordPress Sites
core config:
  dbuser: root
  dbpass: root
  dbhost: localhost
  extra-php: |
        define( 'WP_DEBUG', true ); 
        define( 'WP_DEBUG_LOG', true ); 
        define( 'AUTOSAVE_INTERVAL', '120' ); 
        define( 'WP_POST_REVISIONS', false ); 
        define( 'MEDIA_TRASH', true ); 
        define( 'WP_AUTO_UPDATE_CORE', 'minor' ); 
        define( 'DISALLOW_FILE_EDIT', true ); 

以上是关于apache_conf 这是我对WordPress的非常自以为是的安装脚本 - 你需要安装wp-cli才能工作 - 我把它包装成一个的主要内容,如果未能解决你的问题,请参考以下文章

apache_conf wordpress htaccess

apache_conf WordPress安全

apache_conf Wordpress htaccess

apache_conf Wordpress .htaccess

apache_conf 强化Wordpress网站

apache_conf wordpress-安装