This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function custom_pre_get_posts($query) { | |
| // validate | |
| if(!is_admin() && $query->is_main_query()) { | |
| if(is_archive()) { | |
| $query->set('orderby', 'title'); // order posts by title | |
| $query->set('order', 'ASC'); // and in ascending order | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Podcast to wp-category | |
| add_action( 'init', 'ssp_add_categories_to_podcast' ); | |
| function ssp_add_categories_to_podcast () { | |
| register_taxonomy_for_object_type( 'category', 'podcast' ); | |
| } | |
| add_action( 'pre_get_posts', 'ssp_add_podcast_to_category_archives' ); | |
| function ssp_add_podcast_to_category_archives( $query ){ | |
| if( is_admin() ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: NeatSnippet | |
| Description: Show at plugin description | You can have even <a href="example.com">a link</a> here | |
| */ | |
| /* Start Adding Functions Below this Line */ | |
| /* Stop Adding Functions Below this Line */ | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('manage_posts_columns', 'posts_columns_id', 5); | |
| add_action('manage_posts_custom_column', 'posts_custom_id_columns', 5, 2); | |
| add_filter('manage_pages_columns', 'posts_columns_id', 5); | |
| add_action('manage_pages_custom_column', 'posts_custom_id_columns', 5, 2); | |
| function posts_columns_id($defaults){ | |
| $defaults['wps_post_id'] = __('ID'); | |
| return $defaults; | |
| } | |
| function posts_custom_id_columns($column_name, $id){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'phpmailer_init', 'set_phpmailer_details' ); | |
| function set_phpmailer_details( $phpmailer ) { | |
| $phpmailer->isSMTP(); | |
| $phpmailer->Host = 'SMTP_endpoint'; //Amazon SES SMTP endpoint for your region | |
| $phpmailer->SMTPAuth = true; | |
| $phpmailer->Port = 587; | |
| $phpmailer->Username = 'Amazon_SES_USERNAME'; | |
| $phpmailer->Password = 'Amazon_SES_PASSWORD'; | |
| $phpmailer->SMTPSecure = 'tls'; | |
| $phpmailer->From = get_option('admin_email'); //your verified email address |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "logs:CreateLogGroup", | |
| "logs:CreateLogStream", | |
| "logs:PutLogEvents" | |
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # Restore your widgets after tried new theme | |
| # | |
| # https://guides.wp-bullet.com/using-wp-cli-backup-restore-wordpress-widgets/ | |
| # | |
| # loop through widget backups | |
| for WIDGETBACKUP in /tmp/widgets/*.txt | |
| do | |
| # extract filename |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # Backup your widgets before you give a try to new theme | |
| # | |
| # https://guides.wp-bullet.com/using-wp-cli-backup-restore-wordpress-widgets/ | |
| # | |
| # create array of all widgets in the wp_options table | |
| WIDGETSARRAY=($(wp db query "SELECT option_name FROM $(wp db prefix --allow-root)options WHERE option_name LIKE 'widget\_%'" --skip-column-names --allow-root)) | |
| # loop through widgets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # install WP CLI at your home-dir. Change if you want something else | |
| # make executable: chmod u+x wpcli.sh | |
| # use ./wpcli.sh | |
| # | |
| mkdir ~/wp-cli | |
| wget -q https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O ~/wp-cli/wp | |
| chmod 755 ~/wp-cli/wp | |
| export PATH="$PATH:~/wp-cli" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| ## WordPress Plugin Installer using BASH and WP-CLI | |
| # Make executable: chmod u+x wp-plugins | |
| # remember change WPPATH | |
| # array of plugin slugs to install | |
| WPPLUGINS=( | |
| activitypub advanced-database-cleaner categorytinymce classic-editor code-snippets change-last-modified-date disable-gutenberg \ |