-
AuthorPosts
-
October 29, 2019 at 6:40 pm #1152121
Hi,
I’m doing a website for a client (access available in private). This website has a team list for which I made a custom post type with ACF into a plugin. The post type is “team”. If I go to my URL (mysite.com/team), the template I can use is archive-team.php.
I need to have in that page text content over the team list, which must be editable by my client, so I use the Advanced Layout Builder on a page which I named “Equipe” (french for team…). In this page, I use a shortcode to show my team list. This page exists and works, but with a URL which can not be “/team”, or I fall on the other template… And the old site team page is at /team, so I’d prefer to be able to keep that URL for SEO.
How can I make that the page at URL “/team” uses the page I made ?
I also tried to edit my team-archive.php template, get the page by ID and tried to insert it with code (see below). This works, but the HTML is messed as all the content I query and write to output team list seems to be inserted in the last section of the content in the Advanced Layout, even the footer. (ie #av_section_2)
$page = get_post($pageId); $content = $page->post_content; $content = apply_filters( 'avia_builder_precompile', get_post_meta( $pageId, '_aviaLayoutBuilderCleanData', true ) ); $content = apply_filters( 'the_content', $content ); $content = apply_filters('avf_template_builder_content', $content); echo $content;
So if option 1 is not possible, how can I get a page content, print it in my template, then continue the content with my team list ?
Not sur this is very clear… and I’m stating to be confused at how I can solve this… reason why I did setup an online demo for you if you need.
- This topic was modified 5 years ago by nordtheme.
November 4, 2019 at 10:22 am #1153653Hi, anyone can please help ? In case the regitration number is too old, you’ll find the new one below
November 5, 2019 at 7:27 pm #1154059Hi,
Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
BasilisNovember 7, 2019 at 1:07 pm #1154615well I’m a freelancer… I personnally do not know many final clients who develop plugins… and I think your answer is not satisfying at all.
The question can be simpler:
A. can I force to show a PAGE with url (/team) where wordpress would show a archive-xxx.php page corresponding to a custom post type?Or B: can you give me the right method to get an Enfold advnced layout content page by using: get_post($pageId); and then echoing the content in a clean and not completely div-messed way ?
Thanks
- This reply was modified 5 years ago by nordtheme.
November 11, 2019 at 5:55 pm #1155690Hi,
Did you check function get_supported_post_types in enfold\config-templatebuilder\avia-template-builder\php\template-builder.class.php?
With filter avf_alb_supported_post_types you can add your post type and then use the ALB page builder.
Best regards,
GünterNovember 11, 2019 at 6:55 pm #1155730Hey, thanks,
Yes I have, the problem is not the details pages, it’s the list page.
I want it to look like (this is a page with ALB and a codeblock is used with a shortcode to list the members and display them as I like
Desired look, wrong URLbut with the URL /team (which corresponds to my posttype name as i need the details to be /team/xxxx-yyy) i get the default archive listing…
So I tried to make a template: archive-team.php where at the beginning I get the page I want, read its content and try to output it (only for the first text part, before “Associés”) and then list the members with custom code… but the output of page content is broken, look at the footer it is contained in the content container, etc… (see the code I use below)
unwanted look but right URL$content = $page->post_content; $content = apply_filters( 'avia_builder_precompile', get_post_meta( $pageId, '_aviaLayoutBuilderCleanData', true ) ); $content = apply_filters( 'the_content', $content ); $content = apply_filters('avf_template_builder_content', $content); echo $content;
- This reply was modified 5 years ago by nordtheme.
November 14, 2019 at 2:38 am #1156596Hi,
Thank you for the update.
You can copy the content of the template-builder.php file into the archive-team.php template, then display the content of the “equipe” page in the “team” archive by editing this code around line 69:
$content = apply_filters( 'avia_builder_precompile', get_post_meta( get_the_ID(), '_aviaLayoutBuilderCleanData', true ) );
Instead of getting the current ID, replace it with the ID of the “equipe” page.
$content = apply_filters( 'avia_builder_precompile', get_post_meta( 48, '_aviaLayoutBuilderCleanData', true ) );
The content of the “equipe” should display in the “team” archive page.
Best regards,
IsmaelNovember 14, 2019 at 5:48 pm #1156856hi Ismael
thank you very much for this helpful answer. It works very well, except I have an empty div at the top of the page which brings the content lower than desired…
Do you have any idea why ?
if you look here
and then click on “equipe” link (which is not yet mapped on this archive page), you’ll see the difference. On Equipe, and all “normal” pages, there is less margin before the content.BTW I can imagine CSS or JS ways to correct it, but it would be cleaner no to
November 18, 2019 at 3:54 am #1157732Hi,
Thank you for the update.
It seems to be displaying the default container from the archive template. You can either edit the template directly, or add this css code to remove the first container from the team archive page.
.post-type-archive-team .main_color.container_wrap_first.container_wrap.fullsize { display: none !important; }
Best regards,
IsmaelNovember 18, 2019 at 11:50 am #1157815Hi Ismael,
thanks for your answer. I don’t know what part of the template to remove, so I used the CSS and all works as I want to now
cheers & thanks
November 19, 2019 at 5:53 am #1158029 -
AuthorPosts
- You must be logged in to reply to this topic.