Forum Replies Created
-
AuthorPosts
-
Laurent
ParticipantThank you Peter. Your reply left me in doubt on several aspects so I asked ChatGPT and this is what it had to say (I think it might be useful to other members).
-----
"Handling the transition of posts from ONLINE to OFFLINE in a Custom Post Type (CPT) involves several considerations. Let's address your questions step by step:
1. Taxonomy or Custom Field (CF)?
For your use case, a taxonomy seems more suitable since it's designed for grouping and categorizing content. In this scenario, a taxonomy with two terms (ONLINE and OFFLINE) would allow you to easily filter and query posts based on their status.(@Peter: I'm surprised your reply both because your article comparing CF and taxonomy explictly says:
- Do you need to browse posts by value? NO => CF | YES => Taxonomy
- Do you need to filter by the value? NO => CF | YES => Taxonomy
- Do you need to manage (add, edit, remove) the values? NO => CF | YES => Taxonomy
Link: https://metabox.io/custom-fields-vs-custom-taxonomies/)2. Using the Same Taxonomy for Multiple CPTs
Yes, it's absolutely fine to use the same taxonomy across multiple CPTs. Taxonomies are meant to be flexible and can be shared among different post types without interference.3. SEO Considerations - 404 or Redirect
In terms of SEO, it's generally better to avoid 404 errors for content that has been intentionally removed or set to OFFLINE. A 301 redirect would be more user-friendly and can help retain SEO value by directing users and search engines to relevant content. However, the decision depends on your specific use case and how you want to handle the user experience.4. How to Display a 404 Error
If you decide to go with the 404 approach, switching the post to draft mode in the WordPress back office is one way to achieve this. Drafted posts are not publicly accessible, and attempting to access them would result in a 404 error.5. Filtering Published/Draft Status in Archive Pages
Yes, you can filter posts based on their published status. In your archive page queries, you can specify that only published posts should be displayed. For example, in a typical WP_Query or get_posts() call, you can include the 'post_status' parameter 'post_status' => 'publish'.
This ensures that only published posts are retrieved.In summary, using a taxonomy for the ONLINE/OFFLINE status seems like a reasonable choice. The decision between a 404 error and a redirect depends on your specific UX goals. Combining taxonomies with proper post status queries in your template files will help you achieve the desired functionality on the front end."
July 10, 2023 at 2:52 AM in reply to: Same value for a specific custom field of all posts of a CPT #42529Laurent
ParticipantHello Péter, I'm sorry because reading your reply, I realize my last comment mislead you.
What I meant IS:
- some CF of my CPT have the same value for all posts and I'd like to bulk change them from time to time,
- others CF have a unique value for each post of this CPT.In that case, is the settings page still a viable option according to you?
Or would it be the solution only if all the CF of that CPT had the dame value for all posts?
July 4, 2023 at 10:32 PM in reply to: Same value for a specific custom field of all posts of a CPT #42472Laurent
ParticipantThank you Peter.
Just to be sure, I didn't say all the CF are common to all posts of the CPT (only some).
Would it still work?Otherwise, another option would be to simply change the value directly in the database with some magic formula (that I don't have... yet). What do you think?
June 30, 2022 at 4:12 AM in reply to: Customizing the background color, the dashboard AND More #36725Laurent
ParticipantHi Long, Loïc IS Gridbuilder support, which is why I pasted what he told me because it could help other customers of Meta Box.
June 26, 2022 at 12:37 AM in reply to: Customizing the background color, the dashboard AND More #36673Laurent
ParticipantThank you Long. I hope my suggestions regarding #1 #3 #4 #5 #6 won't fall through :-).
Regarding Gridbuilder, here is what the dev Loic told me:
There is no integration with FB Favorite Posts.
It is however possible to use this shortcode in a card:
[mbfp-button id="{{ post.id }}" class="custom_class" add="add_text" added="added_text" show_count="true"]As for #2, where am I supposed to paste the code snippet you gave me? And is it still needed if I do what Loic said above?
Laurent
ParticipantEDIT to my previous comment: I found how to do it.
FOR CPTs & TAXONOMIES:
In the left menu of WP, Tools > Import / Export.FOR CUSTOM FIELDS:
Visit this link: https://docs.metabox.io/extensions/meta-box-builder/#export--importLaurent
ParticipantHi Anh Tran,
So for non developers, there is no easy way to import all the CF, Taxonomies and CPTs from a previous install (like what ACF offers with a JSON file)?
Laurent
Laurent
ParticipantHi Long, and first thank you for your prompt answer.
-
- Side comment: I just noticed that for the field #2 above, I copy/pasted the same code as for the field #1, which was not my purpose as I wanted to display the normal YT embed code with additional parameters in it.
Having said that, if I use the WYSIWYG field type, I can't see "Prepend text" and "Append text" fields.
Should I use the "Before" and "After" advanced fields instead?If I want to change some parameters of the embed code later, I'd like to do it only once to make it apply for all posts of this CPT.
So for example, for the embed code:
<div class="amara-embed" data-url="https://www.youtube.com/watch?v=wppajEOnljI" data-hide-logo="true" data-show-transcript-default="true" data-initial-language="en" data-hide-order="true" data-hide-subtitle-me="true" data-hide-improve="true" data-hide-order="true" data-hide-download="true" data-hide-embed="true" data-team="null"></div>I'd to prepend:
<div class="amara-embed" data-url="https://www.youtube.com/watch?v=and append:
" data-hide-logo="true" data-show-transcript-default="true" data-initial-language="en" data-hide-order="true" data-hide-subtitle-me="true" data-hide-improve="true" data-hide-order="true" data-hide-download="true" data-hide-embed="true" data-team="null"></div>leaving me with only the video ID to submit in the WYSIWYG field.
Would it work? If not, is there another way to do it?
-
- Therefore, can you give me an example of what these "Prepend" and "Append" fields are made for if they don't ?
Also, if I use the text field and the "Prepend" and "Append" fields as mentioned above, will Meta Box recombinate the three inputs (preprend, custom text and append) so that I can use the links in the front end for a text link or a button?
Thanks a lot, Long!
Laurent
Laurent
ParticipantLaurent
ParticipantThanks a lot Long, I really appreciate your support.
Take care,
Laurent
Laurent
ParticipantThank you Long! 🙂
Using Oxygen Builder, should I put it in a snippet in Advanced Scripts or Code Snippets?
Laurent
ParticipantDo you mind showing me how to do it in the PHP field of the Meta Box UI?
Thanks for being patient with me being a noob :-).
Laurent
ParticipantThank you Anh and Long, I have a better understanding of the situation now.
If I follow your suggestion for storing the lyrics, it is going to take me a lot of time to do it manually, so it got me thinking.
I bought WP All Import a year ago but haven't put it to use yet.
When I contacted the support of the plugin to know if I could use WP All Import to import the content of all my custom fields/posts, they said:If you're using regular custom post types and regular custom fields (i.e. the postmeta WordPress table), you should be able to import into the majority of Meta Box fields using these instructions: https://www.wpallimport.com/documentation/custom-fields/theme-plugin-fields/.
For more complex fields, or if you're using the custom tables option to store meta fields in a custom table, you'd have to write custom code that uses our API to import the data: https://www.wpallimport.com/documentation/advanced/action-reference/.
This leads me to the following questions:
1- does Meta Box use the postmeta WordPress table by default?
2- if so, does that mean that I can use WP All Import to import any type of custom field for my CPT (including the lyrics even if they have different sizes / numbers of timecode/lyrics pairs)?
3- as for styling the lyrics, I guess I need to add two classes (one for the timecode, another for the lyrics). Would you show me a screenshot of how to do it wfor a cloneable group with two subfield texts?Best,
Laurent
Laurent
ParticipantI understand Long and this exactly why I suggested that you add a NEW advanced custom HTML field that will accept a different output for each post (this output being created by ourselves before, using Excel or Google Sheet in my case).
Also, it would a lot quicker to do than adding pairs manually.
May I ask you to talk about it with Anh by explaining my use case to make sure he understands the benefit of it?
Selling on AS brought a lot of non-developers like me.
Laurent
ParticipantIt looks like your solution works manually. What if we want Meta Box to output the correct size automatically?
-
-
AuthorPosts