OK people. my apology to any of you who actually waited for me to post this. there was a lot going on for me latley. trip to my country, holidays, work got crazy in the holidays, new year, camping trip for my birthday and the best part is my new iMac
. so now i can smothly write This second part of this tutorial. In the first part i showed you how to create “my-posts” page and how to delete a post. In this tutorial i will show you how to edit post from front end. There is a little more going on in this part so i will try to explain it the best way i can. note that this form works for custom taxonomies when it comes to categories and tags. so i am not sure how it will work with regular categories and tag but if there are problems we can all try to figure it out. and same as in the first part of the tutorial i will break it to sections.
Tag Archives: get_post_meta
Expanding our Back End Post Meta Boxes With Dropdowns
Yesterday we looked at expanding our knowledge of meta boxes. We added in a variety of form elements to our front end post form. What about the backend? We’ll it’s not quite as easy, but the concept remains the same. The hard part really comes from the fact that I like my selections to appear if I edit a post. From a front end post form that isn’t a concern, since I don’t allow front end editing (yet). But on the backend, if I select a checkbox, or dropdown, then next time I visit that post to edit it, I would like to see my selections saved and displayed. Let’s play around with some meta boxes.
Expanding Our Front End Post Meta Boxes With Dropdowns, Radio Selection and Checkboxes
We’ve used meta boxes in a couple of different ways on our tutorials here. We’ve added them from functions.php to be used in the backend post screen, and we’ve added them to our front end posting form. Let’s expand on that idea a little, we’re going to take a look at how to use dropdowns, radio fields, and checkboxes with our meta boxes from the front and back ends.
Review of Posting From Front End Form
Over the past three days we’ve accomplished quite a bit. First we set up a form to post from the front end. Once we had the form all set up, we dropped in some code to allow images to be uploaded with the form. And finally we added in the ability to use custom meta boxes on our form to collect additional information in custom fields for us to use. That’s a lot of code. Plus I had some difficulties with code that sometimes worked and sometimes did not. I got that all fixed. I thought it might be best to drop the full code I have in one post so that we can review it together.
Add a Meta Box to Use Custom Fields on Front End Post Form
So far this week, we have learned how to post from the front end. And we’ve expanded on that by allowing image uploads from the front end. We are going to go one step further today and add a meta box to our form. This way we can use the meta box to gather data and feed it into a custom field so we can use that data. The data can be just about anything, really use your imagination here. I’ll give some examples of stuff I’m thinking of, let’s get into it!
Including the Article Link for Link Post Format From Child Theme Functions.php
So far in this little mini-series, we have learned how to add in new post formats to our twenty ten child theme. We have set up meta boxes to enter in a URL for our Link post format. We have split out our formats to individual templates, and we set up our new link format in it’s own template, and made use of the URL to link the title of the link post format to the original article. But what if someone visits our site and comes directly to the single post view of the link post? Our edits so far have only affected the index/blog view (and archives). Well today we will get that link added in to the single post view. Check it out!
Putting Our Meta Box to Use In Our New Link Post Format
If you’ve been following along with this little series at all, you now that over the past several posts, we’ve looked at adding in custom meta boxes to be able to input a URL for our link post format. And we looked at how to split out our post formats to make it easier to edit existing ones, and add new ones. Today we will make use of the custom meta box, by actually taking that URL you can input to the meta box from your post screen and applying it to the title of your post, so that rather than the title linking to the articles permalink, it will link to the original article you are referencing.
Adding Meta Boxes to Your Post Screen
So yesterday we briefly went over custom fields in this article. Today we are going to expand on that with some meta boxes. Meta boxes are really just a fancy way to input custom fields. They are less confusing for you and anyone else using your theme, as they can prompt for exactly what is needed. These can be text boxes, text areas, check boxes, etc. It’s up to you how you implement them. I only recently started using meta boxes, but I love them. Let’s take a look at how to use them.
A Brief Introduction to Custom Fields
A few posts ago, we learned how to add post formats to a twenty ten child theme. After that, we looked at how to add some custom styling to post formats. Our next goal coming up is going to be adding different functionality to our posts formats. Crafting our own loop that does something different with the format. I’m going to focus on the Link format. I want the link format to have it’s title point to whatever article/site I am talking about, rather than link to the post, as is normal theme behaviour. A cool way to do that would be to just have a box on the new post page that asks for the URL, and automatically links the title to that URL. We can do that with meta boxes. We will look at adding meta boxes tomorrow, but today we start out with custom fields. Custom fields are pretty much how it all works, let’s take a peek.
Seperate Lines out of a Multi-Line Custom Field Value
I ran into an interesting problem today. My podcasting plugin over on my blog flaked out on an upgrade. The music player still works, but the download links disappeared. Now that site relies on the music downloads. I just couldn’t have that. The developers are looking for a fix, but I needed the functionality now. So I came up with a nifty band-aid.