Skip to content
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

How to show URL of bookmark made with micropub? #248

Open
frankmeeuwsen opened this Issue Mar 2, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@frankmeeuwsen
Copy link

frankmeeuwsen commented Mar 2, 2019

I have both post-kinds and the micropublish plugin installed. I can create a new entry through micropub as a "bookmark-of" entry. It gets into my database and in the wp_postmeta table it shows an array with the various properties of the post. The meta_key is mf2_bookmark-of and in the array I can find the originating URL and other properties like the text coming from that URL.

My question is, how do I change the kind-bookmark.php in my own kind_views directory to show information from that metakey entry in the wp_postmeta table? It looks as if the first line in the copied template already ends it in my case. The first line is

if ( ! $cite ) { return; }

With my limited knowledge of PHP, I understand it searches for a variable $cite and only when it finds this, it can continue. So some follow-up questions:

  • Can I safely remove this line in my own templates or will this break something else?
  • What is $cite and how is it populated?
  • Is there a tutorial somewhere with some example code I can use to make my own kind-bookmark.php?
  • Why isn't the original bookmarked URL included by default in the bookmark post kind?

Thanks for your time and help.

@dshanske

This comment has been minimized.

Copy link
Owner

dshanske commented Mar 2, 2019

I assume you mean the Micropub plugin. To answer your question.

  • The $cite variable is retrieved before the the template is loaded so it is available to all templates. The line is to protect against the possibility someone set something to bookmark without having any bookmark data, which would cause errors
  • I've never written a tutorial. The easiest way is to copy the file and edit it. Would welcome someone writing one.
  • It should be. Are you saying displayed rather than linked? It should be linked to the name. I just posted a random 1984 article using Quill to my test site at https://wpdev.gwg.us/2019/03/02/3932/ . It seems to work as expected.

I want to help...I'm not sure exactly what you are asking with the URL? You want the full URL displayed?

@frankmeeuwsen

This comment has been minimized.

Copy link
Author

frankmeeuwsen commented Mar 2, 2019

I did some more testing with my local development environment and I did the old "turn off all the plugins and see what happens" test. Always my favorite on WordPress.... It turns out the post-kind plugin conflicts with the popular Yoast SEO plugin. When I deactivate the Yoast plugin, everything shows just fine. When I activate Yoast, I don't see any name or URL displayed as the bookmark template should.
I'd like to continue using the Yoast plugin, but where is the problem? In the post-kind plugin or in the Yoast plugin?

@dshanske

This comment has been minimized.

Copy link
Owner

dshanske commented Mar 2, 2019

I have seen another plugin somehow interfere with Post Kinds. Will investigate this.

@frankmeeuwsen

This comment has been minimized.

Copy link
Author

frankmeeuwsen commented Mar 2, 2019

One more thing. Now I know where the problem is, I've been working on my own template and I use some test bookmarks, made with micropub. Most work perfectly, but I see the output of a post by Chris Aldrich formatted different. To test this yourself, make a micropub entry of his post "Inoreader as a indieweb feedreader". This post has some comments and you will see all these comments are also included in the postmeta table and are shown in the $cite array as individual arrays. This changes the way the array is created and thus how the cite variable is populated. I hope this might also help to improve this great plugin. I look forward to make some cool templates. And maybe make my own post kind "beers I drank" ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.