Site logo

Archived topic

Rebuilding site with generatepress

28 replies · Started by Adarsha on March 29, 2022

Viewing posts 1–15 of 29

Hey guys.
Have been rebuilding the site from divi to GP.
Currently stuck with these issues. (Did try a lot before contacting here)

1. How can I modify the quote part to default have a particular sizing (as it does not take size of paragraph) and also the 1 side color to be orange as my original site. There is no place to set this and I see block element to fetch dynamic content.
Link and screenshot attached in sensitive area

2. As I scroll, everything goes behind header as it should ( have added a white background for header)
But quote becomes transparent. I have attached the photo in sensitive area. (You can also test that via the previous link.

3. I also have a similar issue when it comes to primary menu when it comes to footer. Screenshot attached.

4. As you can see in my original website, I have post template settings which will default make any image I add in block editor Guttenberg to get this border/ shadow and stuff. I bet I can also do same in GP. In post template I have added default dynamic content. How can I specify the post to make the images always certain way ? Screenshot attached.

5. Every link I have is getting a underline. I don't remember adding that anywhere. What maybe wrong?

6. I created a author box block element for posts and it is working really well. But only issue is, the border I added is going out of bounds. It is built with only 1 container and when I reduce the container size, only inner photo/info part reduces. The top and bottom border does not change. What should I be doing. (screenshot attached)

7. Is there a way to add TOC above the first H2?
I tried different hooks and they either add at top of post or no where else. Am I missing particular hook here?
All my articles usually have initial intro and then H2's start. I want the TOC to be after intro and before 1st H2.
For TOC I have a plugin and have created a block element with short code. Need to know where to place the hook.

8. Most important thing for me.. How can I create blog pages based on category? I have attached links to my original site which is created based on this.
I have a info site and its only blogs. Based on category I have different pages.
In divi, I can just add the blog module and select category, all the posts in that category would appear.
Please check the links and let me know.

These are lot of questions. I hope you don't mind and help me out.
Thanks a lot :)

Hi Adarsha,

I’ll try answering one by one as well. :)

1. The font size of this WP core block can be modified through its Block settings: https://share.getcloudapp.com/E0ug9R6d

With regards to the color, try adding this CSS in Appearance > Customize > Additional CSS:

blockquote.wp-block-quote {
    border-left: solid 5px rgb(255, 0, 0);
}

This would change the left border color and size for all block quotes. Kindly replace 5px and rgb(255, 0, 0) to your preferred values: https://www.w3schools.com/colors/colors_picker.asp

2. Try adding this CSS:

header#masthead {
    z-index: 10000;
}

You can also insert just z-index: 10000; inside the header#masthead rule you already have.

3. The code above would also resolve this.
4. You can do this via custom CSS. For instance, if you wish to for all images on posts to have this border-radius and box-shadow, try this:

.single figure.wp-block-image img {
    border: solid 3px rgb(120, 120, 120);
    border-radius: 100px;
}

Kindly modify the values here as well to your preference.

Reference: https://css-tricks.com/almanac/properties/b/box-shadow/

5. This is default WordPress behavior. Try this CSS to remove it:

a {
    text-decoration:none;
}

6. Can you try hooking the Element to after_content?
7. If you want to place an Element somewhere specific not in the list, you may create your own shortcode which create a new custom hook:

Portable hook code:

function your_shortcode($atts, $content = null) {
      ob_start();
      do_action('hook_name');
      return ob_get_clean();
}
add_shortcode('portable_hook', 'your_shortcode');

Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

Adding it through Code Snippets should work.

After adding this PHP, you may add the shortcode as such: https://share.getcloudapp.com/ApuJGooG

Then you can now hook to hook_name through custom hook.

Example: https://share.getcloudapp.com/eDu5xKLX

8. I’m not sure I understand this correctly. Are you referring to Post Archive pages? By default categories have their own archive page /category/“archive name”. If you’re referring to this, you may also use Elements to modify this.

If however you’re referring to a page which would query posts of specific categories, you would need to utilize the WP Query Loop Block or use a third party plugin like WP Show Posts which is soon to be merged with GenerateBlocks.

Hope this clarifies. :)

1-5 all worked well :)

6. If I choose after_content, then nothing appears.
7. I don't understand why I would have to add all that. I can just add the TOC shortcode given by plugin into each post at that place and this is solved. The reason I wanted to create a block element was so that I don't have to go and add this short code to 100+ posts of mine. The solution you gave also needs shortcode to be added individually to each post and further, also do more stuff.

I see that there is lot of hooks. The hook I need is to place before the 1st H2 (There is no H1 in the post template)
So it should place the toc before 1st header of any form. The reason it may not be working now is maybe because i use a post template which is called dynamically and a new hook cannot further penetrate a block which is dynamically called?

8. I'm happy to buy generateblocks pro. Infact I want to. If you can guide me on how I can create pages with posts of specific category via that. I want to buy generateblocks pro not just for that, but also to reduce the usage of so much css codes for every small thing.
I have previously given you links to my original website with pages of posts to specific categories. Please do check it again.

Hi there,

6. You will need 2 Container Blocks. Use the first one to set your inner container width. No padding or other spacing.
Then move the existing Container block with the author box inside that one.

7. There are NO action hooks inside the content of your posts. The content is your data in the database. To 'hook' stuff into the content requires a filter hook - ie. this one: the_content() :

https://developer.wordpress.org/reference/hooks/the_content/

Whereas action hooks are like 'hang something in this exact place' - filter hooks are more complicated.

The easiest method would be to use the Ad Inserter plugin it provides a 'filter builder' for that kind of thing. See here where a user had a similar request:

https://generatepress.com/forums/topic/ad-placement-2/#post-2169661

Alternative to that is to create a filter function. See this topic:

https://generatepress.com/forums/topic/how-to-add-a-block-hook-before-the-first-h2-heading/#post-1992459

8. WordPress and GP automatically creates archive pages for your categories. If you click on any linked category term it will take you to one. Designing those pages requires two optional things:

a1. The Blog Module for defining columns:
https://docs.generatepress.com/article/blog-content-layout/

a2. And you can use a Block Element - Content Template to design the individual post card:
https://docs.generatepress.com/article/block-element-content-template/

6. Thanks that works.

7. Would be a handy feature when I enable ads. For now will do manually.

8. Unfortunately I don't want to do it that way. pages are very important for me.
If you check my original website, I have linked to pages aswell. This is a very simple thing.

In divi, I would create a new page. Select their blog module and choose category. All posts from that category would come there.
Let me show you links again. (added in sensitive area)

further I also designed home page same way. Please don't tell me there is no way for such a simple thing.

8. There are ways to do that - its a pain in the backside, and can lead to duplicate content eg. ( if you check your sites category slug: https://your_wbsite_url/category/productivity/ you will see you have auto archives ).

The method i proposed is automatic. If you ever create a new category term and add posts to it - the archive is automatically there. The page title and the archive description can also be displayed dynamically.
Divi sure does make these things more complicated then they need be ;)

So why the need for Pages ?

8. I already have these pages live and indexed. Even ranking. Now what should I do about them? I just want to create same on GP
These pages are also ranking for various terms. I know they create duplicate content, but they have different slugs. As our website gets quite some traffic from social media, these pages are important for interfacing.
I just need a way to add blog module inside a page, so it can show posts of certain category inside a page.

Further, if you check my homepage, I have added a "featured posts" section.
How can I do that in GP? As there is no way to add blog posts that way.
Or if there is a way, please tell me.

If you want to use Static Pages then you can - today you will need to use the core Query Loop Block to display your posts.
In a week or so time we will be releasing an Alpha update to GenerateBlocks that will provide a much more powerful query loop with all the GenerateBlocks style controls.

The method i provided above could be applied if all of your Category terms are identical to their respective Page names then you can use a plugin to remove the /category slug from the URL.

Homepage - this depends on how you select the Featured Posts. Its possible to filter the home posts page to display a different query.

How is it even possible to add in home page if there is no way to add blog module?
Home page has random individual post.

I just want to display random individual posts. No need for any fetching or hooks there.

Regarding pages, i'm clueless as to what you are trying to say. Please do explain that in a way newbie can understand

Query Loop Block??

Query loop block is a WordPress core block, for more info:
https://wordpress.org/support/article/query-loop-block/

I just want to display random individual posts.

Not sure if the query loop block can add random posts though, GP has no control over it. But you can try play around with it.

I'm not sure why we need to complicate this.

Let me make it simple.

I want to show 10 posts of mine in home page. It is that simple
How can I do it? I will link to my home page where I do similar way currently.

I just checked Query loop thing and is something I don't want to do.
I just want to display in pages my categories. There are many websites which do that.

Is there a way to make this happen with generateblocks pro atleast? To make archive category pages look good.
The way you mentioned to use customize > archives, the design is so dull

I checked your site, are you talking about this part? Are those posts the 12 latest posts?
[removed]

If so, It can be achieved by using a query loop block.

Is there a way to make this happen with generateblocks pro atleast?

No, not yet. We are still developing the query loop block for GB.

To make archive category pages look good.

Yes, with GB and GP, you can create a block element - content template:
https://docs.generatepress.com/article/block-element-content-template/

Hi please remove the screencast from public.

This archived topic is closed to new replies.