How can I add attachments to a post with WP-API - wp-api

I am creating posts with WP-API and I want to attach files to them.
I see a section in the docs saying "create an attachment", but it seems that it doesn't associate the file with a post.
I also don't see any other obvious way to associate a media/attachment with a post.
What am I missing?

It seems that WordPress (or WP-API) does not link media to posts, but you have to add a link on your post to the media/attachment.

Related

How to redirect or show custom error message?

I need to show custom error page when the DB server down,
I think you are looking for error pages in the framework. It is located under application/views/errors/html there's a file named db_error.php folder. I think that's where you are looking for based on the question and image you posted. You can manipulate those page and customize the design of the page. You can also refer to the guide here.

Can't find user when trying to tag them in comment on Visual Studio Online

Whenever I'm reviewing a Pull Request there is a certain user I want to tag in a comment, but when I type #Their-Name nothing pops up. The only work-around I've been able to find is I can add that user as a reviewer, then I am able to tag them in the comments. Is there some kind of setting that I can change on that user to have them always show up?
Unfortunately, this is by designed. Take a look at below part of leave comments in Review a pull request:
Comment inline in the Files tab in your pull request by selecting the
comment icon (Comment icon in a pull request). Leave feedback not tied
to a specific code change by commenting in the Overview tab.
Reply directly to the author or other reviewers by using
#username and reference work items using #workitemID in your
comments. You can also reference other pull requests using
!pullrequestID.
This is also make sense. As a workaround, you could configure automatically include code reviewers in branch Policy. After this setting, these reviewers are automatically added to pull requests that change files along those paths.
So you don't have to manually add that certain user as a reviewer of your pull request and you could directly #he in the comment.

How to remove date created in blog post url for pyrocms (codeigniter)

This may or may not have been answered. Since i've been searching for a correct answer the last few days, i'm afraid not. I'm working on this project in codeigniter (pyrocms) and i'm trying to get clean urls. I already managed to remove /index.php/ from the url. Except the blog module builds the urls from the date the post have been created (www.sitename.com/year/month/post-title. Obviously i want to achieve a url like www.sitename.com/post-title.
I tried routing in the module/blog/config/routes.php but that dind't work out for me as well.
Any help in the right direction would be much appreciated.
Thanks in advance!
Assuming you're using PyroCMS v2x
www.sitename.com/post-title is going to be controlled by your pages controller. It's a special thing the core dev team wrote in.
The blog is a module so www.sitename.com/module_name/... is how you call the module.
You can shorten the URL for the blog by editing the routing control in the blog module.
You could, at best, get away with www.sitename.com/blog/title, but you'll need to rewrite some of the module code and routing to do that. There's no easy way to do it like you might find in wordpress.

Rails adding images to a Post

I have a Rails app for blog posts.
Each Post has a title and the blog_text. I want to be able to add images to the blog post as well while i'm creating the blog post. What's the correct way to do this?? Would I just create another migration to add blog_photos so the post has_many blog_photos??
Or should i install a good markdown editor for the blog_text??
It depends on how the images are to be used. Here are two scenarios:
The images are meant to be inside the blog text and added by the user. For this scenario I would use ckeditor (https://github.com/galetahub/ckeditor). This will give the user a WYSIWYG editor and allow them to upload images into the blog text (CKEditor will create two models for attachments).
The images are specific header/icon images for a specific purpose and not contained in the blog text. In this scenario I would use either paperclip (https://github.com/thoughtbot/paperclip) or carrierwave(https://github.com/carrierwaveuploader/carrierwave) and depending on the specific use case would add the image directly to the post model or create a separate model BlogAttachment (if you need a one to many relationship).

how to allow user to format his aricales when user doesnot know html

In my website i want to allow users to post aritcals.Users post articles in a textarea as used by users of stackoverflow to post their question. Now i want to allow them to format articles, without having them to know html.User should be allowed to mark text as bold, put a image, mark some part as code, etc (other things as used by stackoverflow and hubpages.com).
How can i provide shuch option in UI.
How do i support it DB?
Why not use an editor like TinyMCE ?
http://tinymce.moxiecode.com/
http://www.openwebware.com/wysiwyg/demo.shtml
Try this one :)

Resources