Blog on the front page

Recommended Posts

nadjak
0

nadjak 0

I can not get my blog page on the front page of the side...
I would like to have the latest blog on the front page and the Magazine layout on my blog page.. how can i do that..?
kalnaesevent.dk
Thank you. :-)
Best regards
Nadja

Share this post

Link to post

Share on other sites

cmunns
16

cmunns 16

you would basically have to create a custom loop to place on the static home page showing your latest post...something like this would need to be added to your child theme functions.php file
`
add_action('pagelines_inside_top_theloop','add_post');
function add_post(){?>
<?php if ( is_front_page() ) { ?>
<?php $my_query = new WP_Query('category_name=featured&showposts=5');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
All the code parts from index.php here, depending on what you want to display
I.e. Post Kicker, Post, Post Footer...
What you put here will be repeated for every post as specified above
(5 posts from the category "featured")
category_name is the URL name of the category i.e.:
/.../category/featured/.../
and not the category title:
"Featured"
<?php endwhile; ?>
<?php } ?>
<?php }
`

Share this post

Link to post

Share on other sites

nadjak
0

nadjak 0

Thanks Danny. We're getting closer. I know what to change now, thanks to you. I just don't know how to find the exact code to substitute for the items in bold and underlined. Can you point me in the right direction, as to where I might find the actual code, that I need to substitute?
Also, perhaps because english isn't my first language, could you please elaborate on the "cat id" - what is that?
Thanks in advance!

Share this post

Link to post

Share on other sites

Danny+ 1,327

Danny+ 1,327

OK, if I understand you correctly, all you need to do is to replace the word blog with the name of your category.
So for example if your category is called news then you would replace the word "blog" with news.
You will also need the categories id number, to find this go to your admin dashboard and then to categories.
Hover over the category and you should see a link something like this:
YouWebsite/wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=18&post_type=post
Ive highlighted the number 18, this is your category id. so now all you have to do is change the word blog in the code above to the name of your category and changed the id number 18 to the category id and that should work.

Share this post

Link to post

Share on other sites

nadjak
0

nadjak 0

Thanks again Danny. Every tim i try to chance it the page comes up with this...
Parse error: syntax error, unexpected '}' in /home/nadjakal/public_html/kalnaesevent.dk/wp-content/themes/platformbase/functions.php on line 126
Do you know what i am doing wrong..?

Share this post

Link to post

Share on other sites

Danny+ 1,327

Danny+ 1,327

Well, I aint no expert on php/hooks ect... but the code I provided above works for me, so best thing to do is probably post the code you added to your functions.php and let me see if there is any mistakes.

timlinson 3

Share this post

Link to post

Share on other sites

nadjak
0

nadjak 0

Thank you sooooooo much Danny :-))))))
Now i just want to ask how i can the whole bolgpost with comments ect. on the front page and not only a box with a link to the last blogpost...?
And how do i get the magazine layout on my blog site..?
Thank you :-)

Share this post

Link to post

Share on other sites

nadjak
0

nadjak 0

No sorry just forget what i wrote above this....
I would like to now how i can get the latest three blogs on the front page with at picture in the left side an with space for max 9 lines written words..... do you now how to..?
And then i would like the Magazine layout on my blogpage .. ?
Thank you