Hugh's Blog

Ubuntu 1604 搭建 LNMP 环境

每次重装系统都要搭建 LNMP 环境,作个记录 (Ubuntu 1604) 安装 Nginx sudo apt-get update sudo apt-get install nginx 安装完之后访问 localhost,看到 Welcome 的信息说明安装成功 安装 MySQL sudo apt-get install mysql-server 过程中会 ...

WordPress 修改 tinyMCE 设置

今天在 WordPress 中使用默认的编辑器修改文章内容,在切换代码模式中发现编辑器会把 span 标签给过滤掉,而我需要保留 span 标签,Google 之后发现原来可以在 functions 中 ...

WordPress 为文章分类添加图片

为文章分类添加图片字段 /** * Add image for category */ add_action('init', 'my_category_module'); function my_category_module() { $taxonomy = 'category'; add_action($taxonomy . '_add_form_fields', 'add_custom_field_for_taxonomy'); add_action($taxonomy . '_edit_form_fields', 'add_custom_field_for_taxonomy'); add_action('create_' . $taxonomy, 'save_custom_field_for_taxonomy'); add_action('edited_' . $taxonomy, 'save_custom_field_for_taxonomy'); } function add_custom_field_for_taxonomy($tag) { $category_images = get_option('category_images'); $category_image = ''; if (is_array($category_images) && array_key_exists($tag->term_id, $category_images)) { $category_image = $category_images[$tag->term_id]; } echo '<tr><th scope="row" valign="top"><label for="auteur_revue_image">Image</label></th><td>'; if ($category_image != ...

 

WordPress 主题常用 functions

创建新的主题时 functions.php 的一些常用设置。 <?php // Remove wpautop // remove_filter('the_content', 'wpautop'); // Remove wp_head or wp_footer actions // Actions added in /wp-includes/default-filters.php // remove_action('wp_head', '_wp_render_title_tag', 1); // remove_action('wp_head', 'wp_enqueue_scripts', 1); // remove_action('wp_head', 'wp_print_styles', 8); // remove_action('wp_head', 'wp_print_head_scripts', 9); // remove_action('wp_footer', 'wp_print_footer_scripts'); remove_action('wp_head', 'feed_links', 2); remove_action('wp_head', 'feed_links_extra', 3); remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'index_rel_link'); remove_action('wp_head', 'parent_post_rel_link', 10, 0); remove_action('wp_head', ...

 

Yii2 前后台用户分离

Yii2 要分离前后台用户需要把前台与后台的 Session 与 Cookie 区分开来。 环境:高级模板 为了方便,直接使用 Migrate 复制默认的 user 表来建立 manager 表,同时需要建立以下的类。 common\models\User => common\models\Manager ...

 
<< Newer Posts Older Posts >>