Cách xây dựng WordPress Blog trong Drupal

Cách xây dựng WordPress Blog trong Drupal

There's a phrase commonly used by Drupal fans:

"If you want to build a blog, use WordPress. If you want to bulld WordPress, use Drupal."

We actually had a very simular question from one of our members. They wanted to know how to make Drupal look like WordPress.Cách xây dựng WordPress Blog trong Drupal

In this tutorial, we're going to show you how to replicate the basic WordPress blog features in Drupal.

WordPress blog widgets

In this tutorial, we're going to use WordPress 3.5 because it's easier to see the widgets than with the new theme in WordPress 3.6.

The image above shows the following blocks on the right side.

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta

We're going to show you how to create those 5 blocks in Drupal.

media_1382379808027.png

#1. Recent posts

Out of the box, Drupal ships with a block called Recent content (the first block you see in the screen shot above). Personally, I'm not real excited about how the block looks but it's there, ready to use.

To make a block that look like the one in our example, we'll need a module called Views so we can create it. Below are the steps.

Download and Install Modules

Enable Views

  • Click on Modules in the black admin menu bar.
  • Scroll to the bottom and check the box for Views and Views UI.
  • Click Save Configuration.
  • Click Continue to allow Drupal to enable Chaos Tools.

Build the Recent Posts Block

  • Click Structure, then Views.
  • Click Add new view.
  • Name your view (whatever you want but Recent Posts sounds good).
  • Uncheck Create a page.
  • Check Create a block.
  • Select HTML list from the Display format (so we can have a bulleted list)
  • Click Save & exit.

Enable the New Block

  • Click on Structure, then Blocks
  • Locate the block called View: Recent Posts
  • From the dropdown in the region column, select the second or right sidebar (region labels will vary from theme to theme).
  • Click Save blocks
  • Close the admin overlay by clicking the X in the top right corner of the overlay

media_1382380743800.png

#2. Recent Comments

The WordPress Recent Comments block shows the author of the comment and the title of the post upon which the comment was made. Drupal's default Recent Comment blocks shows the subject line of the comment (not the post upon which it posted) and how long ago. To mimic the Wordpress block, we need Views.

Views Default Recent Comments View
Views ships with a view called Recent comments but it mimics the default block that ships with Drupal. You could enable the block and edit it (using the instructions below or simply create it from scratch via the instructions below).

Build the Recent Comments Block

  • Click Structure, then Views
  • Click Add new view
  • Name your view (whatever you want but Recent Comments sounds good)
  • Select Comments from the Show dropdown
  • Uncheck Create a page
  • Check Create a block
  • Select HTML list from the Display format (so we can have a bulleted list)
  • Change Comments to fields in the next dropdown
  • Click Continue and edit
  • Click Add next to Fields
  • In the search field, type author
  • Select Comment: Author
  • Click Apply
  • Uncheck Create a label
  • Click Apply
  • Click Add next to Fields
  • In the search field, type Title
  • Select Content: Title
  • Click Apply
  • Uncheck Create a label
  • Click Apply
  • Click the arrow next to Add, then click rearrange.
  • Click on the first Content: Title field
  • Click Remove
  • Under Format, locate Show. Click Settings next to Fields
  • Check the boxes for Comment: Author and (Content) Content: Title
  • In the separator field, type on (include a space before and after 'on')
  • Scroll down to see a preview
  • Scroll up and click Save in the top right corner

Enable the New Block

  • Click on Structure, then Blocks
  • Locate the block called View: Recent Comments
  • From the dropdown in the region column, select the second or right sidebar (region labels will vary from theme to theme).
  • Click Save blocks
  • Close the admin overlay by clicking the X in the top right corner of the overlay

media_1382382271228.png

#3. Archives

Drupal does not ship with a default block called Archives. You need Views. However, we are in luck. Views ships with a default Archive view.

Enable and Edit the View

  • Click Structure, then Views
  • Click Enable for the View called Archive
  • Click Edit to the right of the newly enabled view
  • Click Monthly archive next to Title
  • Rename to Archives.
  • Save the View

Enable the New Block

  1. Click on Structure, then Blocks
  2. Locate the block called View: Archives
  3. From the dropdown in the region column, select the second or right sidebar (region labels will vary from theme to theme).
  4. Click Save blocks
  5. Close the admin overlay by clicking the X in the top right corner of the overlay.

media_1382382611343.png

#4. Categories

After installation, every Drupal site has one taxomony. The taxonomy can have multiple vocabularies. Each vocabulary has multiple terms. Terms are used to categorize content in Drupal.

Therefore, the block we will create will list terms from the Tags vocabulary (which ships with Drupal).

Build the Recent Posts Block

  1. Click Structure, then Views
  2. Click Add new view
  3. Name your view (whatever you want but Categories sounds good)
  4. Select Taxomony terms from the Show dropdown
  5. Uncheck Create a page
  6. Check Create a block
  7. Select HTML list from the Display format (so we can have a bulleted list)
  8. Click Save & exit

Enable the New Block

  1. Click on Structure, then Blocks
  2. Locate the block called View: Categories
  3. From the dropdown in the region column, select the second or right sidebar (region labels will vary from theme to theme)
  4. Click Save blocks
  5. Close the admin overlay by clicking the X in the top right corner of the overlay.

media_1382384309557.png

#5. Meta

The WordPress block called Meta appears to be a menu block, versus a list of dynamically generated links - as we have seen so far. In order to create a menu in Drupal, perform the following steps. Please note that the scope of this blog does not include creating pages called Entries RSS and Comments RSS.

Create the Menu

  • Click on Structure, then Menus
  • Click on Add Menu
  • Name it Meta

Add Menu items

  • Click Add link
  • Enter Login for the menu title and user for the path
  • Save
  • Click Add link again
  • Enter Site RSS for the menu title and rss.xml for the path
  • Save

Enable the New Block

  • Click on Structure, then Blocks
  • Locate the block called Meta
  • From the dropdown in the region column, select the second or right sidebar (region labels will vary from theme to theme)
  • Click Save blocks
  • Click_hold_drag the Meta block to the bottom of the list of blocks shown in the second sidebar
  • Save
  • Close the admin overlay by clicking the X in the top right corner of the overlay

media_1382384747501.png

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Khanh Hoang

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Phần 1 - Custom Image Search với Solr, Filefield Sources và CtoolsPhần 1 - Custom Image Search với Solr, Filefield Sources và CtoolsPhần 1 - Custom Image Search với Solr, Filefield Sources và Ctools

Phần 1 - Custom Image Search với Solr, Filefield Sources và Ctools

As I mentioned above, I also wanted to index metadata about the image to allow for better searching, so I needed to find a way to store that data.

Bảng giá khuyến mãi SEO chào mừng 30/4 và 1/5

Bảng giá khuyến mãi SEO chào mừng 30/4 và 1/5

Việc phát triển website, SEO từ khóa tìm kiếm khách hàng, đã dần thay thế cho những hoạt động marketing truyền thống, chỉ với một website và vài từ khóa về sản phẩm, dịch vụ của bạn được đứng Top trong Google thì bạn đã có cơ hội tiếp cận với hàng ngàn khách hàng mỗi ngày.

Philippines đoạt 9 vương miện sắc đẹp quốc tế trong 10 năm qua, điều này làm bùng nổ các cuộc thi nhan sắc ở quốc gia này

Phía sau các cuộc thi hoa hậu ở Philippines là tiền và tình

Trong thế giới của hoa hậu, nhan sắc, danh vọng và tiền bạc còn đi kèm với những cạm bẫy không thể lường trước, những phi vụ trao đổi thân xác sẽ giúp bạn thăng tiến nhanh hơn trong sự nghiệp

Công ty diệt chuột T&C

 

Diet con trung