end of week 5

Adding custom font to css

@font-face {
    font-family: big-shoulder;
    src: url('assets/fonts/BigShouldersDisplay.ttf');
}
.content{
    background-color: rgb(31,31,31);
    font-family: big-shoulder
}

Home page and Front Page

  • home page is index of our blogs. it’s list of our blogs in reverse chronological order.
  • front page is what users see at home of your site, you can set it to show the index or a static page.

How to use metadata of post in the loop

<p>
    <?php echo get_post_meta(get_the_ID(), 'rt-movie-meta-basic-release-date', true); ?>
</p>
<p>
    <?php echo get_post_meta(get_the_ID(), 'rt-movie-meta-basic-content-rating', true); ?>
</p>
<p>
    <?php echo the_terms(get_the_ID(), 'rt-movie-genre')[0]->name ?>
</p>

How to register menu locations in theme?

 register_nav_menus(
        array(
        'header-menu' => __('Header Menu'),
        'footer-menu-1'  => __('Footer Menu 1'),
        'footer-menu-2' => __('Footer Menu 2'),
        )
    );

Using it in template

 <div class="secondary-menu-container">
        <?php wp_nav_menu(['menu'=>'footer-menu-2']); ?>
    </div>

Namespace naming standards

  • camelcase
    • example : theMovieLibrary
  • upper camelcase/ pascal case
    • example : TheMovieLibrary

3 ways to reset wp_query, which one to use where?

  1. rewind_posts() : not modifying the query just want to reset the post at begin
  2. wp_reset_query() : Using wp_reset_query() restores the WP_Query and global $post data to the original main query. You MUST use this function to reset your loop if you use query_posts() within your loop.
  3. wp_reset_postdata : Use wp_reset_postdata() when you are running custom or multiple loops with WP_Query. This function restores the global $post variable to the current post in the main query. If you’re following best practices, this is the most common function you will use to reset loops.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *