Hướng dẫn wordpress display posts on page - wordpress hiển thị bài viết trên trang

Ngoài việc sản xuất nội dung hấp dẫn và sâu sắc, các blogger WordPress còn liên tục làm việc để giữ chân độc giả của họ. Một cách để làm điều đó là bằng cách tạo các trang có chứa tất cả các bài đăng của bạn, với các trang mới nhất trên đầu hoặc với các bài đăng của bạn được sắp xếp theo một thứ tự cụ thể. Bằng cách làm như vậy, bạn đảm bảo rằng độc giả của bạn, sau khi hoàn thành một bài viết họ thích, có thể tìm thấy thêm nội dung liên quan. Các lợi ích khá rõ ràng - bài đăng của bạn sẽ có nhiều lượt xem hơn, cho bạn phạm vi tiếp cận lớn hơn và khả năng đạt được doanh thu lớn hơn từ quảng cáo và liên kết liên kết.

Hiển thị tất cả các bài viết trên một trang

Có nhiều phương pháp khác nhau bạn có thể sử dụng để hiển thị bài đăng trên trang trong WordPress. Chúng tôi sẽ chỉ ra một số cách chúng tôi thấy hữu ích nhất. Bạn nên thử tất cả các đề xuất của chúng tôi cho đến khi bạn tìm thấy một điều phù hợp nhất với nhu cầu của bạn. Do đó, nếu bạn muốn bỏ qua trước một phương pháp cụ thể, trong bài viết này, chúng tôi sẽ trình bày các cách sau đây để tạo trang blog WordPress:

Cách tạo trang blog WordPress bằng các tùy chọn mặc định

Một trong những chức năng WordPress mặc định là hiển thị các bài đăng mới nhất của bạn trên trang chủ của bạn. Tuy nhiên, người dùng thường muốn phân biệt giữa trang chủ của họ và trang có chứa các bài đăng. Điều này có thể dễ dàng đặt vì đây là một trong những tùy chọn WordPress mặc định, nằm trong phần Cài đặt.

Một điều kiện tiên quyết cho phương pháp này là có một trang trống [không có nội dung trước đó], sẽ phục vụ để hiển thị tất cả các bài đăng của bạn. Nếu bạn không có một trang như vậy, hãy tạo nó bằng cách điều hướng đến các trang> Thêm mới. Thêm một tên thích hợp vào trang [ví dụ: blog] và nhấn nút xuất bản.navigating to Pages > Add New. Add an appropriate name to the page [e.g. Blog], and press the Publish button.

Khi bạn đã tạo trang, điều hướng đến Cài đặt> Đọc. Dưới trang chủ của bạn hiển thị chọn tùy chọn cho một trang tĩnh. Điều này sẽ cho phép bạn chọn một trang làm trang chủ của bạn và một trang khác làm trang bài đăng của bạn. Tùy chọn thứ hai là những gì chúng tôi quan tâm. Bạn sẽ sử dụng trang trống bạn đã tạo trước đó và đặt nó làm trang bài đăng của bạn bằng cách tìm và chọn nó từ menu thả xuống. Sau đó, nhấn nút Lưu thay đổi bên dưới.navigate to Settings > Reading. Under Your homepage displays choose the option for A static page. This will enable you to select one page as your homepage and another page as your Posts page. The latter option is what we are interested in. You’re going to use the blank page you created earlier and set it as your Posts page by finding and selecting it from the dropdown menu. Then, press the Save Changes button below.

Điều này sẽ hiển thị tất cả các bài đăng WordPress trên một trang đó và chúng sẽ được cách điệu dựa trên chủ đề bạn đang sử dụng. Một cài đặt bổ sung mà bạn nên biết là các trang blog hiển thị nhiều nhất, có thể thấy trên ảnh chụp màn hình ở trên. Giá trị mặc định của nó được đặt thành 10, có nghĩa là nó sẽ hiển thị tối đa 10 bài đăng trên một trang. Do đó, nếu trang web của bạn có hơn 10 bài đăng, trang blog WordPress mới được tạo của bạn sẽ có tính năng phân trang gần phía dưới, cho phép người đọc thấy có bao nhiêu trang nội dung trong blog của bạn.the Blog pages show at most option, which can be seen on the screenshot above. Its default value is set to 10, meaning it will show up to 10 posts on a single page. Therefore, if your website has more than 10 posts, your newly created WordPress blog page will have a pagination feature near the bottom, letting readers see how many pages of content there are in your blog.

Tuy nhiên, nếu bạn không muốn có tính năng phân trang và muốn hiển thị tất cả các bài đăng trên trang blog WordPress của bạn, bạn có thể làm điều đó. Chỉ cần chèn một số lớn hơn số bài đăng hiện tại của bạn trên trang web. Nhưng, hãy xem xét rằng điều này có hai nhược điểm nghiêm trọng. Một số lượng lớn các bài đăng sẽ tăng thời gian trang blog của bạn mất để tải, cũng như làm cho trang rất dài và khó cuộn qua.

Sau khi bạn điều chỉnh số lượng bài viết sẽ được hiển thị trên mỗi trang, bạn đã hoàn thành. Điều duy nhất còn lại là kiểm tra trang bài viết của bạn. Tùy thuộc vào chủ đề mà bạn sử dụng, nó có thể trông giống như ảnh chụp màn hình được đưa ra dưới đây.check your Posts page. Depending on the theme you’re using, it might look like the screenshot given below.

Tuy nhiên, nếu bạn nhận ra rằng bạn không tìm thấy thiết kế của trang bài đăng của mình, chúng tôi khuyên bạn nên chọn trang bạn chọn làm trang bài đăng của bạn và thử một số đề xuất khác của chúng tôi dưới đây.if you realize you don’t find the design of your Posts page appealing, we advise unselecting the page you choose as your Posts page and trying some of our other suggestions below.

Cách tạo trang blog WordPress bằng cách sử dụng các mẫu trang blog cụ thể theo chủ đề

Nếu bạn không muốn sử dụng chức năng trang WordPress Post hoặc không thích thiết kế của nó, bạn nên xem liệu chủ đề bạn đang sử dụng có mẫu trang phù hợp với nhu cầu của bạn không. Các chủ đề thường sẽ bao gồm các mẫu trang liên quan đến blog, vì vậy bạn nên điều tra nếu đây cũng là trường hợp với chủ đề bạn hiện đang sử dụng.

Kiểm tra điều này là dễ dàng. Bạn chỉ cần nhấp để chỉnh sửa một trang và sau đó định vị phần Thuộc tính trang ở phía bên phải của màn hình. Khi bạn nhấp vào danh sách thả xuống bên cạnh mẫu: Tùy chọn, bạn sẽ thấy danh sách các mẫu trang có sẵn trong chủ đề của bạn. Tìm kiếm các mẫu có chứa blog từ. Trong trường hợp bạn thấy có nhiều mẫu có sẵn, hãy đảm bảo kiểm tra tất cả, để tìm ra mẫu mà hấp dẫn nhất đối với bạn. Bạn có thể làm điều đó chỉ bằng cách chọn một mẫu và nhấn nút cập nhật để cập nhật trang.click to edit a page and then locate the Page Attributes section on the right side of the screen. When you click on the dropdown next to the Template: option, you will see the list of page templates available within your theme. Look for templates that contain the word Blog. In case you find there are multiple templates available, make sure to examine them all, to find the one that’s most appealing to you. You can do that simply by selecting a template and pressing the Update button to update the page.

Sau đó, hãy kiểm tra trang sẽ chứa tất cả các bài đăng WordPress của bạn. Tùy thuộc vào chủ đề mà bạn sử dụng, nó có thể trông giống như ảnh chụp màn hình của chúng tôi dưới đây.check the page which will contain all your WordPress posts. Depending on the theme you’re using, it might look similar to our screenshot below.

Repeat the same process for all your theme’s available blog-related page templates until you find the one you like. If, however, your theme doesn’t have relevant page templates or you aren’t satisfied with the look of the page templates you checked, try one of our other suggestions.

Displaying all your blog posts using a plugin

One of the greatest advantages of WordPress is the plethora of plugins it has developed for almost any purpose. Therefore, to solve a problem or add a feature, you will often need to investigate and test certain plugins.

Firstly, look whether the plugins you already have active on your site contain an option or a shortcode that could help show all your WordPress posts on a single page. This process greatly differs based on the plugins you are using, so we can’t provide you with any universal instructions on the matter. If you weren’t able to find a suitable option or shortcode, explore the available WordPress plugins.

Displaying your posts in Elementor using a plugin

If you’re an Elementor user, you may want to check out Qi Addons for Elementor, the largest collection of widgets for various purposes. One of them is the Blog List widget, a handy little tool for organizing your blog posts into lists and displaying them on your page.

After you install and activate the plugin, simply select the Blog List element from the menu, add it anywhere you see fit, and customize it as per your liking.

Note that with this plugin you can also use any of the other 150+ widgets that come with it, not just the Blog List. It comes with extensive typography and blogging options, as well as showcase addons, SEO and business elements and much more.

Displaying your posts in Gutenberg using a plugin

For those who prefer Gutenberg, we have a similarly useful and stylish solution. Qi Blocks for Gutenberg is a collection of 80+ exclusive Gutenberg blocks, and the one you will need for the topic of this article is Blog List. After installing the plugin [which comes in a free and premium version, and the Blog List block among the free ones] you will get a selection of blocks to complement your default Gutenberg ones. Add the Blog List to your page and proceed to style it using the intuitive and beginner-friendly block options.

The block allows you to set images, publication dates, categories, author info and much more. You can change the colors, fonts, add or remove buttons and labels and much more.

Displaying your posts using WP Show Posts

If none of the above options suit you [which we doubt], you can give WP Show Posts a shot. This plugin works by creating a shortcode you can post anywhere you want to display your blog posts. You can set the title, pick a taxonomy to show, set pagination and change the number of posts per page.

You can go through the remaining option tabs to adjust the options that will be relevant to you. Among others, these tabs include options regarding the number of columns and the space between the columns, whether the post should contain its featured image, as well as the alignment and location of that image. There are options regarding the length of the excerpt, the possibility of renaming the Read more button, the choice to add relevant metadata [author, date, category], as well as to exclude some posts [by ID or author] and adjusting the ordering rules.

Carefully examine and adjust these options. When you’re done, press the Publish button in the right section of the screen. Then, copy the shortcode from the Usage section on the right.

You need to paste this shortcode inside your page. Depending on which page builder you are using, this process can vary. In Gutenberg, you will use the Shortcode block. In Elementor, you will need the Text Editor element, and in WPBakery use the Text Block element.

After inserting the shortcode using your preferred page builder, check the page. Depending on your chosen design and options set in the plugin, your page might look similar to our screenshot.

How to Create your custom blog template

If you have already tried our previous suggestions but didn’t like the resulting page, then the best way for you is to use code to create your WordPress blog page. However, we don’t advise this to any newer WordPress users, as it requires significant coding knowledge, as well as the use of FTP. But if you do decide to try this method, we highly advise you to backup your website before attempting to make a custom template. Keep in mind any coding error can break your site.

The first step to creating a custom page template is creating a new file at the proper location and naming it adequately. To do so, connect to your server using your FTP credentials and navigate to your root WordPress directory. Then, navigate to the directory of the theme you are currently using, i.e. the /wp-content/themes/theme-name/ directory. Right-click within that directory while making sure not to click on any of the files of subfolders found there. Then, click on the Create new file option from the menu that appears.

Tên tệp phải được viết chữ thường, với phần mở rộng .php ở cuối. Trong trường hợp nhiều từ, thay vì không gian, sử dụng dấu gạch nối [-] giữa các từ. Có nghĩa là, đặt tên cho tệp theo định dạng sau: tên của bạn-file.php, sau đó bạn nên nhấn nút OK.name the file in the following format: your-file-name.php, after which you should press the Ok button.

Điều này sẽ tạo một tệp .php trống nơi bạn cần thêm mã phù hợp cho mẫu trang của mình.

Để tạo một mẫu trang hiển thị tất cả các bài đăng, bạn chỉ cần triển khai vòng lặp WordPress. Vì mã hóa một mẫu trang từ đầu có thể khá khó khăn, bạn luôn có thể sử dụng mã từ tệp page.php của chủ đề của bạn làm đường cơ sở, sau đó điều chỉnh nó theo nhu cầu của bạn. Ngoài ra, bạn cũng có thể sử dụng mẫu trang chúng tôi đã tạo cho bài viết này.page.php file of your theme as a baseline, and then adjust it according to your needs. Additionally, you can also use the page template we created for this article.

Chủ Đề