Archive

Archive for the ‘PHP’ Category

Tuyển nhân viên thực tập PHP

Bạn là sinh viên mới ra trường, bạn yêu thích CNTT & lĩnh vực lập trình web với ngôn ngữ PHP.

Panpic đang tuyển nhân viên thực tập PHP, Sinh viên mới ra trường, Sau thời gian thực tập bạn nào làm tốt sẽ được giữ lại làm việc với các lập trình viên của Panpic

Thông tin nộp hồ sơ:

Các bạn gửi CV, bảng điểm & các thành tích đạt được về địa chỉ email: contact@panpic.vn

Chặn wordpress tự động phát sinh thẻ p

Ngăn chặn WordPress tự động phát sinh thẻ p trong bài viết

 


remove_filter( 'the_title', 'wpautop' ); // Xóa thẻ p ở title
remove_filter( 'the_content', 'wpautop' ); // Xóa thẻ p trong nội dung
remove_filter('the_excerpt', 'wpautop'); // Remove

tags from Excerpt altogether

Chúc các bạn thành công

 

nhantam
Thiet ke web Panpic

Categories: Wordpress

How to Add a PDF Viewer in WordPress

Do you want to add a PDF viewer in WordPress? By default, WordPress displays PDF files as links. Users can view the PDF by downloading it or opening it a new window. But what if you wanted to embed a PDF in your blog post? In this article, we will show you how to add a PDF viewer in WordPress.

 

Why and When You Need a PDF Viewer in WordPress?

WordPress does not embed PDF files into blog posts like it does with audio and video embeds. It just adds the file as a downloadable link.

This means that users will have to go away from your page to view the PDF file. Many of these users don’t come back to your site, and this reduces your site’s pageviews as well as user-engagement.

One way to deal with is to offer PDF files as content upgrades. This way, you can ask users to join your email list to get the bonus content.

However if you just want users to view PDF files without leaving your website, then you will need to add a PDF viewer in your WordPress site.

A PDF Viewer will embed the PDF right into your WordPress posts and pages. Users will be able to view, read, download, and even print the PDF file without leaving your site.

Read more…

Cấu hình SMTP với WordPress

Như các bạn đã biết, do hàm mail() của PHP khi gởi mail không cần chứng thực SMTP (khi gởi mail không cần khai báo địa chỉ gởi đi và chứng thực mật khẩu SMTP để gởi mail hợp lệ), chỉ cần khai báo địa chỉ gởi đến là có thể gởi mail thành công và chính điều này dẫn đến tình trạng server bị tổ chức chống Spam quốc tế ngăn chặn và không thể gới-nhận mail được nữa vì bị đưa vào danh sách Black List.

Do vậy, Mắt Bão đã chặn hàm mail() để tránh trường hợp trên xảy ra.

Tuy nhiên các bạn có thể gởi mail thành công từ website bằng cách thông qua thư viện phpmailer khi cấu hình SMTP đầy đủ trong form gởi mail trên website để thực hiện gởi mail hợp lệ.

Nếu website được xây dựng từ WordPress thì cấu hình như thế nào ?

+ Đăng nhập vào quản trị WordPress (Ví dụ: http://your-website.com/wp-admin/)

+ Vào menu Settings >> Chọn Email >> Advanced Email Options

Tại phần Mail Settings chọn và nhập các thông tin sau:

1.Sử dụng mail hosting :

– From Email: Nhập Email gởi

– From Name: Tên người gởi

– Mailer : chọn Send all WordPress emails via SMTP

– Return Path : unCheck

– SMTP Host: mail.demo.com

– SMTP Port: 25

– Encryption : No encryption // Mail hosting không hỗ trợ

– Authentication : Yes: Use SMTP authentication.

– Username : User đăng nhập của Email gởi

– Password : Password đăng nhập của Email gởi

2.Sử dụng Gmail :

– From Email: Nhập Email gởi

– From Name: Tên người gởi

– Mailer : chọn Send all WordPress emails via SMTP

– Return Path : unCheck

– SMTP Host: smtp.gmail.com

– SMTP Port: 465

– Encryption : Use SSL encryption

– Authentication : Yes: Use SMTP authentication

– Username : User đăng nhập của Email gởi

– Password : Password đăng nhập của Email gởi

 

Plugin: https://wordpress.org/plugins/wp-mail-smtp/

 

nhantam

Web developer team in Vietnam

Some Best WordPress Backup Plugins

Creating regular WordPress backups is the best thing you can do for your website. Backups give you a peace of mind and can save you in catastrophic situations when your site gets hacked or you accidentally lock yourself out. There are several free and paid backup plugins for WordPress, and most of them are fairly easy to use. In this article, we will show you the 7 best backup plugins for WordPress.

 

Important: Many WordPress hosting providers offer limited backup services, but please remember that it is your responsibility to backup your website on your own. Do not rely solely on your hosting provider for backups.

If you are not already backing up your site, then you should pick one of these 7 best WordPress bckup plugins and start using it right away.

1. VaultPress

VaultPress

At WPBeginner, we use VaultPress to backup our site. VaultPress was founded by Matt Mullenweg (WordPress co-founder) and his team at Automattic.

It is a subscription based service with different plans and pricing. VaultPress offers automated real-time cloud backup solution starting at $5 / month (which is good for most websites).

Setting up VaultPress and restoring from backups is just a matter of clicks. With some of their packages, they even offer security scans.

The only downside to VaultPress is that it is a recurring expense that can add up if you have multiple WordPress sites.

2. BackupBuddy

BackupBuddy - The most beginner friendly WordPress Backup Plugin

BackupBuddy is the most popular premium backup plugin for WordPress. It allows you to easily schedule daily, weekly, or monthly backups and store them in Dropbox, Amazon S3, Rackspace Cloud, FTP, Stash (their cloud service), and even email it to yourself.

The biggest advantage of using BackupBuddy is that it is not a subscription based service. You are licensed to use the plugin on the number of sites mentioned in your plan. You get access to premium support forums, updates, and 1GB of cloud storage to store your backups.

You can even use BackupBuddy to move WordPress to a new host with no Downtime.

3. CodeGuard

 

CodeGuard is an automated cloud backup service. Think of it as a time machine for your website.

It allows you to create complete daily backups of your website and store it in their secure offsite cloud servers. You can restore your backups with one click or download it in your computer for manual restore options.

Out of all the solutions mentioned in this article, CodeGuard is the only one that will work on all website platforms, not just WordPress.

You have the ability to monitor and track changes.

Similar to VaultPress, CodeGuard is a subscription service starting at $5 / month for individual websites.

However unlike VaultPress, CodeGuard is a great option for freelancers and agencies because their higher plans allow for multiple websites making the overall cost per backup significantly lower.

4. BackWPup

 

BackWPup is a free plugin that allows you to create complete WordPress backup for free and store it on the cloud (Dropbox, Amazon S3, Rackspace, etc), FTP, email, or on your computer.

It is extremely easy to use and allows you to schedule automatic backups according to your site’s update frequency.

Restoring a WordPress site from backup is also very simple. The BackWPup Pro version comes with priority support, ability to store backups on Google Drive, and some other cool features.

5. BackUpWordPress

BackupWordPress

BackupWordPress is a complete WordPress backup plugin with automatic scheduling support. It allows you to create different schedules for your database and files. The only problem is that the free version does not allow you to store your WordPress backups to a cloud storage service.

If you want to store your backups on Dropbox, Google Drive, FTP, etc, then you will need to purchase a premium extension for it. The extensions are available for each service, and you can buy the one you need or the whole bundle.

6. UpdraftPlus

 

UpdraftPlus is another WordPress backup plugin. It allows you to create complete backup of your WordPress site and store it on the cloud or download to your computer. The plugin allows you to create scheduled backups and store them to your chosen location. There is a premium version of the plugin with additional features and addons.

The only downside of Updraftplus is that despite having great features, it has a cluttered user interface. This makes it difficult for beginners to locate the options they need. Despite the clutter, it still has a very good rating in the WordPress plugins directory.

7. Duplicator

 

As the name suggests, Duplicator is a popular WordPress plugin used to migrate WordPress sites. However it is also has backup features.

It does not allow you to create automated scheduled backups which makes it less than ideal for a regularly maintained site to use as its primary backup solution.

Bonus: WP-DB-Backup

WP-DB-Backup

With more than 2 Million downloads, WP-DB-Backup is one of the most popular WordPress backup plugins. The only problem is that it only backups yourWordPress database.

This means that you will have to backup your media files manually. If you do not update a site too often or do not upload images, then you can use WP-DB-Backup as your primary WordPress backup plugin.

WP-DB-Backup makes it really simple to create database backups, schedule automated backups, and restore your database. It is also a very useful tool for users who do not have access to phpMyAdmin to backup WordPress dataabase manually.

Conclusion

Each WordPress backup plugin has it’s Pros and Cons. We use and recommend VaultPress for two main reasons. First it is extremely easy to use. Second, it offers real-time incremental backups. What that means is that instead of backing up all of your files every day or every hour, it only creates a backup of what has updated and literally within minutes of the update. This is ideal for large sites like ours because it allows us to use our server resources efficiently.

However if you run a small-medium size website and hate paying monthly fees, then we recommend the popular BackupBuddy plugin. Why? Because they have their own cloud storage, Stash, which makes it easy for beginners to store their backups in cloud with a matter of few clicks.

That’s all. We hope that this list helped you pick the best WordPress backup plugin for your site. Make regular backups a habit and save yourself from a lot of trouble.

 

nhantam

WordPress developer team

Khắc phục lỗi truy cập PHPMyAdmin on Xampp – Mac or Windows

Khi bạn truy cập http//localhost/phpmyadmin đôi khi bạn gặp thông báo sau:

Wrong permissions on configuration file, should not be world writable!

Cách giải quyết như sau:

 

Đối với hệ điều hành Linux:
chmod 0755 config.inc.php
Đối với Windows, Mac:
Mở file ../phpmyadmin/config.inc.php
$cfg['CheckConfigurationPermissions'] = false;

Sẽ hết lỗi trên
Chúc các bạn thành công

nhantam
Vietnam web design company

Categories: PHP Tags:

PHP làm tròn với số lẻ

PHP cung cấp rất nhiều hàm & cách làm tròn với số lẻ. nhantam giới thiệu một cách khá độc đáo sau:

 

Ví dụ:

 



rtrim(rtrim(sprintf('%.1f', $price), '0'), '.');

$price = 3.84 // output 3.8 
$price = 3.8511 // output 3.9 
$price = 3.99 // output 4 

Chúc các bạn thành công

 

nhantam
Senior PHP Developer at Panpic
thiet ke web