Relationship between 2 custom post types editable in both posts - advanced-custom-fields

I have created 2 custom posts using CPT UI. Artists & Releases(Tracks they've released).
Release page simply lists all release posts.
Artist page lists all details of artist and lists all releases by this artist.
I have set up a relationship using Custom Fields and use Dynamic.ooo ACF Relationship in Elementor to list the releases.
This all works fine.
The problem I have is that every time a new release post is created. User has to go back to artist post and edit to include the new release.
My question is. Is there a way to include the relationship field in releases post or is there a better way to achieve this?

Related

Create searchable archives from a static HTML/CSS onepage site with daily archives

We are looking to hire a developer to build a custom solution for us, but before that we basically need to know what questions we should be asking, since none of us have any experience with programming. We have a website that is a daily listing of coffee news that is then archived, with each HTML file representing an entire day of news. What we're looking for is some sort of search functionality that would allow specific results to be displayed, rather than the entire page the results came from.
Here is the website in question: http://dailydose.coffeetalk.com/
Typically you will have each news clip stored in a database. Then you want the developer to write a functionary to query that database for find news clippings of interest to the users.
The HTML only serves as a template to display this data you retrieved from the database.

Implement mysql table structure to Wordpress

Hopefully this is okay to ask here. Not a coding question, but rather a "where do I start" question. For hours I tried figuring out if it's worth to do this in Wordpress or not.
I have a music library, and post reviews of each song. I got my MySQL tables working; easy to pick artist/album for each song I want to publish. However, if I want to do this in Wordpress, is it a lot of hassle to get working nicely? I've been reading about custom post types but I'm not sure how to get all the relationship databases to work together and all to the actual post.
I want to be able to pick artist names and album names. What is preferred, use Wordpress or set up something myself? It's a lot of songs, albums and artists.

Transfer All Custom Field Data From Custom Post Type to User Accounts - Wordpress

Current Situation
I currently have a custom post type. This custom post type has numerous custom fields. There are many posts of this type, all with the custom fields filled out.
Currently, there is ONE POST of this custom post type that corresponds to each author on the blog. No author has more than one of these posts. The method in which it corresponds is simple, they are the author of their own post.
I used the Advanced Custom Fields plugin to set up and manage my custom fields, and I plan to continue doing that.
What I Want to Do
Instead of having these custom fields entered in each author's corresponding post, I would like them to be listed directly in their user meta. I can set up the custom fields easily in there using Advanced Custom Fields, even give them the same names and ids.
The the tricky part would be transferring all this data over. I COULD do it manually, but it would take ages. There is a lot of data to deal with.
Can anyone think of a way to automate this? It might be something as simple as renaming an entire table in the database. I have no idea, I don't know much about mysql databases.
WHY I want to do this, for those interested
Originally I just needed a way to list a bunch of people, and have a bunch of information about them listed on a page. It was not immediately clear to me that these people were all going to be USERS on the site, so at the time it made sense to just make a custom post type, and just enter each person into that with all their meta data.
But then they all became users on the site, and also authors with their own blog posts. And now I need to be able to query meta data about them FROM a blog post. But I can't figure out any way to do that, since their meta data isn't directly connected to their user account. It would appear that it would just be way easier (and more properly done) to tie all that data directly to their account.
Alternate Solution? Might be easier
There could be another way to make this work too. If someone can figure out a way to tie that custom post type post directly to its author, to the extent that you could somehow query it from anywhere as long as you knew which author you were querying, that would work and actually be better.
Possible ways to do that (these are just ideas) could include:
-Manually adding the custom post ID to a custom author meta field, so that you could get the ID of the corresponding post from the author's meta (not ideal, since I would have to enter this manually for every new author)
-That was actually my only idea. I thought of somehow using the username and hoping you can mess with that until you get the corresponding custom post... But there is no way to do that I think without tons of bugs.
Take a look to the excellent Posts 2 Posts plugin. In the official Wiki you can find a specific topic that seems to fit your needs: it's called Posts 2 Users. I hope this will be helpful for you.

WordPress: Generating pages from custom db table

I'm hacking WordPress quite a lot for a current project. I'm storing data input by the user into two custom database tables (still inside the wp database though).
Along with the information I need to collect, I'm also saving the wp user id into the database. I've generated a URL I'd like each user to be able to visit, to see the results of their input. The structure of this URL is simple http://domainname/username/searchname
Now obviously, I can output this as a URL and it can be clicked, but WordPress obviously just spits out the 404 template instead.
I kind of need to emulate the same functionality that the post pages have in terms of being able to visit this link and have data spit out based on a template.
I realise that custom post types sound perfect for this kind of thing. But I need users to be able to submit data from the front end, I'm not sure this is possible with Custom Post Types?
I think WP_Rewrite class is what you're looking for:
WP_Rewrite is WordPress' class for managing the rewrite rules that allow you to use Pretty Permalinks feature. It has several methods that generate the rewrite rules from values in the database. It is used internally when updating the rewrite rules, and also to find the URL of a specific post, Page, category archive, etc..
There are several examples in its documentation page. For a more hands-on tutorial check this blog article.
From what I've read so far, using custom database tables should be reserved to situations where the default tools can't handle the task.
The benefit of the default tools is that you don't have to create custom functionality (and all the details that come with it) to search, manipulate and display the data.
You could have a CPT called User Feedback, configured as hierarchical, each parent post corresponds to one user and the child posts would be the user input data.
Or it could be non-hierarchical and a custom taxonomy would make the bridge between posts and users.
After submission on front-end, you simply use wp_insert_post to add the info to the database as the post type (use title and content as holding fields if needed) and its associated meta data (other fields).
If you set the CPT supports argument to false, it won't show anything in the editing screen but the Publish meta box. And all the submitted information stored as meta data can be displayed by custom meta boxes.
After having this setup, if you need to fine tune the URLs, it's time to use WP_Rewrite.
That's how, in general terms1, JetPack manages the feedback from its Contact Form.
1 Checking the code, there's actually some interesting techniques used and worth replicating.
Related posts:
How to integrate custom database table in Wordpress and using Wordpress functions
WordPress 3.0 and Custom Post Types
When to (not) use a Custom Taxonomy

Wordpress export-import tables mess up categories

I have multiple wordpress sites that I use the same posts with. So basically I update 1 main site and to update the others I just export from phpmyadmin the tables:
wp_posts, wp_postmeta, wp_terms, wp_term_relationships, wp_term_taxonomy
After that I empty the same tables from the wordpress site I'd like to update and import the sql file.
Usually that used to work fine until recently I'd start getting the categories messed up.
When I enter the categories page I only see the parent categories shown up with the subcategories.
The strange thing is that I go to posts and I see available posts with subcategories.
The database looks fine regarding parents numbering.
Im sure there is no code problem because if I import my backup 5 tables it shows the subcategories well...
Any Idea's?
Thanks
I was having the same problem (imported all 3 terms tables via MySQL, sub-categories there in the database and via other pages but not showing up on Categories page), and it seems like a bug in Wordpress.
I just added a new sub-category as a test, and suddenly all my other sub-categories showed up in the list.
A solution for you might be to use FeedWordPress or a similar plugin to automatically pull content from the source site to the other sites via RSS. It gives you lots of control over categories, tags, custom fields, and so on, plus it gives you the option of whether to update matching existing posts.
I'm having the same problem you are, but so far FeedWordPress et al won't help because they don't handle custom fields in custom post types, which is what I need.