ngốc 1

Ngốc ơi là ngốc. Sao vẫn cứ nhớ nhung vậy? Mày có biết người ta đang vui vẻ bên ai đó không Ngốc? Mày ở đây nằm nhờ người ta như vậy sao??? Hãy thức tỉnh đi cô gái Ngốc.

Build a custom WordPress theme


Today lab is your final exercise of our Web Design Bootcamp class. We will be building a basic custom WordPress theme using HTML, CSS, and a bit of PHP. The goal of the lab is to get you understand how WordPress templates work, and how you can make your own templates.

We will develop our custom WordPress theme in local environment (with MAMP). When we are happy with our theme, we can deploy it to the remote server using FileZilla.

First, we will create the main stylesheet style.css with theme information, and our core template files such as header.phpfooter.phpsidebar.php. Then we will create the index.php to load all the html elements from other files.

Below is a result of your custom theme (Blog page) with just dynamic HTML content:


Next, we will start styling our websites with the style.css, and we will add a few more template files such as functions.phppage.php, and single.php for further customization.

Here is a final result of your custom theme (Blog page) with dynamic HTML content and CSS styling:


Milestone 1: Update Homepage and Main Menu

Currently your homepage is showing all your Posts in reverse chronological order. We want to just show a static page. Let’s fix that.

  1. Create a Home page, and a few more pages such as ServicesPortfolio, and Blog. The Blog page will be the place showing all the latest Posts.
  2. Add some content to your Home page since it will be your landing page.
  3. Access your Main Menu from Appearance > Menus
  4. Remove the Sample Page from the Menu Structure, and add HomeServicesPortfolio, and Blog pages to the Menu. It should be in this order: Home, About Me, Services, Portfolio, Contact,Blog. Save your Menu.
  5. Go to Settings > Readiurg, choose Your homepage displays: A static page with Homepage: Home and Posts page: Blog then click Save Changes.
  6. Now, go back to your site and reload the browser, it should show your Home page as the landing page for your website:


Milestone 2: Create the core template files

  1. Go to /MAMP/htdocs/ and open the my-first-wp-site directory in your favorite text editor
  2. Go to /wp-content/themes and create a folder name mocha. We will build our custome theme inside this folder (all the files created will be in here):


    Now, let’s create the core template files. Beside one stylesheet, you will be making some PHP files. Don’t worry if you don’t know anything about PHP. You will still be able to create a custom theme in this lab.

    PHP files can read both HTML and PHP code. HTML code starts with HTML opening tag, content, then HTML closing tag e.g. <h1>Heading</h1>. PHP code starts with PHP opening tag <?php, PHP content, then PHP closing tag ?> e.g. <?php bloginfo('title'); ?>

    <h1><?php bloginfo('name'); ?></h1>
The above code is very common in a PHP file where the blog (post) name is dynamic and is styled by the HTML `<h1>` wrapper.

Create style.css

  1. Create a style.css file. This is your main stylesheet and you will be using only this stylesheet for all the styling in this exercise.
  2. Now, to follow WordPress standards for themes, we need to add a block of CSS comment to the top of style.css to define the theme:
    Theme Name: Mocha
    Theme URI:
    Author: [Your Name]
    Description: This is a custom theme made in CoderSchool Web Design Bootcamp
    Version: 1.0
    License: GNU General Public License v2 or later
    License URI:
The minimum you need to have in the comment block is the `Theme Name`. Save the stylesheet after adding the comment block. We aren't doing any styling yet. We will do it after we have all the HTML content loaded properly in our new custom theme.

Create header.php

  1. Create a header.php file. The header.php file contains the top part of index.html file that you normally know. It has the open <html> tag, the <head> content, and the top part of <body>.
  2. First, add the <head> content to the header.php
    <!DOCTYPE html>
    <html lang="en">
        <link rel="stylesheet" href="style.css">
  1. Now, input the dynamic content into your header.php file. Insert the php code <?php bloginfo('title'); ?> in your title tag. We don’t want to give the title a static name. If we just input something like My Blog for title, every single page of our WordPress site will have the title My Blog and we don’t want that.
  2. Another thing that we need to change is to make the css path href dynamic. Let’s add another another PHP bloginfofunction but this time we’re passing in the parameter stylesheet_url. This should be your result:
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
    <title><?php bloginfo('title'); ?></title>
  3. Next, add the first part of <body> content to the header.php

<nav class="main"></nav>

In here, we added a container, a header, a search box, and a navbar. Because the search box is floated. I need to clear the float by adding 

 right below the search box.

  1. Again, let’s make the content in the <body> dynamic:
  2. Add <?php bloginfo('name'); ?> inside the <h1> tag.
  3. We are not doing anything for the search box yet.
  4. For the navbar menu, add <?php wp_nav_menu(); ?> inside the <nav> tag. This should be your result:
        <h1><?php bloginfo('name'); ?></h1>
<nav class="main"><?php wp_nav_menu(); ?></nav >

We won’t be adding any logo for now, we will just be using the site title as the logo wrapped in h1 tag, the biggest heading available in HTML.

  1. Save the header.php file.

Create footer.php

  1. Create a footer.php file. This file contains the bottom part of the index.html file that you normally know: the
    content, the bottom part of <body>, and the closing </html> tag.
  2. Add a footer with a simple Copyright text, the © for the logo, 2018, and some closing tags:
            <footer>Copyright &copy; 2018</footer>

The closing </div> is for the container div (declared in header.php file). All content should be in the id = "container" div. That’s all we need for the footer.php. Save it.

Create sidebar.php

  1. Create a sidebar.php file.
  2. Add in the following html code:

Since the sidebar is pretty much likely will float on the right side, We added a div with style clear:both at the bottom.

This one line clear div code doesn’t do any harm, What it does is that if things are float above, they will stop floating at this div and below.

  1. Save the file.

Create index.php

  1. Now, let’s create an index.php file which will link all the above PHP files together (this file is like the index.html file)
  2. First, we grab the header.php first. We can do that with the PHP function get_header(). The function doesn’t take any parameters inside the parentheses. All functions need to have parentheses regardless of if they need parameters or not.
    <?php get_header(); ?>.
  1. At the bottom we want to bring in the sidebar, so we can do that with the get_sidebar() function.
  2. The last thing you want to include is the footer so let’s add it in with the get_footer() function.
  3. This should be your result in index.php up to this point
    <?php get_header(); ?>.

    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

With these functions, what it means is that we include header, sidebar, and footer pretty much every page.

Loop of Posts inside index.php

  1. We got the header, the sidebar, and the footer. Now, we need the area of posts in the middle, and this area is a loop of posts. The way that PHP is able to do this is through a loop. There are a few different kind of loops (for loop, while loop, etc). In this exercise, we will use the while loop. What we’ll try to do is to make a loop that says: “If there are posts, then show the next post.” All up until there’s no post in which the loop will end.
  2. Let’s do this. We want all the posts wrapped in a main div. Add this HTML code between the get_header() and get sidebar() functions:
  1. Now, inside this main div, include the while loop:
    <?php while(have_posts()) : the_post(); ?>

href=" the_permalink(); ?>"> the_title(); ?>

the_content(__('Continue Reading')); ?>
<?php endwhile; ?>

What it means here is that while there are posts, output all the posts.

If you look at the WordPress site, a Post has a title and a body content:

The <h2> tag is the title of the post. You can also use h3 or h4 for the post title. Then, we need to dynamically print out the post title between the h2 tag. To do that, we insert the_title() func inside the h2 tag.

Then, we need to make the title as a hyperlink. To do that, we add an anchor tag and wrap around the title. We use a PHP function the_permanlink() to specify where the link goes to. That’s the function when user click on the link title, they are taken to the page or to the single post.

Next, we add the body content with the the_content() code. We don’t want the content to be too long for a single post in a loop of posts. We add a paramenter __('Continue Reading') for the function to call. the_content() func will output the content (main body) of the post, and the ‘Continue Reading’ link is where we want it to be cut off.

We are not putting the date and name of the author yet, we’ll do that later.

The while loop is closed with the <?php endwhile; ?>. This will give us the loop of posts.

  1. What happens if there is no posts? We also need to cover this condition as well. I’ll use an if-else statement for this. If there are posts, we want to start the while loopElse, if there is no post, we want to display a text ‘Sorry, no posts were found’. Add this if-else statement code inside the main div:
    <?php if(have_posts()) : ?>

    <?php else : ?>

    <?php endif; ?>
  • The while loop should be nested inside the if(have_posts()) :.
  • Inside the else :, insert this code:
    <?php echo wpautop('Sorry, no posts were found'); ?>
  1. This should be the result of your if-else statement inside the main div:
id="main"> if(have_posts()) : ?> while(have_posts()) : the_post(); ?>

href=" the_permalink(); ?>"> the_title(); ?>

the_content(__('Continue Reading')); ?>
<?php endwhile; ?> <?php else : ?> <?php echo wpautop('Sorry, no posts were found'); ?> <?php endif; ?> </div>
  1. Save the index.php file.

Good job! We have completed the first part of our theme.

Milestone 3: Load your custom theme with dynamic HTML content

  1. Go to your wp-admin Dashboard
  2. Go to Apperance > Themes
  3. See now that I got my custom theme “Mocha” showing up here custom-themeThis is the template that we have made and is now available for us to use.
  4. Click on the theme to see the theme details. You can also try a Live Preview of it.
  5. Now, click on Activate
  6. This is what I have now for my ‘Blog’ Page


The PHP code reads the dynamic HTML content correctly, It reads the Title, the Main Menu, the loop of posts, the Post Title, the Post Content. It has the Continue Reading link. Click on the Post Title will take me to that single post.

It’s all working, we just need to add some styling to the side, which we’ll do in the next milestone.

Milestone 4: Style your theme with style.css

We now have a beautiful theme (just kidding it looks pretty bad). Let’s go back to the style.css file and start to add some styling, we also need to add a few more PHP template files as well.

CSS Reset

One good practice for website styling is to always include a reset stylesheet, and what it does is to zero out the paddings and the margins because different browsers have different paddings and margins to certain elements. For example, Internet Explorermight add 10px to an HTML element and Firefox might not. If we don’t reset everything at first and just keep the defaults it’s going to affect the way it looks in each browser so let’s include a reset file from now on.

The one I usually use is the eric myer’s css reset file: I’m not gonna add a new css file but will include the css reset code at the beginning of our main stylesheet style.css.

  1. Copy the css code from eric myer’s css reset file
  2. Go to the style.css and paste the css code at the top (below the comment block)
  3. Save it.
  4. Reload now and see that styling for your website has been reset (I will just use the Blog page for all captured screens since it has the most content):


Now, we have a clean slate since this is identical for all browsers.

Style body

  1. Now, let’s first start styling your <body>. Add this below the CSS Reset code:
    body {
        background: silver;
        font-size: 14px;
        font-family: arial;
        line-height: 1.6em;
        color: #666;
  1. Then, we style the core HTML elements: p, a, ul, ol, li, h1, h2, h3, and img. Add this below the body selector:
    p { margin: 10px 0; }
    a { color: #666; text-decoration: none; }
    ul, ol { padding: 10px 0 10px 10px; list-style: square; }
    ul li, ol li{ line-height: 1.8em; color: #000; }
    h1 { font-size: 26px; padding-bottom: 8px;}
    h2 { font-size: 22px; color: #666; padding: 8px 0;}
    h3 { font-size: 18px; color: #666; padding: 8px 0;}
    img { margin: 15px; }
  1. Save and reload the page, see some styles have been added


Style other HTML components

  1. Now ,let’s style your container:
    #container {
        width: 960px;
        margin: 0 auto;
        border: #ccc solid 1px;
        overflow: auto;
        background: #fff;
        padding: 20px 15px;
  1. Save the style.css and reload the WordPress site to see changes.
  2. Add some header styling:
    header { height: 70px; }
    header h1 { padding: 15px 10px; float: left; width: 400px; }
  1. Then, some navigation styling:
    nav.main { height: 35px; padding-top: 10px; background: #333; overflow: auto; margin-bottom: 10px; }
    nav.main ul { padding: 0; }
    nav.main ul li { float: left; padding:0 10px; list-style: none; font-size:15px; }
    nav.main a { color: #fff; }
  1. Save the style.css and reload the WordPress site to see changes.


We floated the list items of the nav to the left, and make them inline, gave some styling to it.

Style posts

  1. Next thing we want to do is to style our posts. Add the following:
    #main{ float: left; width: 60%; overflow: auto; }
    #main .post{ padding: 20px 0; border-bottom: 1px #ccc dashed; overflow: auto; }
    #main .post a.more-link{ color: #074b77; display: block; margin-top: 5px; }

Here, the main area of posts is only 60% in width because remember we want to have a sidebar, and we want to it to float on the right side. We added a dashed bottom border for each post to sepearate them out. The ‘Continue Reading’ is now a block element rather than an inline element with a bottom padding to make it more stand out.

  1. Save the style.css and reload the WordPress site to see changes.


Milestone 5: Add Sidebar to your site

Now is a good time to add your sidebar to the right of your page.

  1. Go to your Dashboard > Appearance. Remember that usually in Appearance, we should have the following:
  2. Themes
  3. Customize
  4. Widgets
  5. Menus
  6. Background Now, the Widgets and Menus links are no longer there because the current theme doesn’t support these features. In other to bring back these features, we need to add the dynamic sidebar functions,, so let’s create it.

Create functions.php

  1. Go to our theme folder /wp-content/themes/mocha and create a new file called functions.php.
  2. What we need to do is to register our positions for the widgets (or sidebars), and to do that we start with register_sidebar(). Add this in your functions.php file:


  1. Now in the register_sidebar() func, we need to add an array as a parameter. name and id are the mandatory elements of the array. There are other elements of the array such as description of the sidebar, before_title and after_titleto wrap around the title of the sidebar and gives it some styling. This is your top right sidebar:
        'name' => __('First Right Sidebar'),
        'id'   => 'first-right-sidebar',
        'description' => 'The widget position in the top right sidebar',
        'before_title' => '<h2>',
        'after_title'  => '</h2>'
  1. Copy the whole register_sidebar() code and paste below the first sidebar to register the position for the second right sidebar. Change the nameid, and description
        'name' => __('Second Right Sidebar'),
        'id'   => 'second-right-sidebar',
        'description' => 'The widget position in the bottom right sidebar',
        'before_title' => '<h2>',
        'after_title'  => '</h2>'
  1. Save the functions.php file.

Update sidebar.php

  1. Now, that alone doesn’t give us the positions for our sidebars. We need to go to the sidebar.php and add the 2 registered dynamic sidebars in here.
  2. Add this code inside the #siderbar div:
    <?php dynamic_sidebar()?>
    <?php dynamic_sidebar()?>
  1. Next, the parameters for these sidebars gonna be the ids that we specified in functions.php file. Add the ids in:
    <?php dynamic_sidebar('first-right-sidebar')?>
    <?php dynamic_sidebar('second-right-sidebar')?>
  1. Save the sidebar.php file and reload.

Add dynamic sidebars to site

  1. Go back to your admin portal
  2. Click on Appearance on the left panel. We now got Menus and Widgets again.
  3. Go to Widgets, and you see the 2 sidebars that we added in functions.php and sidebar.php are now on the top right corner.
  4. Add Categories and Recent Posts (change to 3 recent posts) to the first right sidebar and gives each of them a title. Then, add Recent Comments to the second right sidebar and also give it a title.


  5. Save the Widgets and go back to your site.
  6. We can see now that the sidebars are on the right side but they are overlapping with each other. We need to give the sidebars some styling.

Style the sidebars

  1. Open your style.css file
  2. Add some styling to your sidebar:
    #sidebar { float: right; width: 25%; overflow: auto; background: #f4f4f4; padding: 10px 15px; }
    #sidebar { list-style: none !important; }
    #sidebar ul { padding-left:10px; }
Make the width 25% and float to right, and give it some paddings.
  1. Save the style.css and reload the WordPress site to see changes.


Milestone 6: Add Search box widget on top right corner

  1. Remember the search div that we defined in header.php but we haven’t touched it at all? Now, we will add the Search box to the site.

Update functions.php

  1. Go back to the functions.php and make another copy of a whole register_sidebar() code and paste below the second sidebar to get the 3rd widget position. Even though the function name is register_sidebar() but what it really means is to register a widget position. Hence, we don’t have to name our third one sidebar, let’s name it Header Right. Change the nameid, and description of this third widget:
        'name' => __('Header Right'),
        'id'   => 'header-right',
        'description' => 'The widget position in the header right',
        'before_title' => '<h2>',
        'after_title'  => '</h2>'
  1. Save the functions.php file ### Update header.php
  2. Go to your header.php file and insert this code inside the search div to call the 3rd widget we have just registered in the functions.php file:
id="search"> dynamic_sidebar('header-right'); ?>
  1. Save the header.php file, and reload your wp-admin portal. You should see a new widget position called Header Right in the Widgets panel.
  2. Drag and drop the Search widget inside the Header Right widget position.
  3. Save and reload the WordPress site to see our Search box in the header.

Update style.css

  1. Now, let’s add some styling to our Search box. Go to style.css file
  2. Add this css code for your Search box:
    header #search { float: right; width: 310px; padding-top: 14px; list-style: none !important; }

Save and reload page. Now, you have a Search widget.

Congrats! You have made your first custom theme!

(OPTIONAL) Milestone 7: Change Post Page’s Template

We have a few more things to do. If you click on a Post link to open a Post right now, this Post still uses the index.php template. We want the Post to have its own template by using the single.php template to include Comment area and functionality. Currently, there is no Comment area in the current Post.

Create single.php

  1. Go to our theme folder /wp-content/themes/mocha and create a new file called single.php.
  2. Copy all the code of index.php and paste them in single.php.
  3. Add this code inside the if statement, below the endwhile line:
    <?php comments_template(); ?>

And what it does is giving us all the Comment functionality

  1. We also want to add author and date for each Post, so let’s do that. Add this line of code below the h2 title and above the the_content() func:
class="meta">Written by: the_author(); ?> on the_date('F j, Y'); ?>

Update style.css

  1. Add some styling for the meta div in style.css:
    .meta { padding: 3px 5px; background: #f4f4f4; width: 95%; }

Now, we have a little styling to that meta line on website.

  1. Save and reload. (If you still have the Disable Comments plugin active, makes sure to deactivate it.)
  2. Then open a Post page. You can see now that you have the meta line on top and a comment area at the bottom of each Post:



(OPTIONAL) Milestone 8: Push the Custom Ttheme to Remote Server

You should know how to do this by now. Just copy the mocha folder from your local /wp-content/themes/ to your remote /wp-content/themes/

Source: CoderSchool

Quote from inspired person

Vo lo lam du 8h r hay choi chut


Code rang hoc r viet tot len may dua
Dung danh thoi gian bam dt hay choi
Uong lam
Hoc them nhiu cai de tu tu hoan thien cai nghe cua minh

Cs tien bac len hoai
Mot k co thuc luc thi kho minh
Lam gi cg phai bit humble

e di frond-end(fe), tot nhat dung di html, css, no bt lam, bit chut ve less, sass cung ok, hon nhau la hieu co che hoat dong cua browser (event loop), cac framework voi library lon nhu angular, reactjs, voi vuejs, khi do huong career cua e moi di len duoc, neu k thi toi html css la het co
cai do thuoc ve design
muon dep phai bit choi phoi mau, layout, cac thuat ngu ben design moi ra
front-end chi chuyen cai design sang cai chay duoc
nen e muon di ve front-end, di huong a noi e se len tiep, cho nen dung hoc may cai do, vo hoc may cai even loop, voi architecture cua angular, reactjs, voi vuejs, la tot nhat cho em

truoc khi pull request phai review code lai de tranh phai fix nhung cai minor nay, lam o day hay di dau lam cung z, phai kho khan voi ban than minh chut thi sau nay moi grow duoc

Good Articles.

Modern Frontend Developer in 2018 – tajawal – Medium

Managing State in Angular Applications – nrwl

Essential JavaScript Libraries and Frameworks You Should Know About

10 Angular and TypeScript Projects to Take You From Zero to Hero – Code with Dan Blog

What I learned from doing 1000 code reviews – Hacker Noon

Build A Real World Beautiful Web APP with Angular 6 — A to Z Ultimate Guide (2018) — PART I

I created the exact same app in React and Vue. Here are the differences

WordPress Development 10

Lecture Exercise

In today exercise, you will be pair programming with a person sitting next to you. We will also have milestones to complete just like lab exercises.

We’ll try to accomplish these goals tonight:

  1. Set up local WordPress
  2. Personalize local WordPress
  3. Set up Remote Server
  4. Migrate WordPress online

Milestone 1: Set up your WordPress locally

The website has detailed instructions on how to install WordPress and run it locally. However, the guide is too long and has information that you do really need to know.

I will provide a quick and easy way to get WordPress running locally on your computer. Below are the steps:

  1. Install WordPress
  2. Install MAMP
  3. Set up WordPress in local server (MAMP)

Milestone 1.1: Install WordPress

  1. Head over to and dowload the lastest stable version of WordPress (v 4.9.8)
  2. Unzip the WordPress package in a desire position. The directory contains the unzip file is a WordPress software for your website. Your WordPress directory should have the following files:WP files

    Each website requires a separate WordPress software i.e. if you want to make 3 different websites then you will have to install 3 separate WordPress software locally.

Milestone 1.2: Install MAMP

Now, you will need a local server (environment) for the WordPress to run on. has a list of recommended servers. I will use MAMP since it’s easy and will help you understand the science “behind the scene”. There is a new tool called Flywheel that’s gaining a lot of traction lately. I actually like this tool more than MAMP because of its intuitive UI and user-friendly. However, I’ll recommend you to use one other tool first before getting started on Flywheel.

  1. Go to and download the MAMP free version. MAMP comes with PHP, Apache server, and MySQL server.
  2. Open MAMP and click on ‘Start Server’
  3. When the Apache server and MySQL server are all set up (green light), click on ‘Open WebStart page’ to start the local server. It will open a new tab on your web browser. The URL is either http://localhost:8888/MAMP/?language=English (on Mac) or http://localhost/MAMP/?language=English (on Windows)MAMP
  4. This is a Start page, where you interact with your local server. Click on phpInfo to be taken to the information page of PHP and Apache. Click on Tools > phpMyAdmin to be taken to the MySQL databases that contain all data of your websites.
  5. We will need a database for your new website (if there are 3 websites, there will be 3 different databases). Go to phpMyAdmin and click on New in the left panel. On the right panel, type “my-first-wp-site” in the database name. Collation is a set of rules that determine how data is sorted and compared. Pick “utf8_general_ci” as it is the most common collation. Then click Create. You will be taken to the Structure tab of your database. The database is empty because there is no table.phpMyAdmin

    When WordPress is set up with this database, there will be additional 12 tables added by WordPress. You can also create an additional custom table for your custom plugins but we won’t go into that now.

Milestone 1.3: Set up WordPress in MAMP

  1. Remember the unzip wordpress package that we did in step 2? Change the folder name from wordpress to my-first-wp-site (same name as database name).
  2. Manually move (copy-paste or drag-drop) the my-first-wp-site folder to inside the /MAMP/htdocs folder. htdocs folder is where all your wordpresses (websites) live.htdocs
  3. Now, go back to your MAMP Start page by click on the “Open WebStart page” on MAMP. Then, click on the My Website tab. You will be taken to http://localhost:8888/ or http://localhost/ depends on your Operation System
  4. You should see something like this:

    Index of /

    Click on the my-first-wp-site hyperlink to start the WordPress set up.

  5. Going through the instructions and click on Let's go! button to be taken to the database connection details page.
  6. Make changes to your database connection details so it looks like below:
    • Database Name: my-first-wp-site
    • Username: root
    • Password: root
    • Database Host: localhost:8888 (or localhost for Windows)
    • Table Prefix: wp_

    Click ‘Submit’

  7. Awesome! WordPress is all set up for the local server. Now, we can start the installation on the server. Click on Run the installation to be taken to the installation page.
  8. Fill the information as below (use your email address):WP installation details

    We use root for default username and password. You can change it later when you are more familiar with WordPress. Click on Install WordPress when you are done.

  9. Success! WordPress has been installed. Now you can log in to your local WordPress Dashboard using the default username and password.WP Dashboard

Milestone 2: Personalize your local WordPress

Go to ../my-first-wp-site/wp-admin/. This is a dashboard for you (the administrator) to manage your WordPress website. Now we will add some content to your site such as Posts, Pages, and Main Menu.

Milestone 2.1: Publish 2 Posts

  • One post with an image, a youtube video, and some ipsum text (categorize and tag your post)
  • One post with a featured image and some ipsum text (categorize and tag your post)

You can also just grab some random posts from the internet for your content (try this Right now, we only focus on the technical aspect of WordPress.

Milestone 2.2: Publish 2 Pages

  • About Me page: content about yourself
  • Contact page: how online people can reach you (e.g. Address: 12 Tôn Đản, Bến Nghé, Quận 4, Hồ Chí Minh 700000; Phone: 0122 474 2431; etc.)

Milestone 2.3: Create a Main Menu

  1. Go to Appearance and give the Menu Name: Main Menu.
  2. Add Contact, About Me, and Sample Page inside the Menu Structure. The Sample Page is a sub item of the About Me page.
  3. Tick ‘Top Menu’ in the Display location and then click Save Menu.

Your WordPress Home page now should look similar to this:

WP Homepage

Milestone 2.4: Manage your database

All the content that you have created so far (pages and posts) are stored in the backend MySQL database. Now, let us take a look at these data

  1. Open the MAMP WebStart page again and go to phpMyAdmin
  2. Click on the my-first-wp-site database on the left panel. Notice that WordPress has created 12 tables with prefix “wp_” after the WordPress installation in Milestone 1.3
  3. Locate the wp_posts table and click on Browses. Now, you can see all your posts’ and pages’ content are in the post_content columnwp_posts

    Equivalently, you can also just run this sql script in the SQL tab to get the same result:

    SELECT * FROM `wp_posts`
  4. Now, let’s do a bit of SQL while we are here. Sometimes, you need to check some data in the database to troubleshoot issues.The list that we saw above contains all the Posts and Pages in your website. However, you only want to view only the Pages. To do that, run this SQL script:
    SELECT * FROM `wp_posts` WHERE `post_type` = "page"

    You have written your first SQL script, and the results return only the Pages. If you want the results to return only Posts, change the post_type to “post”.

Milestone 2.5: Manually install a new theme

  1. Go to for free themes.
  2. Pick activello and download the zip file (you can pick a different one later). You can upload the Theme by going to Dashboard > Appearance > Themes > Add New > Upload Theme and just upload the theme zip file there. However, I want to add the theme manually.
  3. Unzip the zip file into a folder. The folder should be named activello.
  4. Drop the folder into ../MAMP/htdocs/my-first-wp-site/wp-content/themes/. There are already 3 other theme folders inside the themes folder: twentyfifteentwentyseventeen, and twentysixteen. Your default theme is twentyseventeen.
  5. Go back to your admin Dashboard and you should see the new Activello theme appears in the Themes page. Activate the theme to use it.

Milestone 2.6: Manually install a new plugin

This is similar to how you installed a theme in milestone 2.5. You just need to download the zip file, unzip it and drop the plugin folder into ../MAMP/htdocs/my-first-wp-site/wp-content/plugins/ folder. Then, activate the plugin in the Plugin page.

See how every post has a comment section that anyone can just make a comment on. Now, let’s disable all the comments by using a plugin.

post with no comment

Milestone 3: Set up a Remote Server

Your WordPress website has only run locally on your computer so far. Now, we will push the website into the web. To do that we will need a domain and a hosting server. Have I told you that you can do all of the hostings for free of charge? 🙂

Milestone 3.1: Register a free domain

There are many websites that give out free domains and freenom is one of them.

  1. Go to and type in your desired domain name in the Check Availability box. I use my-diy-wordpress-site but you should pick a different name since the same name is probably already taken by me.freenom
  2. Do not use .tk domains. Many host servers have stopped working with .tk domains because these domains are abused by spammers and hackers. The other domains (, and .gq) should be okay. Pick at least 2 domains in case one domain stops working. Here, I’ll pick .ml and .ga, and click Checkout.
  3. Change the Period to 12 Months @ FREE, and click on Continuefreenom-2
  4. Enter your email address at the ‘Review & Checkout’ page. You can also use a temp email instead. Then verify your email address.
  5. After the email verification, you are required to fill in the ‘Your Details’ information. Fill in all the blank fields, tick the ‘Terms & Conditions’ checkbox and click on Complete Order.freenom-3
  6. Now, you are all set. Click on the button Click here to go to your Client Area.
  7. Sign in with your email and password, and go to Services > My Domainsfreenom-4

    I can see now that my two domains are active and ready to be used.

Milestone 3.2: Register a free remote hosting server

You have gotten yourself a domain name, the next step is to get a remote server to host your WordPress website. There are also a lot of websites that provide free hosting. In this lab, we will use InfinityFree

  1. Go to and sign up for a new account (don’t close the freenom tab yet, we’ll go back to it later). If you use a temp email, you can re-use the same email that you signed up with freenom.infinityfree-1
  2. When the registration is all done and you are logged in. Click on + NEW ACCOUNT to start a new server. You are allowed to have up to 3 servers per registered account.
  3. We don’t want to use their subdomains so let’s ignore the first option. We want to use our own domain. The domain that we have set up in Milestone 3.1 need to point to these nameservers: Otherwise, it won’t work.

Milestone 3.3: Assign a domain name to your remote server

  1. Go back to your domains in the freenom website
  2. Pick one domain and click on Manage Domain
  3. Click on the drop-down Management Tools and choose Nameservers
  4. Choose custom nameservers and fill in like below:infinityfreVe-2
  5. Click Change Nameservers. Now, the changes have been saved successfully!
  6. Go to your remote server in the InfinityFree website. Enter your domain name and click on CHECK.infinityfree-3

    You should receive a congratulation notice saying that your domain is available. Otherwise, check the nameservers in from your domain again.

  7. Now, you will need to provide a Label and Password for your account. Make sure to keep these credentials somewhere safe because you will need them later. I’ll change my account Label to “My First DIY WordPress” and keep the Password the same.
  8. Click on CREATE ACCOUNT.
  9. The server is being set up. The epiz_22****** is your Username. Click on VIEW IN CLIENT AREA.
  10. Wait for a few minutes and then go to your website (mine is,
  11. If you see the below for your website, congrats! Your remote server is now live!infinityfree-4

Milestone 4: Migrate your WordPress online

Now, we have an online remote server all set up, and a WordPress website running locally. The last thing we need to do is to migrate our local WordPress online.

Note: All remote servers nowadays provide One-click install WordPress. However, doing this won’t help you understand what happens behind the scene. This practice force you to do things manually which is tiresome but will provide you more insights on how WordPress works specifically, and all the web applications as a whole.

Inside your InfinityFree account, go to the Control Panel (cPanel) by click on the button GO TO CONTROL PANEL. The cPanel is a user interface for all the technical stuff that let remote server owners manage their websites easier.

Now, to push our local stuff online correctly, we will have to do 2 main things:

  • Upload MySQL database online using sql script
  • Upload all WP files online using an FTP tool

Milestone 4.1: Migrate database using a SQL script

  1. In your cPanel, click on ‘MySQL Databases’ to access all your remote databases. There is currently no database because you just set up the server.
  2. Enter a name for your new database and click on ‘Create Database’. My remote database name is: epiz_22047555_my_first_wp_site. This is an empty database (you can check the database by using the online phpMyAdmin).
  3. Now, we need to export our local database and import to the online database. Access your local phpMyAdmin through MAMP, choose my-first-wp-site database and click on the Export tab.sql-export
  4. Leave the default options: Quick export in SQL format and click Go. The tool provides you a sql script that generates all the tables and contents of the my-first-wp-site database. Copy the script.
  5. Open a new file in your text editor and paste the script here. Save the file as my-first-wp-site.sql in your local machine. A copy of your database now sits in this script.sql-export-script
  6. Go to your remote phpMyAdmin in cPanel to access your remote database.
  7. Click on the Import tab. In the File to Import section, upload your my-first-wp-site.sql
  8. Leave default settings for the others. Click on Go to start the database migration. It probably takes just a few seconds.
  9. Click on the Structure tab to make sure that all the tables have been imported correctly.
  10. You can run similar sql scripts as in Milestone 2.4 or examine individual tables to make sure that the contents are correct.
  11. We need to do one last configuration with our remote database: the site url needs to be changed. Browse the wp_options tablewp-options table
  12. We need to change the option_value of siteurl and home. Start with the option_name siteurl, click on Edit and update from something similar to http://localhost:8888/my-first-wp-site to your registered free domain e.g. Click on Go to complete.
  13. Do the same thing for option_name home.Your remote database is now all set!

Milestone 4.2: Migrate WordPress files using a FTP software

Fix the wp-config.php file

  1. Remember your WordPress folder my-first-wp-site that lives in /MAMP/htdocs folder? Make a copy of that outside MAMP and rename it to my-first-wp-site-prod. I don’t want to use the same folder in MAMP because that one is configured for running locally only (dev version). To run on a remote server, it needs to be configured with the remote server details (prod version).
  2. Use your text editor to open the wp-config.php file in the my-first-wp-site-prod folder to make some changes. We need to change the values of DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST.
    • DB_NAME: change my-first-wp-site to the remote MySQL Database Name (e.g. epiz_22047555_my_first_wp_site)
    • DB_USER: change root to the remote MySQL User Name (e.g. epiz_22047555)
    • DB_PASSWORD: change root to the remote MySQL Password (your cPanel Password)
    • DB_HOST: change root to the remote MySQL hostname (e.g.
  3. Save the wp-config.php file.
  4. Now, we need to use a FTP tool to upload all the files inside the my-first-wp-site-prod folder to the remote server. We will use a popular free FTP software called FileZilla

    Use FileZilla to upload WordPress files

  5. Download FileZilla here
  6. Open FileZilla and clicks on File > Site Manager
  7. Name the site infinityfree and fill in your remote server’s HostUser, and Password information. Host and User are FTP hostname and FTP username; this info can be accessed easily in the cPanel right bottom panel. Password is your cPanel/server Password.filezilla
  8. Click Connect and provide your cPanel Password
  9. You know you are connected successfully to the remote server through FTP when you receive these messages:
    Status:         TLS connection established.
    Status:         Logged in
    Status:         Retrieving directory listing...
    Status:         Directory listing of "/" successful
  10. In the remote site, go to htdocs directory. In your local site, go to my-first-wp-site-prod directory. It should look like this:filezilla-2
  11. Now, we will start the file transferring:
    • Select all files in my-first-wp-site-prod folder by pressing Ctrl-A or Cmd-A
    • Move all files from /my-first-wp-site-prod in local to /htdocs in remote to start the uploading process (I have 1760 files total to upload)
    • When there is a ‘Target file exists’ notice, choose ‘Overwrite if different size’ and tick ‘Apply to current queue only’

    This process will take 1 to 2 hours so make sure you have a good internet connection when you are doing this.

Milestone 4.3: Test your remote site

  1. When the transfer is done, first go to the wp-admin portal (e.g.
  2. Username and Password should still be root, then log in
  3. Go to Setting > General, make sure that all the URLs are now pointing to your domain name rather than your local, then click Save Changes
  4. Go to Setting > Permalinks, make sure that all the URLs here are also pointing to your domain name rather than your local, click Save Changes
  5. Now, go to your website (e.g. and it should be a functioning WordPress web application!


    Source: CoderSchool

Tâm sự tại sao lại viết blog về {{code}}

Chang chào cả nhà!!!

Nói thật ra là cái blog này được tạo ra thì không có ý định viết những chia sẽ về {{code}} đâu vì lúc tạo ra blog này thì Chang rất gà mờ mặc dù làm ở công ty cũ DXC hơn 3 năm gần 4 năm nhưng lúc đó chỉ là code được cho nó work thôi, còn nguyên lý hay cách viết như thế nào thì không tâm. Sau khi chuyển công ty Aswhig thì bỗng dưng mình yêu code hẳn, công nghệ mới .Net core, EF Core, Angular… ôi chua choa moẹ ơi, nói yêu vậy chứ chưa rành đâu nên mới tạo blog để note những cái quan trọng để tự học và cũng muốn chia sẽ với các bạn.

À còn một điều nữa, từ khi qua công ty mới, học công nghệ mới và Chang đã nhận ra một chân lý mà gần 4 năm sau khi tốt nghiệp đại học Chang không nhận ra sớm hơn đó là “Nghề code rất dễ kiếm tiền”. Các bạn toàn nghe ngàn $$$ không à đúng không?. Tuy nhiên để đạt Giàu thì Chang cũng sẽ bắt đầu trao dồi kiến thức lại, Chang cảm nhận là chưa quá muộn đâu và đồng thời Chang cảm nhận là có lẽ Chang đã bắt đầu yêu {{code}}.

À last but not least, hồi xưa Chang cực kỳ hate front-end lém luôn á, mà giờ biết angular, biết bootstrap, biết sematicUI…thì thấy front-end rất đẹp nó không có thô cứng như html, javascript hồi xưa nữa, giúp mình đỡ cực trong việc chỉnh css. 🙂 Love front-end too.

Haha..NEVER upset

Mấy bữa nay mày bị sao vậy Trang..Thế giới này là oyster của mày mà..Mày nhớ cảm xúc đầu tiên của mày khi nói trúng tuyển Aswig không? Mày lúc đó vui quá đến nỗi không nhận lương tháng 13 mà, mà cái cty hiện tại mày có happy đâu..có môt ông già pí-èm xấu tánh hahaa..cổ hũ…Mày không nên buồn về những ng khác nói như “Mày giống đi xin xỏ việc hơn..” “..vì e quá cần công việc đó” có con moẹ gì đâu phải buồn, mình đậu cty mình thích mà, với lại mày nhớ project mà mày dự định làm khi qua cty Aswig $1/day to learn English and never take a nap chỉ có qua công ty mới mày giỏi ra..đừng sống mà bao quanh bởi quá nhiêu con gà lôi…với lại nếu mày có ghim những gì người khác nói thì hãy ghim nó làm Động Lực…hãy cho họ chống con mắt mà xem…hãy làm trong im lặng và khiến thành công mình thành 1 tiếng nổ lớn…Shake it off!!!

You Can’t Soar Like An Eagle When You Surround Yourself With Turkeys



You can’t soar like an eagle when you surround yourself with turkeys.
Isn’t that the truth.

But in order to soar like an eagle, you also must release yourself from anything that is weighing you down.

You can’t soar like an eagle if you’re unhealthy. 
I don’t see any obese eagles dominating the sky.

Your health is probably the most important part of your life. Certainly one of the most important factors in living a GREAT life.

Having ENERGY for life, starts in your physical body.

It’s much easier to get your mind right when your body is right.
Build a strong body and your mind will follow.

You can’t soar like an eagle with the mindset of a turkey.

If you don’t believe you can fly, you will never fly.
If you don’t believe you are capable of soaring to the top of your own mountain peak in life, you will never try and therefor never succeed.

If your mind is full of negativity…
You will never see the positive.

If your mind is full of limitations it is closed off to opportunities and possibilities that might be right in front of your face.

So in order for you to soar like that eagle, you need to get your blinkers on.
You must FOCUS.

 The eagle can FOCUS on and lock in on its prey from miles away.
You must FOCUS on your goal, and lock it in from wherever you are.
ELIMINATE the idea of defeat!
LOCK in your goal.
DETERMINE what it is going to take to get there and TAKE OFF. 
Just GO – Go get that GOAL.
Don’t stop until you have it in your grasp!

Next you must fill your mind and body with ONLY the things that will take you closer to your goals.

If you’re surrounded by turkeys it’s time to limit that interaction, and get around the dream chasers.
 Those that want to SOAR.

Those that want to LEAD.
 Those that are prepared to face the storm, and thrive despite the storm.

If you have weights tied to your legs,
if you have things that are weighing you down in life and preventing you from taking off…
it’s NOW time to release those shackles.

Set yourself free so you can fly.
It might not be easy to get those shackles off. 
It might be painful.
It might leave a scar.
 But you must do what is best for you.
You can not be imprisoned for your entire life.

 You were born to fly.
To make your own decisions.
To walk your own path, 
To do it on your watch!

 You were born to be in control of your life.
You were born to DOMINATE
You MUST follow your own path!

If the turkeys love you, they will learn to soar with you.
If they are meant to be with you, you can help them along, but you can only help them after you help yourself.
 You must go your own way first.

Read More

Thế nào là Thích, Yêu và Thương.

Tôi không biết là mỗi cặp đôi họ đến vs nhau bằng cách nào chắc có lẽ do tôi chưa từng được trải nghiệm điều đó. Tôi không biết là sao mà 2 người xa lạ nảy xin tình cảm rồi lại tỏ tình, hẹn hò trở thành người yêu. Tôi nghe nói Thích là nền mống của 1 cặp đôi nhưng nếu Tôi thích Nhóc rồi tôi phải làm sao để nó trở thành nền móng của 2 ta. Tôi không biết tôi chỉ thích nhóc nhất thời hay không nữa nhưng tôi không tìm được bất kì cơ hội nào để có thể nói chuyện. Tôi tuy luôn miệng nói sẽ ko lấy chồng nhưng mong có 1 gia đình nhỏ vs những con thơ và đáng yêu như cháu tôi, tôi luôn hy vọng chúng ta sẽ cùng về chung 1 mái nhà. Nhìn facebook của má Nhóc thấy hình ảnh má nhóc, chị nhóc cùng vs nhóc thân thiết tôi có 1 chút ganh tị và tự nhiên tôi lại tự ti và nghĩ có lẽ mình sẽ không hợp với gia đình nhóc. Mỗi lần qua tường nhà nhóc thấy avatar của nhóc tôi bấn loạn như điên. Tôi không biết là nhóc có biết sự tồn tại hay đơn giản là nhóc có chút gì với tôi không, nếu có mong nhóc sẽ nói ra, sắp valentine rồi đó. Tôi sẽ chờ, chờ 1 ngày nào đó sẽ gặp ng cũng thích mình.

Tôi muốn Luật hấp dẫn sẽ hút bạn về tôi 

Tôi thích bạn, nhưng làm sao để hai ta có cơ hội trò chuyễn..môi ngày tôi đều vô fb bạn một cách âm thầm và ra cũng âm thầm như thế, bữa tối đó bạn có chú ý tới tôi ko, nhưng tôi chỉ chú ý tới bạn, kể cả ng ta nói ng giải nhất họ Vũ tôi cũng thầm cầu là tên bạn, sao tôi cảm thấy nhớ bạn quạ..ban có nhớ tui nữa phải ko?? Hãy tìm fb tôi, ko thì ping skype tôi, chào tôi hay hỏi câu gì đó ngốc cũng được, tiếp cận tôi ik..tôi đang chờ bạn đây…

Một kí ức chợt hiện về

Khi nghe bài Chúng Ta Kết Hôn Đi của Tề Thân bỗng nhiên tôi nhợ bạn, nhớ cái nụ cười đi trễ của bạn sao mà nó cute thế, tôi ko biết tại sao bạn lại có 1 nụ  cười đó nhưng tôi đã bắt gặp và tôi nhớ nó, dạo này tôi không còn nhớ bạn nhiều vì tôi với bạn chẳng là gì của nhau đâu, và việc đó là không thể..nhưng tôi hy vọng là end year party sẽ gặp được bạn..hehe..Vẫn còn nuôi 1 chút hy vọng cho buổi tối đó.