CentOS7
systemctl start nginx
Before CentOS6
service start nginx
| <?php | |
| /** | |
| * To have a hierarchy to the default post | |
| */ | |
| function action_register_post_type_args( $args, $post_type ) { | |
| if ( $post_type == 'post' ) { | |
| $args['hierarchical'] = true; | |
| $args['supports'] = array_merge( $args['supports'], array('page-attributes') ); | |
| } | |
| return $args; |
| /** | |
| * At login redirect processing | |
| * @param string $user_login | |
| * @param array $user | |
| */ | |
| function action_wp_login($user_login, $user) { | |
| if ( 'administrator' !== $user->roles[0] ) { | |
| wp_safe_redirect( home_url(), 301 ); | |
| exit(); | |
| } |
| <?php | |
| $paged = $paged ?: 1; | |
| $view_num = 10; | |
| $the_query = new WP_Query([ | |
| 'post_type' => 'blog', | |
| 'posts_per_page' => $view_num, | |
| 'paged' => $paged, | |
| ]); | |
| $max_count = $the_query->found_posts; |
| ALTER TABLE `wp_commentmeta` CHANGE `meta_id` `meta_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT; | |
| ALTER TABLE `wp_comments` CHANGE `comment_ID` `comment_ID` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT; | |
| ALTER TABLE `wp_links` CHANGE `link_id` `link_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT; | |
| ALTER TABLE `wp_options` CHANGE `option_id` `option_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT; | |
| ALTER TABLE `wp_postmeta` CHANGE `meta_id` `meta_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT; | |
| ALTER TABLE `wp_termmeta` CHANGE `meta_id` `meta_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT; | |
| ALTER TABLE `wp_terms` CHANGE `term_id` `term_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT; | |
| ALTER TABLE `wp_term_taxonomy` CHANGE `term_taxonomy_id` `term_taxonomy_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT; |
| <?php | |
| global $wpdb; | |
| $post_type = 'post' | |
| $paged = get_query_var('paged') ?: 1; | |
| $posts_per_page = 5; | |
| $start = $posts_per_page * ($paged - 1); | |
| $sql = ''; | |
| $sites = get_sites(); | |
| foreach($sites as $key => $site){ |
| document.addEventListener("DOMContentLoaded", (ev) => { | |
| const copyEl = document.querySelector('#copy') | |
| copyEl.addEventListener("click", (ev) => { | |
| ev.preventDefault() | |
| const input = document.createElement('input') | |
| input.readOnly = true | |
| input.value = location.href |
| <?php | |
| $the_query = new WP_Query( array( | |
| 'post_type' => 'post', | |
| 'posts_per_page' => 20, | |
| 'offset' => 0, | |
| ) ); | |
| if ( $the_query->have_posts() ) : | |
| while ( $the_query->have_posts() ) : $the_query->the_post(); | |
| if (get_the_post_thumbnail_url(get_the_ID(), 'full')) continue; |
| <?php | |
| function custom_template_include( $template ) { | |
| if ( is_single() && in_category( 'news' ) ) { | |
| $new_template = locate_template( array( 'single-news.php' ) ); | |
| if ( '' != $new_template ) { | |
| return $new_template ; | |
| } | |
| } | |
| return $template; |
| <?php | |
| /** | |
| * Change template file to be Include | |
| */ | |
| function mytheme_template_include( $template ) { | |
| global $post; | |
| $recruit_post = get_page_by_path('recruit'); | |
| if ( $post->post_parent === $recruit_post->ID ) { |