Add a new section to the wp-admin edit post page - wordpress

One of my post types is called Events and on here I have typical things like a post title, body, event date, etc.
In the site's code (on a custom template), I am programmatically adding meta to events when a user signs up (custom array of values).
The problem is that an admin can't see this data.
I wanted to know how I could add a custom section or template so when an admin inside wp-admin goes to any given event, and edits this single post/event, they can see the metadata associated.
I want to just add a new field section somewhere, called "Registrations", and then I'd programmatically access the meta and format it how I want, put some HTML/CSS in there, etc.
If anyone could point me in the right direction I would appreciate it.
Thanks!

Related

Permalink Goes to Old Page

I have been working on a site created by another developer. I have been fixing the site to make it more visually appealing. I am also responsible for adding new events and pictures which i self taught myself to do.
I have a situation where I have a page with the following permalink:
http://www.cic-nj.org/events/
The problem is that this link goes to a page that does not show the edits that i am making under that page and there is no other page listed that shows the info it actually displays.
this is what I have in the editor box on wordpress that I want it to show.
enter image description here
this is what appears when url is used or when i click view
enter image description here
I have been sure to click update and renewing page to view it. it's like its going to a ghost page i can not edit.
Can anyone point me in the right direction on this?
Thanks in advance...
You are experiencing "slug collision": more than one thing in your WP install has the same slug.
The problem that you have is events is a custom post type, with a slug set to events - therefore the url http://www.cic-nj.org/events/ is directing to the listing of events. This is an automatic feature of WordPress. (Note - you can see more details to support this conclusion by the fact that you've got individual events accessible at url's such as http://www.cic-nj.org/events/blue-apron-info-session/ )
Note that custom post type slugs will always take priority over a page / post slug.
You have a couple of options:
If you want a page to display the content that you've created, the page's slug / permalink must be different than events
If it's acceptable, you can rename the slug of the "events" custom post type to something different. This has the potential consequence of losing SEO "juice".
If it's acceptable, you can remove the custom post type, if you aren't going to use them any longer.
NOTE: It may be tempting to ask "how do I remove the custom post type", or "how do I change the post type slug". Those are different questions, and if you need to ask, they should be asked in a different question - not added as a comment below.

Wordpress custom post type structure

i am building a wordpress website for a client. i need to build 1 template type of page with a list of fields that the client can fill in to populate the page. so lets say i build a template page called Person Template. On it i have an empty picture placeholder on the left and an empty Name Field below that. On the right i have an empty "persons phone number" and "Persons email" field.
what i need to create somehow is a system that the client can enter these 4 items into wp-admin somewhere and save that as a new Person. Then they can repeat and save another Person until they have created say 100 Person pages.
How do I do this? I tried building a Custom Post Type called Person CPT. I have built a Page called Person Template. I have built some "Person CPT" posts and put them on a page but i dont know how to create the Entry Fields page for my client to use.
You're correct that you'll need to use a custom post type. To add the fields you have two options:
Add the fields using add_meta_box(). You'll then need to save this data as post meta. Then in your single-person.php template you would retrieve the meta using get_post_meta(). It's a tad cumbersome, as you need to write the markup for the meta box, hook it into an action to add it to the admin page, and verify the content before it's saved. Here's an article that walks you through it
Alternatively get yourself the Advanced Custom Fields plugin: it makes adding additional fields very quick and easy. I use it all the time.

Wordpress template page for custom posts

I have a custom post type (that I'm using on a template page), the custom post type is called 'Headerhome'.
When I post say a gallery there I'm trying to get it to redirect to 'single-Headerhome.php', yet it always just goes to 'single.php'.
The name of the custom post type itself is arbitrary, the name of the templage page it's on is 'home'.
I'm really confused, I'm not the best at WP yet so when something simple like this doesn't work I have no idea how to fix it, even after pouring over the codex for an hour.
The name of the custom post type itself is arbitrary, the name of the templage page it's on is 'home'.
Reading this implies that you have a home.php file in your theme, which would automatically display as your front page of your site. This may not be what you desire? More on this here: http://codex.wordpress.org/Creating_a_Static_Front_Page
An example of a custom post type might be an Event. The Event might have custom fields associated with it, like Location, Date, Time, Description. We would probably want new Events to show up on our front page, but also would want to create a custom theme file so when a user clicks on an Event from the home page to view the Event then the Event page shows our Date, Time, Location, Description, etc. We would then create a single-event.php to do this and put in any custom code their.
So (another example), a custom post type of Fruit would have an associated theme file of single-fruit.php. If their is no single-fruit.php then Wordpress will use single.php as the default theme file to display. More on this here: http://codex.wordpress.org/Post_Types#Template_Files
Hope this helps set you in the right direction.

magic fields 2 // way to emulate write panel?

So Magic Fields 2 doesn't have "write panels." and since MF2 is so sleek - I am thinking there is some other thing that takes it's place that I can't find.
problem is this: creating a simple page with some fields in it.
in MF1//
create some m-Fields
create a page
fill out the fields on the page
select the fields that i want as a write panel.
echo them out on the page
STRUCTURE: page>fields
in MF2//
create a page template
create a page
assign the template to the page
create a custom post type
create the fields for that post type
create a post
fill in all the fields
run a loop in the page for the post type (for 1 post)
echo out the m-Fields data
STRUCTURE: page>post>fields
so a client would have to select the post type "about" then go in there and get(the only post in there) "about" then adjust the fields... meanwhile the page "about" is never touched... seems really strange...
or --- you could put ALL of the magic-fields on "page" - which in my case would mean that there would be 100 plus fields on every page and 90 of them wouldn't have to do with that page and then couldn't be required --- which is all way too confusing for clients.
I feel like I'm just not checking a special box somewhere.
The answer is just NO.
I have since started using Advance Custom Fields plugin and you just set up your custom field sets and tell them what page or post type to appear on. I have more confidence that ACF will stay up to date then the other plug in options. Just wanted to throw that out there.

Add destination to drupal view field link

How can I add a desintation to a custom edit link in a view field?
I have a field in my view where I've customized the field to render as a link. How do I add the current view's page to the link as a destination, so that when the person follows the link and fills in the form, they will be redirected back the same view page they were on? Needs to include the page number variable as well.
G
You can override the theme for a particular field and use PHP to render the link however you like. Get the view arguments from $_GET['q'] if you'd like to manipulate them.
Alternatively,
drupal_get_destination(); will give you the current page as "destination=myView/with/args" to append to the link.

Resources