Jump to content
Sign in to follow this  
nadjak

Blog on the front page

Recommended Posts

nadjak

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
catrina

To clarify: you'd like a single (the most recent) blog post on your front page?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
nadjak

Yes that is right and then i would like all of my blog post on my page called Blog and here with the Magazine Layout. Thank you

Share this post


Link to post
Share on other sites
nadjak

Is there someone who can help me..?? Thank you :-)

Share this post


Link to post
Share on other sites
cmunns

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

Thank you Adam - but is not working. I don??t know what i am doing wrong here. Can you help..? Thanks!

Share this post


Link to post
Share on other sites
nadjak

Oh i see now that i have to chance some of the names my self. ;-) Should i use child theme istead of prof. theme.?

Share this post


Link to post
Share on other sites
Kate

For the functions.php modification? Yes... definitely use base.

Share this post


Link to post
Share on other sites
nadjak

Adam - My page says this Fatal error: Cannot redeclare add_post() (previously declared in /home/nadjakal/public_html/kalnaesevent.dk/wp-content/themes/platformbase/functions.php:107) in /home/nadjakal/public_html/kalnaesevent.dk/wp-content/themes/platformbase/functions.php on line 148 Can you please help me - see www.kalnaesevent.dk Thanks

Share this post


Link to post
Share on other sites
nadjak

My problem is that i want my laitest blog on the front page called Forside And then i want all the blogs on the page called Blog and in the Magazine Layout. Can somebody help me..??? Thank you :-)

Share this post


Link to post
Share on other sites
Danny

I got mine finally working with this piece of code added to the bottom of my functions.php.

add_action('pagelines_inside_top_theloop','add_post');
	
	function add_post(){?>
	<?php if ( is_front_page() ) { ?>
	<?php $my_query = new WP_Query('category_name=[b][u]blog[/u][/b]&showposts=3');
	while ($my_query->have_posts()) : $my_query->the_post(); ?>
	
	<?php
	query_posts('showposts=[b][u]1[/u][/b]&cat=[b][u]18[/u][/b]');
	while(have_posts()) : the_post();
	?>
	
	<?php endwhile; ?>
	<?php } ?>
	<?php }

I've made what you need to change bold and underlined them, hopefully this works for you.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
nadjak

Thank you but i can??t get it work...?? Thank you. Nadja

Share this post


Link to post
Share on other sites
Danny

hmmm, it works for me, did you change the bits I made bold, to match yours? Meaning that the change the category name and the cat id to the ones your want to show?


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
nadjak

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

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.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
nadjak

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

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.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
nadjak

Ok thanks again :-) This is what i am writing: add_action('pagelines_inside_top_theloop','add_post'); function add_post(){?> <?php if ( is_front_page() ) { ?> <?php $my_query = new WP_Query('category_name=blog&showposts=3'); while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php query_posts('showposts=1&cat=7'); while(have_posts()) : the_post(); ?> <?php endwhile; ?> <?php } ?> <?php }

Share this post


Link to post
Share on other sites
Danny

Replace it with this: add_action('pagelines_inside_top_theloop','add_post'); function add_post(){?> <?php if ( is_front_page() ) { ?> <?php $my_query = new WP_Query('category_name=blog&showposts=3'); while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php query_posts('showposts=1&cat=7'); while(have_posts()) : the_post(); ?> <?php endwhile; ?> <?php endwhile; ?> <?php } ?> <?php } You was missing this: <?php endwhile; ?> Towards the end.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
nadjak

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

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×