- This topic has 9 replies, 3 voices, and was last updated 3 years, 5 months ago by
David.
-
AuthorPosts
-
November 14, 2022 at 12:29 pm #2415491
Andrew
I have a site that now wants to add a blog but I’m not sure how best to approach it with Generatepress. At the moment, as there is no blog, there is no blog page set in WordPress – Settings – Reading.
Should I create a page and set it there? Or should I create a page, not set it there, and use query loops?
Can I edit the standard Blog page (set on WordPress) using Generatepress via Elements? I assume that is the best route but I can’t see any relevant guide in the Docs to follow? If you could point me in the right direction that would be greatly appreciated, thanks!
November 14, 2022 at 2:21 pm #2415589Leo
StaffCustomer SupportHi Andrew,
I would say creating a page and assigning it to the Posts page in the Readings setting is the first step.
As for editing the blog page, it depends on what you are trying to edit.
There are some customizer options:
https://docs.generatepress.com/article/blog-content-layout/Or you can also create various templates:
https://docs.generatepress.com/article/block-element-content-template/
https://docs.generatepress.com/article/block-element-post-meta-template/Hope this helps to get you started.
Let me know 🙂
November 15, 2022 at 2:31 am #2416081Andrew
Thanks! I think I am getting there.
One thing I’m not sure is how to add a title to the blog page? If I add it to the Content Template Block Element then it adds it at the top of every post. If I add it to the blog page it gets ignored? I must be missing something!
On a semi-related note, on pages I add a container and then the margins sort out the layout but I can’t seem to do this with the blog page – Do I need to do it a different way?
And lastly! Ideally I’d like every blog post to be in url/blog/post-url instead of on the main domain but I’m not sure what to change! (I appreciate this may not be Generatepress related so feel free to ignore!)
I’ve added a link to the example blog post for info. Thanks.
November 15, 2022 at 5:51 am #2416302David
StaffCustomer SupportHi there,
Just to cover:
In the Theme we have several templates, Blogs and archives use the
archive.phptemplate.
Within those templates is the WordPressLoopfunction that finds all the relevant posts related to the current query.
And for each one it outputs the individual post using the themescontent.phptemplate.When you create:
a. Block Element – Content Template, it overwrites the
content.phptemplate
b. Block Element – Loop Template, it overwrites the entire Loop template.So considering your first 2 questions it may make more sense to use a Loop template.
Then you can add:1. Your Title and other content.
2. A GB Query Loop Block. You should set theInherit Query from TemplateoptionYou can then also use the GB block settings to control your margins etc.
Note:
I would suggest you create one Loop Template specifically for theBlog( Display Rules Location ) if you want to customize the title and any other text.
Then a separate Loop template for All Category Archives, where you can use the GB Dynamic Data to display the Heading etc.Regarding the permalink structure – are you using an SEO plugin? As those are best suited to create a custom structure.
November 15, 2022 at 6:35 am #2416354Andrew
Thanks, I’ve used the Loop Template for the Blog but I’ve hit a wall when trying to create one for All Categories Archives. I can’t see what I have to do differently compared to creating the first Loop Template for the Blog?
I use the SEOPress plugin but I don’t think that has anything in it for permalink structure. I think I’ve sorted that though, I changed the structure to /blog/%postname%/ and it only seems to have affected posts which is what i was after – Pages have kept their existing URLs which is a relief!
November 15, 2022 at 8:01 am #2416768David
StaffCustomer SupportThe second template will be identical to the one for the Blog, except you can:
1. select the Headline Block you have for your title, and in the Blocks Toolbar, select the Dyanmic ( disk icon ) options, and set the Dynamic Text Type to
Title. This will automatically show the relevant category term for the title.
You can add some Before text too.2. Optional – you can add below the title a GP Dynamic Data block and set its Type to: Term Description. This will pull in the terms description if one is set.
3. The Query Loop block MUST be set to
Inherit Query from Template4. The Display Rules will be Post Category Archives.
November 15, 2022 at 9:40 am #2416883Andrew
Excellent, thanks! All makes sense. Loop Templates are excellent!
I just have one last query… In the Block I’m putting them all in a container in the same way I do with pages. And I add the margin in the same way I do with the pages but the alignment is different on these pages compared to the normal pages. I’ve added an example below – Do you have any idea why that is?
If you see the example page the left sidebar is where it should be but on the blog page it’s down and to the right?
November 15, 2022 at 9:48 am #2416893David
StaffCustomer SupportSo on your Pages you have the Content Container set to Contained – which removes the Themes padding.
To do that on Archives and the Blog you would need to add a Layout Element, and use that to set the Content to ContainedNovember 15, 2022 at 11:07 am #2416982Andrew
Excellent, thanks again!
November 16, 2022 at 4:35 am #2417848David
StaffCustomer SupportGlad to be of help!
-
AuthorPosts
- You must be logged in to reply to this topic.