Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Display Order of Content Template Block Elements

  • Hello. I’m using GP Pro. Using ACF, I created a custom post type called Products, which is basically going to be the template for “brochure” pages related to products we sell. We have three types of Products: Sports, Industrial and Sensing. I made custom Field Groups for each, and I also made a general Field Group call General Product, which keeps generic fields common to all products, like Dimensions, Weight, Delivery Status, etc.

    I created a taxonomy called product_type, and it can have the value sports, industrial or sensing.

    I then created four Content Template Element blocks: Sports Template, Industrial Template, Sensing Template and General Product Template.

    The plan is that we will create a new product, and it will either be product type sports, industrial or sensing. Each Product post will get the appropriate Element Blocks displayed on that page, and all Product posts will get the General Product element.

    That is largely working. However, for whatever reason, the General Product Template is always displaying top-most of the other templates, but I need Sports Template, Industrial Template, and Sensing Template to display above General Product template. I have adjusted Field Order in the Field Groups definition. That worked for entering data when editing the posts; the general product fields are listed last in the editor. However, that did not have an effect on display.

    I went into the Element editor and adjusted a field called Order. I gave the General Product Element a very high number, but it didn’t affect the display order in the post. I also tried a large, negative number, but that also had no effect.

    Please advise how I can solve or work around this issue.

    The elements displaying in inverse order:
    https://i.postimg.cc/cHBkQGkp/2025-02-03-07-36-50-0001.jpg

    How I tried to adjust the order of the Elements;
    https://i.postimg.cc/0QsHMynG/2025-01-31-21-47-00-0000.jpg

  • Hi there,

    are both element-type content templates?

    Can I see a page with the 2 elements?

  • Yes, they are both content templates.

    This photo I posted shows both elements.
    https://i.postimg.cc/cHBkQGkp/2025-02-03-07-36-50-0001.jpg

    A link to the actual page is listed in Private information.

  • Hi there,

    An alternative you can try to fix the order of the elements is by using CSS. Assuming the layout for all the Product Type pages is the same, you can use the following CSS:

    
    body.single main.site-main {
      display: flex;
      flex-direction: column;
    }
    
    body.single main.site-main > :nth-child(2) {
      order: -1;
    }
    
  • Thank you for the suggestion. I don’t love it, but I think it works. I just don’t want the layout to suddenly break in six months after an update.

  • I assume the order of the content template is sorted by the ID of the GP element.

    So if you create a new block element – content template, copy the Product details section from the existing content template to the new one, and remove the existing one, then the overview should go on top.

    Can you give it a try?

    You can also try changing the element type of the OVERVIEW section from content template to hook > before_main_content, let me know if this works!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.