Hi,
I want to create a page "Blog" where I can see all the posts from differents categories in Wordpress.
So I create a page "blog". This page is blank, this is normal. I juste create a file blog.php in my child root theme and I put inside a template as I see here : https://community.getbeans.io/discussion/how-to-create-page-template/ and http://www.getbeans.io/documentation/using-page-templates/, and I configure this template on my page "blog". It seems to be ok.
But now I need to understand how I could put inside this blog.php a loop query (if this is the logic)...
I try some code from https://codex.wordpress.org/The_Loop without success.
Certainly there is an universal way to create a very simple blog page in order to view all posts.
I just precise that I don't want a link from one category, by example http://mysite.com/category/firstcategory but a real blog page.
If you have a link in order to understand how I could arrive to have a blog page, I will appreciate ! Thank you in advance, Regards
Hello Emmanuel,
If you want a static homepage and your blog on a subpage like /blog, I would first recommend to create the pages “Home” and “Blog” in your WordPress admin. Then, go to "Settings > Reading" and set those as the appropriate pages to be used.
If you want to control the look of your blog "page", add a home.php
file in your child theme. With Beans, it is very easy to customize it.
Let's say that you want your posts to be split (content/image). You could add this snippet to your home.php
template.
<?php
// Remove tags and categories.
beans_remove_action( 'beans_post_meta_categories' );
beans_remove_action( 'beans_post_meta_tags' );
// Adjust post title.
beans_add_attribute( 'beans_post_title', 'class', 'uk-h2 uk-margin-small-bottom uk-margin-small-top' );
// Add post grid attributes.
beans_add_attribute( 'beans_post', 'class', 'uk-grid' );
beans_add_attribute( 'beans_post', 'data-uk-grid-margin', '' );
// Adjust image and move it before the beans_child_post_content wrap.
beans_add_attribute( 'beans_post_image', 'class', 'uk-width-medium-1-3' );
beans_modify_action_hook( 'beans_post_image', 'beans_child_post_content_before_markup' );
// Wrap beans post content and adjust post content.
beans_wrap_inner_markup( 'beans_post', 'beans_child_post_content', 'div' );
beans_add_attribute( 'beans_child_post_content', 'class', 'uk-width-medium-2-3' );
// Load Beans
beans_load_document();
Hope it helps ! 🙂
Mathieu
Hi Mathieu !
Hey, so easy ! Thank you a lot, I appreciate the time you take to answer with pertinent informations.
I think I will continue to learn wordpress/getbeans and maybe in the future I could help 🙂
Hope the project will continue for a long term ! Regards, Emmanuel