CL 2013-11-22

Now it’s time to the page.php file and single.php. According to WordPress Hierarchy, The posts need a single.php and the pages uses page.php. I created page.php file to show the two pages I want to be a external part of my portfolio. All the other pages is a part of index.php, and the codes pulls specific page using the loop with filter. As for the single.php file, I use it to show the projects (and my writings).

  • Page.php and single.php need a title and subtitle. They is easy added using the default loop:
  • As to all external pages and posts, I wanted to have a header image as visual support. It’s added using the thumbnail for the page or post. But to some of the posts I have a video, I wanted to place in the site to show my project. To accomplish it, I created a if-else php statement to check if the video exist, and if it exists, then use it. Otherwise it should place the thumbnail image.

    The vimeo_url should look like this: “https://vimeo.com/77412869” – and I only need the last 8 digit to make a embedded video link as such: “http://player.vimeo.com/video/77412869”. Therefore I use the  substr();  code to only select the last 8 digit and reuse it.
  • To the content, I need to evaluate about the post or page has some custom fields, I want to add. It is to provide some extra information as which programming code or which CMS I am using to the specific project. To make it, I must make a $post_metas loop very same as this in the video_url:

    Then I want to make a if-else statement to either show the content WITH meta information (spilt the content in 2 columns) or the content WITHOUT meta information (one single column).