-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Widget title addition #230
base: develop
Are you sure you want to change the base?
Widget title addition #230
Conversation
related to #78 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It seems that the |
Yeah, I thought about that and verified the behaviour with a category archieve. It seems like the function get_page_by_path could be working, but it seems to be quite buggy when switching the permalink structure, so I had switched to url_to_postid. Do you have another function which could be working too? |
I think the cleanest way would be in storing metadata for the visited page in the Statify table, like post ID as an object ID and the object type, which could be any post type or term type. That way you can find the correct object according to object type and object ID and get the current title of the object. |
Yeah, that would be. But as of that, you would have to update the metadata every time the url or the title is updated - I think thats a quite heavy performance issue. |
If you construct it correctly, you can retrieve the current title of all items in the widget with a single SQL query, which is much better than using |
Yeah, that's correct, it would be much better. But modifying the table after it has been created would force you to either uninstall and reinstall statify to create the table correctly or check for every website access if the new columns in the table already exist. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Actually that's not a big deal at all. There is already a routine to initialize the table properly, so the schema may be updated during a plugin update. |
As addition: take a look into |
Alright - but with what action hook should I modify the table in your opinion? Directly in the functions file for execution on every call would be a bad practice I think... |
I can only speak for myself, but the best way I found was to store the migration version as option and migrate the database depending on this option. See here: https://github.com/epiphyt/embed-privacy/blob/main/inc/class-migration.php |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Added the title to the widget on hover over url so that you can see what page it is if you have short urls enabled.
If it's the front page, the title of the website is returned.