LocalWP (trước đây gọi là Local by Flywheel) là một công cụ mạnh mẽ giúp bạn cài đặt và quản lý nhiều website WordPress trên máy tính một cách nhanh chóng. Bài viết này sẽ hướng dẫn chi tiết cách chạy WordPress bằng LocalWP và liên kết code theme từ máy tính vào.
1. Pull code về máy
Đầu tiên, bạn cần pull source code của project WordPress từ repository (GitHub, GitLab, Bitbucket, …). Hãy lưu lại path (đường dẫn) tới thư mục code này, vì chúng ta sẽ cần sử dụng ở bước sau.
Lúc này, code của bạn sẽ được link trực tiếp tới thư mục theme của WordPress site.
6. Khởi động site và active theme
Trong LocalWP, nhấn Start site để khởi động WordPress.
Truy cập vào Admin Dashboard.
Vào menu Appearance > Themes.
Tìm theme bạn vừa link và nhấn Activate để kích hoạt.
Kết luận
Chỉ với vài bước đơn giản, bạn đã có thể chạy WordPress bằng LocalWP và phát triển theme ngay trên máy tính của mình. Việc sử dụng symlink giúp bạn dễ dàng quản lý code trên repo, đồng thời vẫn chạy trực tiếp được trong LocalWP mà không cần copy/paste mỗi lần chỉnh sửa.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Trong quá trình phát triển UI. Tôi thường xuyên làm responsive cho trang từ PC, Tablet và Mobile. Đặc biệt là tôi đều cố gắng xử lý cho cả trường hợp khi mà user resize từ PC cho tới tận Moblie.
Tôi gặp một vấn đề đó là khi nội dung trong text-placehoder của thẻ input rất dài thì chúng ta sẽ muốn hiện thị dấu ba chấm.
Tuy nhiên ở một số trường hợp device mobile, đặc biệt là các thiết bị hệ điều hành iOS thì sẽ không nhận được thuộc tính ellipsis, cụ thể là đoạn code sau:
Vì vậy trong trường hợp này chúng ta phải xử lý bằng JS để giả lập một thẻ div có chức năng giống với thẻ input. Mục đích chỉ là giả lập thuộc tính placehoder.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.