How to Build a Single Page Portfolio Theme – Part 5 – Adding a New Blog Page Template
Posted on 25th August, 2014 50 Comments
Because we’re using the sticky posts for the carousel we’ll need to create a new page template with a loop that’ll exclude the sticky post from the output.
So…
Lets begin by creating a new page template for the blog posts.
Blog-page-template.php
Create a new document and call it blog-page-template.php with that done we’ll need to declare it a useable template file and add a loop that will output our blog posts without showing the sticky posts that we’re using for our carousel on the home page.
<?php /* Template Name: Blog Posts Template */ ?> <?php get_header(); ?> <section class="blog"> <header> <div class="wrapper"> <h2>Blog</h2> </div> </header> <div class="wrapper"> <div class="left-content"> <?php /* CREATE A NEW BLOG SECTION. *****************************************************/ /* WITHOUT STICKY POSTS PLEASE... */ $the_query = new WP_Query( array( 'post__not_in' => get_option( 'sticky_posts' ) ) );?> <?php if ( $the_query->have_posts() ) : $post = $posts[0]; ?> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <article id="post-<?php the_ID(); ?>"> <header> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a> <h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1> <p>Posted on <?php the_time('F jS, Y'); ?> by <?php the_author(); ?></p> </header> <section> <?php $content = get_the_content(); echo wp_trim_words( $content , '30' ); ?> </section> <footer> <p><?php the_tags('Tags: ', ', ', '<br>'); ?> Posted in <?php the_category(', '); ?> • <?php edit_post_link('Edit', '', ' • '); ?> <?php comments_popup_link('Respond to this post »', '1 Response »', '% Responses »'); ?></p> </footer> </article> <?php endwhile; ?> <nav> <p><?php posts_nav_link(' • '); ?></p> </nav> <?php else : ?> <article> <h1>Not Found</h1> <p>Sorry, but the requested resource was not found on this site.</p> <?php get_search_form(); ?> </article> <?php endif; ?> </div> <!-- /.left-content --> <?php get_sidebar(); ?> <?php wp_reset_query(); ?> </div><!-- /.wrapper --> </section> <!-- /.blog --> <?php get_footer(); ?>
Style.css
Next we want to open up our style.css and add some generic style for our blog, I want these to be a two column layout.
/* Blog Section -------------------------------------------------- */ section.blog .wrapper > article { float: left; width: 47.5%; } section.blog .wrapper > article:nth-of-type(1) { margin-right: 5%; } section.blog .wrapper > nav { clear: both; }
Now to use our template, create a new page, call it “Blog”. Then select the “Blog Post Template” from the template dropdown list in the page attributes.
Finally adding our navigation, we’ve added id’s to the sections of the site we’ve just created so we can use these in our navigation. Go to the WordPress admin page, under Appearance/Menu.
When we have our menu page open, “Create a new menu”, Name it “Menu 1”, select the links tab and remove the current url “http://” and replace it with our div id’s used on our sections that we added earlier in this tutorial.
We want our navigation to look like this… Notice I also added a link to our blog page template!.
With those added lets select which menu they should appear under. Choose “Manage Locations” from the dropdown menu for Header Menu, select our Menu 1 and save the changes.
Comments
To preserve code added to a comment you can wrap your code in short tags
by using [square brackets]:
VictorAmisp
17th, Oct, 20soil tests a means, the Patient of Fresh Path men’s. printable cialis coupon Narrow-mindedness is not recommended to the clinical.
JamesVen
21st, Oct, 20Ceexax ntmwkt [url=https://ciamedusa.com/#]cialis generic canada[/url] which is undisturbed outrageous and in use genetically <a href="
fda hydroxychloroquine shortage
12th, Nov, 20fda hydroxychloroquine shortage https://hydroxychloroquine.webbfenix.com/
naltrexone for fibromyalgia
19th, Nov, 20naltrexone for fibromyalgia https://naltrexoneonline.confrancisyalgomas.com/
cialis 5mg cost
21st, Nov, 20cialis 5mg cost http://www.lm360.us/
vidalista 5 mg coupon
22nd, Nov, 20vidalista 5 mg coupon https://vidalista.mlsmalta.com/
mygoviagar.com
22nd, Nov, 20Viagra cost in us mygoviagar.com buy viagra best price
viagra in usa for sale
23rd, Nov, 20viagra in usa for sale http://droga5.net/
ivermectin 5
23rd, Nov, 20ivermectin 5 https://ivermectin.webbfenix.com/
lightvigra.com
23rd, Nov, 20Viagra tablets in india online lightvigra.com buy sildenafil paypal
where can i get viagra tablets
23rd, Nov, 20Where can you purchase female viagra hopeviagrin.com buy viagra usa
hydroxychloroquine clinical studies
25th, Nov, 20hydroxychloroquine clinical studies https://hydroxychloroquine.mlsmalta.com/
ivermectin prophylaxis for scabies
26th, Nov, 20ivermectin prophylaxis for scabies https://ivermectin.mlsmalta.com/
fda approved vidalista
01st, Dec, 20fda approved vidalista https://vidalista.buszcentrum.com/
is vidalista or viagra better
04th, Dec, 20is vidalista or viagra better https://vidalista40mg.mlsmalta.com/
quick rx refills online
06th, Dec, 20quick rx refills online https://edmeds.buszcentrum.com/
doxycycline hyclate 50 mg
09th, Dec, 20doxycycline hyclate 50 mg http://doxycycline.zolftgenwell.org/
Merziuz
12th, Dec, 20wa4tcc http://pills2sale.com/fTr1bYnau88IsQx
hydroxychloroquine treatment success
12th, Dec, 20hydroxychloroquine treatment success https://hydroxychloroquinee.com/
generic tadalafil 5mg cost
13th, Dec, 20generic tadalafil 5mg cost https://tadalafili.com/
what is the truth about hydroxychloroquine
15th, Dec, 20what is the truth about hydroxychloroquine https://hydroxychloroquine.mymvrc.org/
xxx
18th, Dec, 20I really like your blog.. very nice colors & theme. Did you make this website yourself or did
you hire someone to do it for you? Plz respond as I’m looking to construct my own blog and would
like to find out where u got this from. kudos
daily generic cialis
19th, Dec, 20daily generic cialis https://tadalafileo.online/
hydroxychloroquine wiki
20th, Dec, 20hydroxychloroquine wiki https://sale.azhydroxychloroquine.com/
how soon should you take cenforce
21st, Dec, 20how soon should you take cenforce http://cavalrymenforromney.com/
10 mg prednisone effectiveness
22nd, Dec, 2010 mg prednisone effectiveness https://prednisone.bvsinfotech.com/
dose of cialis for ed
25th, Dec, 20dose of cialis for ed https://cialzi.com/
buy viagra on line
25th, Dec, 20buy viagra on line https://viaplz.com/
Markus Warchal
30th, Dec, 20I all the time emailed this webpage post page to all my contacts, since if like to read it next my links will too.|
is vidalista better than viagra
01st, Jan, 21is vidalista better than viagra http://viidalista.co/
using ivermectin to treat heartworms
02nd, Jan, 21using ivermectin to treat heartworms https://ivermectin1st.com/
chloroquine pills
04th, Jan, 21chloroquine pills https://hydroxychloroquine.grassfed.us/
walgreens cefixime cost per pill
05th, Jan, 21walgreens cefixime cost per pill https://ceefexime.co/
hey
07th, Jan, 21Taxi moto line
128 Rue la Boétie
75008 Paris
+33 6 51 612 712
Taxi moto paris
If you are going for most excellent contents like I do, only pay a quick visit this site every
day since it gives feature contents, thanks
viagra dosage
10th, Jan, 21viagra dosage http://viaaagra.com/
how to use ivermectin pour
10th, Jan, 21how to use ivermectin pour http://ivermmectin.co/
Lanora Hoppesch
04th, Feb, 21Great site to read. Worth the time. Do YOU know a College Student? More assistance with their class assignments needed than ever before. Tell them about Essays Unlimited. They can assist with this problem.
mycophenolate patient assistance program
09th, Feb, 21mycophenolate patient assistance program https://hydroxychloroquine4u.com/
Abacroli
14th, Feb, 21cheap medical insurance plans – viagra dosage Olpwioa
cialis bph dosage
viagra generic substitute: [url=https://www.withoutbro.com/]viagra online[/url]
hydroxychloroquine 200mg side effects
17th, Feb, 21hydroxychloroquine 200mg side effects https://hhydroxychloroquine.com/
cialis without doctor prescription
17th, Feb, 21cialis without doctor prescription http://cialllis.com/
how much does cialis costs
21st, Feb, 21how much does cialis costs https://cialis.mlsmalta.com/
cialis online free shipping
21st, Feb, 21cialis online free shipping http://cialis.anafassia.com/
https://online.branded-edu.com/eportfolios/7149/Home/Avaya33810X_exam_Selected
25th, Feb, 21Hey there! This is kind of off topic but I need some advice
from an established blog. Is it difficult to set up your own blog?
I’m not very techincal but I can figure things out pretty quick.
I’m thinking about creating my own but I’m not sure where to start.
Do you have any tips or suggestions? Cheers
Dog Breed
25th, Feb, 21Great blog! Is your theme custom made or did you download it
from somewhere? A theme like yours with a few simple adjustements would really make my blog stand out.
Please let me know where you got your design. Thanks
Togel Online
25th, Feb, 21Appreciate the recommendation. Will try it out.
Togel Online Terpercaya
26th, Feb, 21Write more, thats all I have to say. Literally, it seems
as though you relied on the video to make your point.
You definitely know what youre talking about, why waste your intelligence on just posting videos to your blog when you could
be giving us something informative to read?
Situs Keluaran Togel
26th, Feb, 21Attractive section of content. I just stumbled upon your blog and
in accession capital to assert that I acquire in fact enjoyed account your blog posts.
Any way I will be subscribing to your feeds and even I achievement you access consistently fast.
oxvow.com
27th, Feb, 21The delivery is really fast. I bought it on Double Eleven and it will arrive the next day. The time is exactly the same as the mobile phone, but I don’t want to talk about the strap. After wearing it for a day, there will be a lot of small scratches.
cialis and pomegranate
02nd, Mar, 21I’m really enjoying the design and layout of your website.
It’s a very easy on the eyes which makes it much
more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme?
Fantastic work! https://cialis.mrdgeography.com/tadalafil