Forum Replies Created
-
AuthorPosts
-
[email protected]
ParticipantStill works fine for me. Make sure you change 'post' to 'page' if you are wanting it to work on your pages.
If you need it for both posts and pages, then use this.
// Remove the editor. Change 'post' to your custom post type. add_action( 'init', function () { remove_post_type_support( 'post', 'editor' ); remove_post_type_support( 'page', 'editor' ); } );[email protected]
ParticipantSorry Peter, but again I am not sure what page you are on, but the link you provided has nothing to do with the issue or question that I asked.
I am NOT needing to generate PHP code to then apply to my functions file, as I would be deactivating the Met Box plugin.
I am NOT using PHP!!! I am using HTML and Twig -- NOT PHP!
I am creating a GUtenberg Block via the Custom Fields extension within Met Box AIO. I choose "Code" for the Rendering option, NOT PHP or a template, but code. I then type my own markup using standard HTML and Twig.
So again, the question I am asking (and it seems you don't have it) is, "What is the Twig syntax to put in the HREF so one can output the custom field value"???
If you can't answer the question, then please find someone who can. Thanks
[email protected]
Participant[email protected]
ParticipantHey Peter,
Sorry, but I think you are not on the same page. I am not using PHP, I am using MB Blocks and rendering in the Code module, building it with HTML and Twig templating, so cannot generate any PHP code for you.
What I am simply asking is, what is the Twig syntax to use within a href when calling the Page Field?
[email protected]
ParticipantHey Peter,
Sorry if it was confusing ... I know about href and anchor tags, what I am referring to is the Twig markup for the href.
In my code you can see I am using either {{ hero_button_1_url }} or {{ hero_button_2_url }} to reference the custom field name. As you can see they are using the button tag, so I have a custom field for the button name and also the button href (which is using the Page field.
In my example the front-end output breaks and it is caused by {{ hero_button_1_url }} or {{ hero_button_2_url }} within the href, so my code is not correct.
[email protected]
ParticipantUpdate: Nevermind the post -- I see what the issue was.
I was trying to apply this to a single page and not an archive. I needed to use the custom query and now all works just fine.
[email protected]
ParticipantHey there,
Yes, some border, background, padding to help separate the different areas of data. MB is just a white block and very messy -- where ACF is clean and much easier to read.
JUst a thought. Cheers
[email protected]
ParticipantPerfect, thank you Long, that will do the trick. =)
Cheers
[email protected]
ParticipantHey Long,
Thank you for your reply and yes, I know I can do that with the custom post type. But what if I do not use a post type and just creating a custom fields for say a view template?
What I am ding is using metabox as a page builder -- so I would create a custom field group and them show it on a specific page. What I don't want showing up is the extra content editor, as I will have specific areas where the page content will be.
Are you able to do that? Or does it require a custom post type?
Cheers
[email protected]
ParticipantHello there,
Awww, that makes sense -- so it was me making the mistake. =)
Thanks for your help and the solution.
Cheers
[email protected]
ParticipantHey folks,
Sorry to reopen this thread ... but I noticed another issue that is related to this posting.
I can get the fields to render no problem now in the archives page, but that is it. It will no render the fields data on single page, single post, or shortcode.
Any thoughts?
Here is a video showing what I am running into: https://www.youtube.com/watch?v=ft8TI3J8qQw
Cheers
[email protected]
ParticipantAwesome, thanks Long ... appreciate that -- it also might help folks out, was a hair puller for sure. =)
Cheers
[email protected]
ParticipantHey Long,
Yes post type plural name is "Animals", the slug, which is autogenerated from the "Singular Name" is "animal". I also tried to change the slug so that it is plural as well, but did not work.
So after some digging (and maybe this should be put into your documentation) is that when you are adding that page/archive to your menu, you cannot add it from your "Pages" section, but rather from the post type section. You have to click on that post type, then "View All", then you have the Animal Archives which then shows the correct information.
So all is working but again this should not be so hard. Maybe consider updating your documentation with some clear understanding.
Cheers
[email protected]
ParticipantHey Long,
Thank you ... yes, I also came to that conclusion this morning after doing some Googling. I did find that the solution above that I mentioned is the best option in this case.
{% for item in post.icon %} <img src="{{ item.full.url }}" width="42" height="42" alt="{{ item.full.alt }}"> {% endfor %}Thanks again for your time.
Cheers
[email protected]
ParticipantHey Long,
LOL, ok ... silly me, that was an easy fix. =)
Cheers
-
AuthorPosts