Archive

Archive for the ‘Wordpress’ Category

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

Woocommerce hide flat rate when free shipping

Khi thiêt kế web bán hàng với plugin Woocommerce trên WordPress, bạn chi muốn hiển thị 1 trong các tùy chọn về phí giao hàng.

Ví dụ:

– Nếu tổng đơn hàng > 700.000 đ thì hiện Free Shipping
– Nếu tổng đơn hàng < 700.000 đ hiện Flat rate 30.000 đ (phí giao hàng charge thêm 30 ngàn)

 

 

 


// Hide standard shipping option when free shipping is available
add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 );

/**
 *  Hide Standard Shipping option when free shipping is available
 *
 * @param array $available_methods
 */
function hide_standard_shipping_when_free_is_available( $available_methods ) {

    if( isset( $available_methods['free_shipping'] ) AND 
        isset( $available_methods['flat_rate'] ) ) {

        // remove standard shipping option
        unset( $available_methods['flat_rate'] );
    }

    return $available_methods;
}

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

nhantam
công ty làm web app Panpic.vn

WordPress disable menu admin bar, help, ..etc

Khi release một website được viết trên nền WordPress, các bạn đã biết trong wp-admin có rất nhiều thành phần chỉ phù hợp khi làm việc với môi trường developer (cho lập trình viên) / khi giao website cho khách hàng, chúng ta nên ẩn nó đi để tránh khách hàng không hiểu hoặc mày mò vô tình làm bể cấu trúc giao diện

bài viết nhantam hướng dẫn remove admin menu bar & một số thành phần khác, các đoạn code sau các bạn thêm vào file functions.php trong theme của các  bạn

# Remove menu admin bar tại trang wp-admin


/**
* Admin remove notice update
*/
add_action('after_setup_theme','remove_core_updates');
function remove_core_updates()
{
if(! current_user_can('update_core')){return;}
add_action('init', create_function('$a',"remove_action( 'init', 'wp_version_check' );"),2);
add_filter('pre_option_update_core','__return_null');
add_filter('pre_site_transient_update_core','__return_null');
}

# Remove menu admin bar tai trang giao diện người dùng


show_admin_bar(false);

# Remove menu help của wordpress tại wp-admin


/*
Plugin Name: Remove Admin Help Tabs
*/
add_filter( 'contextual_help', 'mycontext_remove_help', 999, 3 );
function mycontext_remove_help($old_help, $screen_id, $screen){
$screen->remove_help_tabs();
return $old_help;
}

Lưu ý code trên chỉ phù hợp với WordPress version >= 3.0 trở lên

nhantam
Vietnam web design company

Việt hóa WordPress

Hiện tại wordpress.org đã hỗ trợ ngôn ngữ tiếng Việt khá tốt, nếu các bạn muốn cài đặt wordpress phiên bản tiếng Việt thì download tại đây: https://vi.wordpress.org

Trong trường hợp – trước đó các bạn đã lỡ cài đặt phiên bản wordpress tiếng Anh & dữ liệu trang web đã chạy ổn định, bây giờ muốn Việt hóa sang tiếng Việt mà không phải cài đặt lại & không ảnh hưởng tới dữ liệu thì làm như thế nào ?

Bước 1:
– Các bạn download phiên bản WordPress tương đương với phiên bản bạn bạn đang sử dụng tại link: https://vi.wordpress.org
– Giải nén file vừa download

Bước 2:  Việt Hóa
– Các bạn copy file language của phiên bản vừa download tại bước 1: wp-content/languages/ tất cả các file có phần ten-file-…-vi.mo
(các bạn lưu ý chỉ copy các file có tên “vi” trong tên file)
– Dán (paste) vào thư mục phiên bản wordpress bạn đang chạy với folder tương tự: wp-content/languages/

Bước 3:
Khai báo language tiếng Việt trong file wp-config.php
define(‘WPLANG’, ‘vi_VN’);

Bước 4:
wp-admin/settings/general/ kéo chuột xuống dưới cùng chọn languages: vi_VN / nhấp nút Save (Lưu lại)

Lúc này các bạn thấy wp-admin đã chuyển sang tiếng Việt. Như vậy là đã thành công

nhantam
Web Developer, PHP Developer
thiết kế web