<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thủ thuật wordpress Archives - Hi You, I am Tade</title>
	<atom:link href="https://hoangthuc.com/tag/thu-thuat-wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>https://hoangthuc.com/tag/thu-thuat-wordpress/</link>
	<description></description>
	<lastBuildDate>Wed, 15 Mar 2023 03:49:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://hoangthuc.com/wp-content/uploads/2024/02/logoTH-2-150x150.png</url>
	<title>Thủ thuật wordpress Archives - Hi You, I am Tade</title>
	<link>https://hoangthuc.com/tag/thu-thuat-wordpress/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Sử dụng media của wordpress để tải hình ảnh</title>
		<link>https://hoangthuc.com/su-dung-media-cua-wordpress-de-tai-hinh-anh/</link>
					<comments>https://hoangthuc.com/su-dung-media-cua-wordpress-de-tai-hinh-anh/#comments</comments>
		
		<dc:creator><![CDATA[Hoàng Thức]]></dc:creator>
		<pubDate>Wed, 20 Jun 2018 10:10:17 +0000</pubDate>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress nâng cao]]></category>
		<category><![CDATA[Thủ thuật wordpress]]></category>
		<category><![CDATA[wordpress nâng cao]]></category>
		<guid isPermaLink="false">https://hoangthuc.com/?p=547</guid>

					<description><![CDATA[<p>Hôm nay mình sẽ hướng dẫn cách sử dụng nút media trong quản trị wordpress để upload hình ảnh. Cốt lỏi của vấn đề là sử dụng đối tượng meta_image_frame trong thư viện wordpress. Mình sẽ tiến hành từng bước để các bạn nắm rõ: Bước 1: Tạo layout dạng HTML vu vơ và có các [&#8230;]</p>
<p>The post <a href="https://hoangthuc.com/su-dung-media-cua-wordpress-de-tai-hinh-anh/">Sử dụng media của wordpress để tải hình ảnh</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-548" src="https://hoangthuc.com/wp-content/uploads/2018/06/2018-06-20_164632.jpg" alt="" width="1432" height="144" srcset="https://hoangthuc.com/wp-content/uploads/2018/06/2018-06-20_164632.jpg 1432w, https://hoangthuc.com/wp-content/uploads/2018/06/2018-06-20_164632-300x30.jpg 300w, https://hoangthuc.com/wp-content/uploads/2018/06/2018-06-20_164632-900x91.jpg 900w" sizes="(max-width: 1432px) 100vw, 1432px" /></p>
<p>Hôm nay mình sẽ hướng dẫn cách sử dụng nút media trong quản trị wordpress để upload hình ảnh.</p>
<p>Cốt lỏi của vấn đề là sử dụng đối tượng <strong>meta_image_frame</strong> trong thư viện wordpress. Mình sẽ tiến hành từng bước để các bạn nắm rõ:</p>
<p>Bước 1: Tạo layout dạng HTML vu vơ và có các nút <strong>Media button</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;wrap&quot; id=&quot;theme_option&quot;&gt;
   
    &lt;div class=&quot;container-fluid&quot;&gt;
        &lt;div class=&quot;Logo&quot;&gt;
            &lt;div class=&quot;box-title&quot; data-toggle=&quot;collapse&quot; href=&quot;#logo&quot; aria-expanded=&quot;false&quot; aria-controls=&quot;logo&quot;&gt;Logo &lt;span class=&quot;dashicons dashicons-arrow-right-alt2 navbar-right&quot;&gt;&lt;/span&gt;&lt;/div&gt;
            &lt;div id=&quot;logo&quot; aria-expanded=&quot;false&quot; class=&quot;collapse in&quot;&gt;
                &lt;div id=&quot;images-container&quot; class=&quot;form-group&quot;&gt;
                    &lt;div class=&quot;input-group&quot;&gt;
                        &lt;input type=&quot;text&quot; name=&quot;wp_theme_logo_image&quot; id=&quot;logo-image&quot; class=&quot;form-control&quot; value=&quot;&quot;&gt;
                        &lt;div class=&quot;input-group-addon&quot;&gt;
                            &lt;input type=&quot;button&quot; class=&quot;logo-image-button btn btn-primary &quot; value=&quot;Chọn hình&quot;&gt;
                            &lt;input type=&quot;button&quot; class=&quot;remove-logo btn btn-primary&quot; value=&quot;Xóa&quot;&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class=&quot;clearfix&quot;&gt;&lt;/div&gt;
                &lt;/div&gt;&lt;!-- end images container --&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>&nbsp;</p>
<p>Bước 2: Khai báo thư viện <strong>Media </strong>và Script để gọi</p>
<pre class="brush: php; title: ; notranslate">
function wp_artisans_theme_back_end()
{
    wp_enqueue_media();
    wp_enqueue_script('custom', WP_PLUGIN_URL . '/Tester/bootstrap/js/admin_custom.js', array(),'',true );
}
add_action( 'admin_enqueue_scripts2', 'wp_artisans_theme_back_end' );
</pre>
<p>File Script</p>
<pre class="brush: xml; title: ; notranslate">
jQuery(document).ready(function($){
  // add image uploader functionality
        var meta_image_frame;
      $('.logo-image-button').live('click', function(e){
            e.preventDefault();

            if( meta_image_frame ){
             meta_image_frame.open();
                return;
            }

            meta_image_frame = wp.media.frames.file_frame = wp.media({
                title: 'Add Images',
                button: {text: 'Add to Images'},
                library: { type: 'image'}
            });

            meta_image_frame.on('select', function(){
                var media_attachment = meta_image_frame.state().get('selection').first().toJSON();

                   var url = '';

                $('#logo-image').val(media_attachment.url);
            });

            meta_image_frame.open();

      });
$('.remove-logo').click(function(){
$('#logo-image').val('');   
})
    
})
</pre>
<p>Lưu ý:</p>
<p>Bạn cần gọi hook <strong>admin_enqueue_scripts2  </strong></p>
<p>Đến đây là xong !</p>
<p>&nbsp;</p>
<p>Chúc các bạn may mắn.</p>
<p>&nbsp;</p>
<p>The post <a href="https://hoangthuc.com/su-dung-media-cua-wordpress-de-tai-hinh-anh/">Sử dụng media của wordpress để tải hình ảnh</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hoangthuc.com/su-dung-media-cua-wordpress-de-tai-hinh-anh/feed/</wfw:commentRss>
			<slash:comments>49</slash:comments>
		
		
			</item>
		<item>
		<title>Tạo template trong plugin wordpress</title>
		<link>https://hoangthuc.com/tao-template-trong-plugin-wordpress/</link>
					<comments>https://hoangthuc.com/tao-template-trong-plugin-wordpress/#comments</comments>
		
		<dc:creator><![CDATA[Hoàng Thức]]></dc:creator>
		<pubDate>Wed, 26 Jul 2017 10:01:22 +0000</pubDate>
				<category><![CDATA[Plugin wordpress]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress nâng cao]]></category>
		<category><![CDATA[plugin wordpress]]></category>
		<category><![CDATA[Taxonomy wordpress]]></category>
		<category><![CDATA[Thủ thuật wordpress]]></category>
		<category><![CDATA[wordpress nâng cao]]></category>
		<guid isPermaLink="false">https://hoangthuc.com/?p=508</guid>

					<description><![CDATA[<p>Thông thường để tạo template cho trang bạn phải vào theme để tạo template. Nhưng vấn đề ở đây là khi bạn muốn thay đổi theme thì template vẫn không thay đổi. Giải pháp đưa ra là bạn tạo template trong plugin để tách ra khỏi theme. Như vầy dù bạn có thay đổi theme [&#8230;]</p>
<p>The post <a href="https://hoangthuc.com/tao-template-trong-plugin-wordpress/">Tạo template trong plugin wordpress</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Thông thường để tạo template cho trang bạn phải vào theme để tạo template. Nhưng vấn đề ở đây là khi bạn muốn thay đổi theme thì template vẫn không thay đổi. Giải pháp đưa ra là bạn tạo template trong plugin để tách ra khỏi theme. Như vầy dù bạn có thay đổi theme thì template vẫn giữ nguyên. Tiêu biễu như plugin <strong>Woocommerce</strong></p>
<p>Các loại template các bạn dùng <strong>custom post</strong>, <strong>archive</strong> và <strong>page</strong>.</p>
<p>Các hook được sử dụng: <strong>single_template, archive_template</strong> và <strong>page_template</strong></p>
<p>Tiến hành code.</p>
<p>1.Custom post</p>
<p>Đối với custom post ta dung hook <strong>single_template. &#8216; YOUR_CUSTOM_POST &#8216;</strong> là tên custom post của bạn dùng.<strong> </strong></p>
<pre class="brush: php; title: ; notranslate">
function get_custom_post_type_single($single_template) {
    global $post;
    if ($post-&gt;post_type == 'YOUR_CUSTOM_POST') {
        $single_template = dirname( __FILE__ ) . '/single-YOUR_CUSTOM_POST.php';
    }
    return $single_template;
}
add_filter( 'single_template', 'get_custom_post_type_single' );
</pre>
<p>2.Archive</p>
<p>Đối với trang archive ta dung hook archive_template. &#8216; YOUR_TAXONOMY &#8216; là tên taxonomy của bạn dùng.</p>
<pre class="brush: php; title: ; notranslate">
function get_custom_archive($archive_template){
    global $wpdb;
    $archive =$wpdb-&gt;last_result;
    if ( $archive&#x5B;0]-&gt;taxonomy==  'YOUR_TAXONOMY' ) {
        $archive_template = dirname( __FILE__ ) . '/archive-YOUR_TAXONOMY.php';
    }
    return $archive_template;
}
add_filter( &quot;archive_template&quot;, &quot;get_custom_archive&quot; ) ;
</pre>
<p>3.Page Template</p>
<p>Đối với page bạn phải chọn slug chính xác thì template mới được sử dụng.</p>
<pre class="brush: php; title: ; notranslate">
add_filter( 'page_template', 'wpa_page_template' );
function wpa_page_template( $page_template )
{
if ( is_page( YOUR_SLUG ) ) {
$page_template = dirname( __FILE__ ) . '/templates/template-YOUR_SLUG.php';
}
return $page_template;
}
</pre>
<p>Chúc các bạn thành công !</p>
<p>The post <a href="https://hoangthuc.com/tao-template-trong-plugin-wordpress/">Tạo template trong plugin wordpress</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hoangthuc.com/tao-template-trong-plugin-wordpress/feed/</wfw:commentRss>
			<slash:comments>122</slash:comments>
		
		
			</item>
		<item>
		<title>Xóa slug trên custom post và custom taxonomy: Phần 2</title>
		<link>https://hoangthuc.com/xoa-slug-tren-custom-post-va-custom-taxonomy-phan-2/</link>
					<comments>https://hoangthuc.com/xoa-slug-tren-custom-post-va-custom-taxonomy-phan-2/#comments</comments>
		
		<dc:creator><![CDATA[Hoàng Thức]]></dc:creator>
		<pubDate>Fri, 17 Mar 2017 20:25:06 +0000</pubDate>
				<category><![CDATA[Custom post wordpress]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress nâng cao]]></category>
		<category><![CDATA[Taxonomy wordpress]]></category>
		<category><![CDATA[Thủ thuật wordpress]]></category>
		<category><![CDATA[wordpress nâng cao]]></category>
		<guid isPermaLink="false">https://hoangthuc.com/?p=483</guid>

					<description><![CDATA[<p>Nhằm giúp các bạn tối ưu đường dẫn 1 cách gọn nhất khi tạo các custom post mới. Mình có làm 1 tus cách xóa slug cho trang single và category khi tạo custom post, mà wordpress chỉ hổ trợ cho 2 loại là post và page. Phần 2 mình sẽ hướng dẫn về cách ẩn [&#8230;]</p>
<p>The post <a href="https://hoangthuc.com/xoa-slug-tren-custom-post-va-custom-taxonomy-phan-2/">Xóa slug trên custom post và custom taxonomy: Phần 2</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><em>Nhằm giúp các bạn tối ưu đường dẫn 1 cách gọn nhất khi tạo các <strong>custom post</strong> mới. Mình có làm 1 tus cách xóa slug cho trang single và category khi tạo custom post, mà wordpress chỉ hổ trợ cho 2 loại là post và page.</em></p>
<p>Phần 2 mình sẽ hướng dẫn về cách ẩn slug trên taxonomy custom post khi show bài viết. Các bạn nào chưa xem phần 1 hướng dẫn về cách<strong><a href="https://hoangthuc.com/xoa-slug-tren-custom-post-va-custom-taxonomy-phan-1/" target="_blank" rel="noopener"> ẩn slug trên custom post</a>.</strong></p>
<p>Phần này mình sẽ hướng dẫn theo 2 cách , thứ nhất là dung hook trong code wordpress, hai là dùng plugin wordpress. Cách 2 có thể dùng dễ dàng cho các bạn không rành về code wordpress.</p>
<p><strong>1.Dùng hook request để ẩn slug taxonomy</strong></p>
<pre class="brush: php; title: ; notranslate">

add_filter('request', 'rudr_change_term_request', 1, 1 );

function rudr_change_term_request($query){

$tax_name = 'report_category';
if( $query&#x5B;'attachment'] ) :
$include_children = true;
$name = $query&#x5B;'attachment'];
else:
$include_children = false;
$name = $query&#x5B;'name'];
endif;
$term = get_term_by('slug', $name, $tax_name);

if (isset($name) &amp;&amp; $term &amp;&amp; !is_wp_error($term)):

if( $include_children ) {
unset($query&#x5B;'attachment']);
$parent = $term-&gt;parent;
while( $parent ) {
$parent_term = get_term( $parent, $tax_name);
$name = $parent_term-&gt;slug . '/' . $name;
$parent = $parent_term-&gt;parent;
}
} else {
unset($query&#x5B;'name']);
}

switch( $tax_name ):
case 'category':{
$query&#x5B;'category_name'] = $name; // for categories
break;
}
case 'post_tag':{
$query&#x5B;'tag'] = $name; // for post tags
break;
}
default:{
$query&#x5B;$tax_name] = $name; // for another taxonomies
break;
}
endswitch;

endif;

return $query;

}

</pre>
<p>Note* Trong phần này mình dùng hàm <strong>rudr_change_term_request</strong> để filter hook <strong>request</strong></p>
<p><strong>2. Dùng plugin wp htaccess contro</strong>l</p>
<p>Các bạn vào setting &gt;&gt; htaccess control</p>
<p><img decoding="async" class="aligncenter size-full wp-image-485" src="https://hoangthuc.com/wp-content/uploads/2017/03/2017-03-18_031902-hoangthuc.jpg" alt="" width="1177" height="572" srcset="https://hoangthuc.com/wp-content/uploads/2017/03/2017-03-18_031902-hoangthuc.jpg 1177w, https://hoangthuc.com/wp-content/uploads/2017/03/2017-03-18_031902-hoangthuc-300x146.jpg 300w, https://hoangthuc.com/wp-content/uploads/2017/03/2017-03-18_031902-hoangthuc-900x437.jpg 900w" sizes="(max-width: 1177px) 100vw, 1177px" /></p>
<p>Chọn Remove Taxonomies and author base sau đó tắt các slug taxonomy mà bạn muốn.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-486" src="https://hoangthuc.com/wp-content/uploads/2017/03/2017-03-18_032127-hoangthuc.jpg" alt="" width="943" height="555" srcset="https://hoangthuc.com/wp-content/uploads/2017/03/2017-03-18_032127-hoangthuc.jpg 943w, https://hoangthuc.com/wp-content/uploads/2017/03/2017-03-18_032127-hoangthuc-300x177.jpg 300w, https://hoangthuc.com/wp-content/uploads/2017/03/2017-03-18_032127-hoangthuc-900x530.jpg 900w" sizes="(max-width: 943px) 100vw, 943px" /></p>
<p>Sau đó save lại. nếu vẫn chưa hoạt động các bạn vào setting &gt;&gt; permalink bấm  save lại.</p>
<p style="text-align: center;">Chúc các bạn thành công !</p>
<p>&nbsp;</p>
<p>The post <a href="https://hoangthuc.com/xoa-slug-tren-custom-post-va-custom-taxonomy-phan-2/">Xóa slug trên custom post và custom taxonomy: Phần 2</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hoangthuc.com/xoa-slug-tren-custom-post-va-custom-taxonomy-phan-2/feed/</wfw:commentRss>
			<slash:comments>49</slash:comments>
		
		
			</item>
		<item>
		<title>Xóa slug trên custom post và custom taxonomy: Phần 1</title>
		<link>https://hoangthuc.com/xoa-slug-tren-custom-post-va-custom-taxonomy-phan-1/</link>
					<comments>https://hoangthuc.com/xoa-slug-tren-custom-post-va-custom-taxonomy-phan-1/#comments</comments>
		
		<dc:creator><![CDATA[Hoàng Thức]]></dc:creator>
		<pubDate>Sat, 11 Mar 2017 02:51:34 +0000</pubDate>
				<category><![CDATA[Custom post wordpress]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress nâng cao]]></category>
		<category><![CDATA[Custom post wp]]></category>
		<category><![CDATA[Thủ thuật wordpress]]></category>
		<category><![CDATA[wordpress nâng cao]]></category>
		<guid isPermaLink="false">https://hoangthuc.com/?p=476</guid>

					<description><![CDATA[<p>Nhằm giúp các bạn tối ưu đường dẫn 1 cách gọn nhất khi tạo các custom post mới. Mình có làm 1 tus cách xóa slug cho trang single và category khi tạo custom post, mà wordpress chỉ hổ trợ cho 2 loại là post và page. Đầu tiên về custom post (nếu bạn nào chưa [&#8230;]</p>
<p>The post <a href="https://hoangthuc.com/xoa-slug-tren-custom-post-va-custom-taxonomy-phan-1/">Xóa slug trên custom post và custom taxonomy: Phần 1</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><em>Nhằm giúp các bạn tối ưu đường dẫn 1 cách gọn nhất khi tạo các <strong>custom post</strong> mới. Mình có làm 1 tus cách xóa slug cho trang single và category khi tạo custom post, mà wordpress chỉ hổ trợ cho 2 loại là post và page.</em></p>
<p>Đầu tiên về <strong><a href="https://hoangthuc.com/wordpress-nang-cao-1-custom-post-type/" target="_blank" rel="noopener">custom post</a></strong> (nếu bạn nào chưa biết về custom post có thể xem bài viết trước của mình).</p>
<p><strong>1.Xóa slug trên custom post trong trang single:</strong></p>
<p>Link custom post single ban đầu: https://hoangthuc.com/report/bao-cao-thu-chi/</p>
<p>Link custom post single cần thay thành: https://hoangthuc.com/bao-cao-thu-chi/</p>
<p>Custom post type mình làm ở đây là &#8220;report&#8221; nếu làm bạn có thể tùy biến custom post này. Các bạn vào file fucntions.php và thêm đoạn code có định dạng bên dưới.</p>
<pre class="brush: php; title: ; notranslate">
// remove slug custom_post type
function na_remove_slug( $post_link, $post, $leavename ) {

    if ( 'report' != $post-&gt;post_type || 'publish' != $post-&gt;post_status ) {
        return $post_link;
    }

    $post_link = str_replace( '/' . $post-&gt;post_type . '/', '/', $post_link );

    return $post_link;
}
add_filter( 'post_type_link', 'na_remove_slug', 10, 3 );
</pre>
<p>Note* Trong phần này bạn sẽ dung hàm <strong>na_remove_slug </strong>để filter vào hook<strong> post_type_link</strong></p>
<p><strong>2. Xữ lý lỗi 301 redirect khi chuyển:</strong></p>
<p>Trong quá trình remove slug như bước 1 wp sẽ xuất hiện lỗi 301 không tìm thấy trang. Cách xữ lý.</p>
<pre class="brush: php; title: ; notranslate">
function na_parse_request( $query ) {

    if ( ! $query-&gt;is_main_query() || 2 != count( $query-&gt;query ) || ! isset( $query-&gt;query&#x5B;'page'] ) ) {
        return;
    }

    if ( ! empty( $query-&gt;query&#x5B;'name'] ) ) {
        $query-&gt;set( 'post_type', array( 'post', 'report', 'page' ) );
    }
}
add_action( 'pre_get_posts', 'na_parse_request' );
</pre>
<p>Sau đó các bạn và <strong>Setting</strong> =&gt; <strong>Permalink</strong> và <strong>Save button</strong> lại để hoàn tất.</p>
<p>&nbsp;</p>
<p style="text-align: center;">Chúc các bạn thành công !</p>
<p>&nbsp;</p>
<p>The post <a href="https://hoangthuc.com/xoa-slug-tren-custom-post-va-custom-taxonomy-phan-1/">Xóa slug trên custom post và custom taxonomy: Phần 1</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hoangthuc.com/xoa-slug-tren-custom-post-va-custom-taxonomy-phan-1/feed/</wfw:commentRss>
			<slash:comments>49</slash:comments>
		
		
			</item>
		<item>
		<title>Lỗi redirect khi phân trang trong single wordpress</title>
		<link>https://hoangthuc.com/loi-redirect-khi-phan-trang-trong-single-wordpress/</link>
					<comments>https://hoangthuc.com/loi-redirect-khi-phan-trang-trong-single-wordpress/#comments</comments>
		
		<dc:creator><![CDATA[Hoàng Thức]]></dc:creator>
		<pubDate>Fri, 23 Sep 2016 06:38:43 +0000</pubDate>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress căn bản]]></category>
		<category><![CDATA[plugin wordpress]]></category>
		<category><![CDATA[Thủ thuật wordpress]]></category>
		<guid isPermaLink="false">https://hoangthuc.com/?p=454</guid>

					<description><![CDATA[<p>Đối với những trang như archive khi phân trang chúng ta có thể dễ dàng gọi phân trang bằng cách gọi hàm wp_pagenavi của wordpress. nếu bạn chưa biết về Phân trang wordpress có thể tham khảo bài viết trước của mình (Phân trang wordpress) Nhưng đối với những trang single khi tạo loop và phân [&#8230;]</p>
<p>The post <a href="https://hoangthuc.com/loi-redirect-khi-phan-trang-trong-single-wordpress/">Lỗi redirect khi phân trang trong single wordpress</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Đối với những trang như archive khi phân trang chúng ta có thể dễ dàng gọi <a href="https://hoangthuc.com/tao-phan-trang-trong-loop-wordpress/">phân trang</a> bằng cách gọi hàm wp_pagenavi của wordpress. nếu bạn chưa biết về Phân trang wordpress có thể tham khảo bài viết trước của mình (<a href="https://hoangthuc.com/tao-phan-trang-trong-loop-wordpress/">Phân trang wordpress</a>)</p>
<p>Nhưng đối với những trang single khi tạo loop và phân trang thì thường xuất hiện 1 lỗi đó chính lỗi redirect. Nó sẽ chuyển về trang đầu tiên khi bạn nhấn vào trang 2 3 hoặc trang nào không phải trang là 1.</p>
<p>Đây là do wordpress nó mặc định như vậy. Cách fix là cách bạn sẽ fix hook redirect_canonical trả redirect về giá trị false khi vào  single. Bằng đoạn code sau:</p>
<pre class="brush: php; title: ; notranslate">

add_filter('redirect_canonical','pif_disable_redirect_canonical');

function pif_disable_redirect_canonical($redirect_url) {
if (is_singular()) $redirect_url = false;
return $redirect_url;
}

</pre>
<p>Các bạn có thể đặt đoạn code sau vào function.php hoặc file nào có thể sử dụng dc function trong wordpress.</p>
<p>Chúc các bạn thành công.</p>
<p>&nbsp;</p>
<p>The post <a href="https://hoangthuc.com/loi-redirect-khi-phan-trang-trong-single-wordpress/">Lỗi redirect khi phân trang trong single wordpress</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hoangthuc.com/loi-redirect-khi-phan-trang-trong-single-wordpress/feed/</wfw:commentRss>
			<slash:comments>49</slash:comments>
		
		
			</item>
		<item>
		<title>Hiển thị thời gian kể từ ngày đăng trong wordpress</title>
		<link>https://hoangthuc.com/hien-thi-thoi-gian-ke-tu-ngay-dang-trong-wordpress/</link>
					<comments>https://hoangthuc.com/hien-thi-thoi-gian-ke-tu-ngay-dang-trong-wordpress/#comments</comments>
		
		<dc:creator><![CDATA[Hoàng Thức]]></dc:creator>
		<pubDate>Sun, 22 May 2016 16:41:03 +0000</pubDate>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress nâng cao]]></category>
		<category><![CDATA[Thủ thuật wordpress]]></category>
		<category><![CDATA[wordpress nâng cao]]></category>
		<guid isPermaLink="false">https://hoangthuc.com/?p=427</guid>

					<description><![CDATA[<p>Đây là một đoạn code nhỏ trong wordpress cho phép bạn hiển thị thời gian từ ngày đăng bài đến hiện tại. Các bạn có thể thêm nó vào file function.php /** * Display time since post was published * * @uses human_time_diff() Return time difference in easy to read format * @uses get_the_time() Get [&#8230;]</p>
<p>The post <a href="https://hoangthuc.com/hien-thi-thoi-gian-ke-tu-ngay-dang-trong-wordpress/">Hiển thị thời gian kể từ ngày đăng trong wordpress</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Đây là một đoạn code nhỏ trong wordpress cho phép bạn hiển thị thời gian từ ngày đăng bài đến hiện tại. Các bạn có thể thêm nó vào file function.php</p>
<pre class="brush: php; title: ; notranslate">

/**
 * Display time since post was published
 *
 * @uses	human_time_diff()  Return time difference in easy to read format
 * @uses	get_the_time()  Get the time the post was published
 * @uses	current_time()  Get the current time
 *
 * @return	string  Timestamp since post was published
 *
 * @author c.bavota
 */
function get_time_since_posted() {

	$time_since_posted = human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) . ' ago';

	return $time_since_posted;

}

</pre>
<p>Bây giờ các bạn có thể sử dụng hàm get_time_since_posted() để hiển thị thời gian từ ngày đăng bài cho đến hiện tại trong loop wordpress.<br />
Tham khảo hàm human_time_diff() tại <a href="http://codex.wordpress.org/Function_Reference/human_time_diff">http://codex.wordpress.org/Function_Reference/human_time_diff<br />
</a></p>
<p>The post <a href="https://hoangthuc.com/hien-thi-thoi-gian-ke-tu-ngay-dang-trong-wordpress/">Hiển thị thời gian kể từ ngày đăng trong wordpress</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hoangthuc.com/hien-thi-thoi-gian-ke-tu-ngay-dang-trong-wordpress/feed/</wfw:commentRss>
			<slash:comments>48</slash:comments>
		
		
			</item>
		<item>
		<title>Plugin furniture images tạo album, slideshow theo danh mục, tag</title>
		<link>https://hoangthuc.com/plugin-furniture-images-tao-album-slideshow-theo-danh-muc-tag/</link>
					<comments>https://hoangthuc.com/plugin-furniture-images-tao-album-slideshow-theo-danh-muc-tag/#comments</comments>
		
		<dc:creator><![CDATA[Hoàng Thức]]></dc:creator>
		<pubDate>Fri, 20 May 2016 09:08:14 +0000</pubDate>
				<category><![CDATA[Plugin wordpress]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Plugin nội thất]]></category>
		<category><![CDATA[plugin wordpress]]></category>
		<category><![CDATA[Thủ thuật wordpress]]></category>
		<guid isPermaLink="false">https://hoangthuc.com/?p=420</guid>

					<description><![CDATA[<p>Hôm nay mình giới thiệu 1 plugin nó là Furniture Images .Đây là 1 plugin do mình xây dựng chức năng chính của nó là tạo album ảnh, slideshow ảnh theo danh mục, thẻ tag. Plugin này có thể được sử dụng trong website Nội thất, web ảnh,.. Sau đây là hình ảnh về plugin. Slideshow ảnh [&#8230;]</p>
<p>The post <a href="https://hoangthuc.com/plugin-furniture-images-tao-album-slideshow-theo-danh-muc-tag/">Plugin furniture images tạo album, slideshow theo danh mục, tag</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hôm nay mình giới thiệu 1 plugin nó là <strong>Furniture Images</strong> .Đây là 1 plugin do mình xây dựng chức năng chính của nó là tạo album ảnh, slideshow ảnh theo danh mục, thẻ tag. Plugin này có thể được sử dụng trong website Nội thất, web ảnh,.. Sau đây là hình ảnh về plugin.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-421" src="https://hoangthuc.com/wp-content/uploads/2016/05/furniture-images.jpg" alt="furniture-images" width="900" height="420" srcset="https://hoangthuc.com/wp-content/uploads/2016/05/furniture-images.jpg 900w, https://hoangthuc.com/wp-content/uploads/2016/05/furniture-images-300x140.jpg 300w" sizes="(max-width: 900px) 100vw, 900px" /></p>
<p><strong>Slideshow ảnh</strong></p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-422" src="https://hoangthuc.com/wp-content/uploads/2016/05/furniture-images2.jpg" alt="furniture-images2" width="900" height="448" srcset="https://hoangthuc.com/wp-content/uploads/2016/05/furniture-images2.jpg 900w, https://hoangthuc.com/wp-content/uploads/2016/05/furniture-images2-300x149.jpg 300w" sizes="(max-width: 900px) 100vw, 900px" /></p>
<p><strong>Cách thức hoạt động</strong></p>
<p>Các bạn sẽ tạo 1 page và copy shortcode plugin vào content pages.</p>
<p>Plugin sẽ tạo ra 1 album ảnh với 2 bộ lọc là category và tag. Khi bạn click vào ảnh sẽ hiễn thị slideshow xem ảnh.</p>
<p>Plugin được viết trên dựa theo <strong><a href="https://hoangthuc.com/wordpress-nang-cao-1-custom-post-type/">Custom post</a></strong> nên các bạn có thể yên tâm quản lý 1 cách vô cùng đơn giản.</p>
<p>Màn khoe hàng của  mình đến đây là kết thúc nếu bạn nào thấy thích hãy liên hệ với mình nhé đừng ngại ngùng. Chúc các bạn 1 ngày đẹp trời!  Vô xem là vui rồi không cần phải share và like gì đâu. =))</p>
<p>The post <a href="https://hoangthuc.com/plugin-furniture-images-tao-album-slideshow-theo-danh-muc-tag/">Plugin furniture images tạo album, slideshow theo danh mục, tag</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hoangthuc.com/plugin-furniture-images-tao-album-slideshow-theo-danh-muc-tag/feed/</wfw:commentRss>
			<slash:comments>50</slash:comments>
		
		
			</item>
		<item>
		<title>WordPress căn bản 2 &#8211; Cấu hình wordpress</title>
		<link>https://hoangthuc.com/wordpress-can-ban-2-cau-hinh-wordpress/</link>
					<comments>https://hoangthuc.com/wordpress-can-ban-2-cau-hinh-wordpress/#comments</comments>
		
		<dc:creator><![CDATA[Hoàng Thức]]></dc:creator>
		<pubDate>Sun, 13 Mar 2016 15:37:52 +0000</pubDate>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress căn bản]]></category>
		<category><![CDATA[Thủ thuật wordpress]]></category>
		<guid isPermaLink="false">https://hoangthuc.com/?p=357</guid>

					<description><![CDATA[<p>Nối tiếp bài viết trước về cài đặt wordpress, bài này mình sẽ hướng dẫn các bạn cách cấu hình một trang wordpress trước khi sử dụng. 1.Cài đặt tiếng việt Vào Setting &#62;&#62; General . Chọn ngôn ngữ và múi giờ Cũng trong phần đó ta cài đặt phần người dùng đăng ký 2. Cài [&#8230;]</p>
<p>The post <a href="https://hoangthuc.com/wordpress-can-ban-2-cau-hinh-wordpress/">WordPress căn bản 2 &#8211; Cấu hình wordpress</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Nối tiếp bài viết trước về <strong><a href="https://hoangthuc.com/wordpress-can-ban-1-huong-dan-cai-dat/" target="_blank" rel="noopener">cài đặt wordpress</a></strong>, bài này mình sẽ hướng dẫn các bạn cách cấu hình một trang wordpress trước khi sử dụng.</p>
<p><strong>1.Cài đặt tiếng việt</strong></p>
<p>Vào <strong>Setting &gt;&gt; General</strong> . Chọn ngôn ngữ và múi giờ</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-358 size-full" src="https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_2.jpg" alt="wordpress_can_ban_2" width="1148" height="623" srcset="https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_2.jpg 1148w, https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_2-300x163.jpg 300w, https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_2-768x417.jpg 768w, https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_2-1024x556.jpg 1024w" sizes="(max-width: 1148px) 100vw, 1148px" /></p>
<p>Cũng trong phần đó ta cài đặt phần người dùng đăng ký</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-359" src="https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_22.jpg" alt="wordpress_can_ban_22" width="707" height="128" srcset="https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_22.jpg 707w, https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_22-300x54.jpg 300w" sizes="(max-width: 707px) 100vw, 707px" /></p>
<p><strong>2. Cài đặt hình ảnh</strong></p>
<p>Vào <strong>Setting &gt;&gt; Media</strong>. Cài đặt thông số như sau</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-360" src="https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_23.jpg" alt="wordpress_can_ban_23" width="745" height="446" srcset="https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_23.jpg 745w, https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_23-300x180.jpg 300w" sizes="(max-width: 745px) 100vw, 745px" /></p>
<p><strong>3. Cài đặt liên kết</strong></p>
<p>Vào <strong>Setting &gt;&gt; Permalink</strong>. Chọn như hình</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-361" src="https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_24.jpg" alt="wordpress_can_ban_24" width="1198" height="611" srcset="https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_24.jpg 1198w, https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_24-300x153.jpg 300w, https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_24-900x459.jpg 900w" sizes="(max-width: 1198px) 100vw, 1198px" /></p>
<p><strong>4. Cài đặt phần bình luận</strong></p>
<p>Vào <strong>Setting &gt;&gt; Discussion</strong>. Làm như hình</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-362" src="https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_25.jpg" alt="wordpress_can_ban_25" width="1181" height="627" srcset="https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_25.jpg 1181w, https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_25-300x159.jpg 300w, https://hoangthuc.com/wp-content/uploads/2016/03/wordpress_can_ban_25-900x478.jpg 900w" sizes="(max-width: 1181px) 100vw, 1181px" /></p>
<p>Đến đây các bạn cấu hình xong cơ bản cho wordpress. Bài tiếp theo mình sẽ hướng dẫn các bạn cài theme và plugin.</p>
<p>Chúc các bạn buổi tối vui vẻ !</p>
<p>&nbsp;</p>
<p>The post <a href="https://hoangthuc.com/wordpress-can-ban-2-cau-hinh-wordpress/">WordPress căn bản 2 &#8211; Cấu hình wordpress</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hoangthuc.com/wordpress-can-ban-2-cau-hinh-wordpress/feed/</wfw:commentRss>
			<slash:comments>49</slash:comments>
		
		
			</item>
		<item>
		<title>WordPress căn bản 1 &#8211; hướng dẫn cài đặt</title>
		<link>https://hoangthuc.com/wordpress-can-ban-1-huong-dan-cai-dat/</link>
					<comments>https://hoangthuc.com/wordpress-can-ban-1-huong-dan-cai-dat/#comments</comments>
		
		<dc:creator><![CDATA[Hoàng Thức]]></dc:creator>
		<pubDate>Fri, 29 Jan 2016 18:30:40 +0000</pubDate>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress căn bản]]></category>
		<category><![CDATA[Thủ thuật wordpress]]></category>
		<guid isPermaLink="false">https://hoangthuc.com/?p=317</guid>

					<description><![CDATA[<p>Tút này mình sẽ nói về chủ đề cài đặt wordpress. Mình sẽ hướng dẫn các bạn cài wordpress trên localhost. Đầu tiên bạn cần phải có : 1. Database. 2. Source wordpress Database &#8211; ở đây mình sữ dụng là wampserver thì các bạn sẽ vào đường dẫn localhost/phpmyadmin sau đó tạo 1 database mới [&#8230;]</p>
<p>The post <a href="https://hoangthuc.com/wordpress-can-ban-1-huong-dan-cai-dat/">WordPress căn bản 1 &#8211; hướng dẫn cài đặt</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Tút này mình sẽ nói về chủ đề cài đặt wordpress. Mình sẽ hướng dẫn các bạn cài wordpress trên localhost.</p>
<p>Đầu tiên bạn cần phải có :</p>
<p>1. Database.</p>
<p>2. Source wordpress</p>
<p><strong>Database</strong> &#8211; ở đây mình sữ dụng là wampserver thì các bạn sẽ vào đường dẫn localhost/phpmyadmin sau đó tạo 1 database mới và không làm gì cả.</p>
<p><strong> Source wordpress</strong> &#8211; bạn có thể tại trên trang wordpress.org, tải về và giải nén ra. Bạn sẽ có 1 thư mục là wordpress , sau đó bạn sẽ chép thư mục này vào theo đường dẫn D:wampwww (ở đây mình cài wamp ổ D). chú ý : tên thư mục wordpress chính là tên dường dẫn site của bạn.</p>
<p>Xong bước chuẩn bị. Bắt đầu cài chúng ta sẽ vào đường dẫn site cần cài ở đây là localhost/wordpress</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-327 size-full" src="https://hoangthuc.com/wp-content/uploads/2016/02/Untitled.jpg" alt="Untitled" width="525" height="595" /></p>
<p>Chọn ngôn ngữ và continue =&gt; let&#8217;s go =&gt; bạn sẽ được giao diện như vầy.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-328 size-full" src="https://hoangthuc.com/wp-content/uploads/2016/02/Untitled-1.jpg" alt="Untitled" width="925" height="609" /></p>
<p>Ta sẽ chỉnh các thông số</p>
<p>database name: tên database bạn đã tạo.</p>
<p>user name: dưới localhost là <strong>root</strong> nhé.</p>
<p>password: dưới localhost để  trống ko nhập gì.</p>
<p>database host: để nguyên localhost nhé.</p>
<p>Table prefix: Tiền tố table database bạn cứ để mặc định wp_</p>
<p>Sau khi submit =&gt; install wordpress =&gt; cài đặt thông tin site (tên site, tài khoản đăng nhập , mật khẩu đăng nhập, email) sau đó bấm install wordpress. Sau nó sẽ yêu cầu bạn đăng nhập tài khoản lúc nãy bạn nhập vào thế là xong. bạn đã cài đặt xong wordpress.</p>
<p>Chúc bạn thành công !</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://hoangthuc.com/wordpress-can-ban-1-huong-dan-cai-dat/">WordPress căn bản 1 &#8211; hướng dẫn cài đặt</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hoangthuc.com/wordpress-can-ban-1-huong-dan-cai-dat/feed/</wfw:commentRss>
			<slash:comments>50</slash:comments>
		
		
			</item>
		<item>
		<title>Thêm icon khi tạo custom post types trong wordpress</title>
		<link>https://hoangthuc.com/icon-khi-tao-custom-post-types-trong-wordpress/</link>
					<comments>https://hoangthuc.com/icon-khi-tao-custom-post-types-trong-wordpress/#comments</comments>
		
		<dc:creator><![CDATA[Hoàng Thức]]></dc:creator>
		<pubDate>Tue, 19 Jan 2016 02:48:53 +0000</pubDate>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Thủ thuật wordpress]]></category>
		<guid isPermaLink="false">https://hoangthuc.com/?p=292</guid>

					<description><![CDATA[<p>Khi bạn tạo một custom post mới ta sẽ thấy icon mặc định của wordpress là icon giống như bài viết. Hôm nay mình sẽ hướng dẫn cách thay đỗi icon mặc định custom post type. Đầu tiên và cũng nhanh nhất là sữ dụng plugin. Một vài plugin có thể dùng như là: CPT Custom [&#8230;]</p>
<p>The post <a href="https://hoangthuc.com/icon-khi-tao-custom-post-types-trong-wordpress/">Thêm icon khi tạo custom post types trong wordpress</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Khi bạn tạo một custom post mới ta sẽ thấy icon mặc định của wordpress là icon giống như bài viết. Hôm nay mình sẽ hướng dẫn cách thay đỗi icon mặc định custom post type.</p>
<p>Đầu tiên và cũng nhanh nhất là sữ dụng plugin. Một vài plugin có thể dùng như là:</p>
<p><a href="https://wordpress.org/plugins/cpt-custom-icon/" target="_blank" rel="noopener">CPT Custom Icon</a> bạn chỉ cần vào cài đặt và chọn thôi.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-294" src="https://hoangthuc.com/wp-content/uploads/2016/01/screenshot-2.png" alt="screenshot-2" width="760" height="524" srcset="https://hoangthuc.com/wp-content/uploads/2016/01/screenshot-2.png 760w, https://hoangthuc.com/wp-content/uploads/2016/01/screenshot-2-300x207.png 300w" sizes="(max-width: 760px) 100vw, 760px" /></p>
<p>&nbsp;</p>
<p><a href="https://wordpress.org/plugins/custom-post-type-ui/" target="_blank" rel="noopener">Custom Post Type UI </a> Bạn có thể dùng plugin này tạo và quản lý custom post types.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-293" src="https://hoangthuc.com/wp-content/uploads/2016/01/adding-font-icon-cpt-ui.jpg" alt="adding-font-icon-cpt-ui" width="520" height="327" srcset="https://hoangthuc.com/wp-content/uploads/2016/01/adding-font-icon-cpt-ui.jpg 520w, https://hoangthuc.com/wp-content/uploads/2016/01/adding-font-icon-cpt-ui-300x189.jpg 300w" sizes="(max-width: 520px) 100vw, 520px" /><br />
Wordpress hỗ trợ 1 thư viện icon cho bạn lựa chọn bạn có thể vào link <a title="Dashicons" href="https://developer.wordpress.org/resource/dashicons/#update" target="_blank" rel="nofollow noopener">Dashicons website</a> để tìm.</p>
<p>Cách 2 dùng code thêm vào trong custom post. Bạn sẽ dùng đoạn code sau:</p>
<pre class="brush: php; title: ; notranslate">

	'menu_icon'           =&gt; 'dashicons-cart',

</pre>
<p>Bạn cũng có thể sử dung đoạn url icon</p>
<pre class="brush: php; title: ; notranslate">

'menu_icon'           =&gt; 'http://www.example.com/wp-content/uploads/2014/11/your-cpt-icon.png',

</pre>
<p>Đoạn code tạo custom post với menu icon</p>
<pre class="brush: php; title: ; notranslate">
// Register Custom Post Type
function custom_post_type() {

	$labels = array(
		'name'                =&gt; _x( 'products', 'Post Type General Name', 'text_domain' ),
		'singular_name'       =&gt; _x( 'Product', 'Post Type Singular Name', 'text_domain' ),
		'menu_name'           =&gt; __( 'Products', 'text_domain' ),
		'parent_item_colon'   =&gt; __( 'Parent Item:', 'text_domain' ),
		'all_items'           =&gt; __( 'All Items', 'text_domain' ),
		'view_item'           =&gt; __( 'View Item', 'text_domain' ),
		'add_new_item'        =&gt; __( 'Add New Item', 'text_domain' ),
		'add_new'             =&gt; __( 'Add New', 'text_domain' ),
		'edit_item'           =&gt; __( 'Edit Item', 'text_domain' ),
		'update_item'         =&gt; __( 'Update Item', 'text_domain' ),
		'search_items'        =&gt; __( 'Search Item', 'text_domain' ),
		'not_found'           =&gt; __( 'Not found', 'text_domain' ),
		'not_found_in_trash'  =&gt; __( 'Not found in Trash', 'text_domain' ),
	);
	$args = array(
		'label'               =&gt; __( 'Products', 'text_domain' ),
		'description'         =&gt; __( 'Post Type Description', 'text_domain' ),
		'labels'              =&gt; $labels,
		'supports'            =&gt; array( ),
		'taxonomies'          =&gt; array( 'category', 'post_tag' ),
		'hierarchical'        =&gt; false,
		'public'              =&gt; true,
		'show_ui'             =&gt; true,
		'show_in_menu'        =&gt; true,
		'show_in_nav_menus'   =&gt; true,
		'show_in_admin_bar'   =&gt; true,
		'menu_position'       =&gt; 5,
		'menu_icon'           =&gt; 'dashicons-cart'
		'can_export'          =&gt; true,
		'has_archive'         =&gt; true,
		'exclude_from_search' =&gt; false,
		'publicly_queryable'  =&gt; true,
		'capability_type'     =&gt; 'page',
	);
	register_post_type( 'Products', $args );

}

// Hook into the 'init' action
add_action( 'init', 'custom_post_type', 0 );
</pre>
<p>Chúc các bạn thành công !</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://hoangthuc.com/icon-khi-tao-custom-post-types-trong-wordpress/">Thêm icon khi tạo custom post types trong wordpress</a> appeared first on <a href="https://hoangthuc.com">Hi You, I am Tade</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hoangthuc.com/icon-khi-tao-custom-post-types-trong-wordpress/feed/</wfw:commentRss>
			<slash:comments>46</slash:comments>
		
		
			</item>
	</channel>
</rss>
