$75
Rewrite code efficiently and add a function.
The functionality I am missing is in the "Players" post type.
Players, has a meta box that the everything including the title field is hidden. (not included in array). This is because I want each player's first and last name separate. In fact, it only supports the custom meta box that I created for it. These are the fields: first name, last name, height, weight, number, position, and grade. I need the permalink and title (which is hidden) to reflect three custom field values. So it would look like this:
Title: $title = $number . " " . $first_name . " " . $last_name //03 John Smith
Slug: $slug = $number . "-" . $first_name . "-" . $last_name // http://mydomain.com/varsity/roster/03-John-Smith/
Lastly, I would like to have more control over my meta boxes. Right now they are in arrays and they are hard to format how I would like them. For example, for the players meta box I want the number, first_name, and last_name fields on the same line.
If anyone could help me out that would be wonderful!
Thanks!
Austin Condiff | 07/18/10 at 2:11am
| Edit
(3) Possible Answers Submitted...
-
Last edited:
07/18/10
8:50pmOleg Butuzov says:20 $ is a bit less for solution on this question. i se at least 3 hours of work here.
- 07/18/10 2:36am
Austin Condiff says:How much would you do this for? (Be fair please...)
- 07/18/10 2:38am
Oleg Butuzov says:but if you want to do it yourself... here is a plan.
use
add_rewrite_tag to add your custom values
Live example (WP Multilingual )
add_filter('query_vars', array('WPML', 'query_language'));
....
....
function query_language($variables){
global $wp_rewrite, $wpdb;
$variables[] = 'wpmllanguage';
$wp_rewrite->add_rewrite_tag('%wpmllanguage%', wpml::get_option(MULTILINGUAL_DOMAIN.'_concated'), 'wpmllanguage=');
return $variables;
}
- 07/18/10 2:39am
Oleg Butuzov says:my hour rate is 25 - you can check any of links in my profile for a feedbacks or details.
ok. i am continue givine a peaces of code that can help anyone who will come with a same stuff here on this website. - 07/18/10 2:43am
Austin Condiff says:You've got a deal. I will raise the prize price to $75. Should I post the code here? This is my first post. =)
- 07/18/10 2:45am
Oleg Butuzov says:i think will be better if you can pass me a access to the website so i can copy db and work in standalone mode or just simple pass me the db with your custom values. so i can continue.
- 07/18/10 2:45am
Oleg Butuzov says:butuzov@made.com.ua
- 07/18/10 2:48am
Austin Condiff says:My database is pretty much empty except for test values. And I am testing it locally. Do you have a fresh wordpress install handy? or you can add the functions.php file to a new theme.
- 07/18/10 2:54am
Oleg Butuzov says:all i need is just db + code you creating custom post type (slug of post type itself important)
i has wp installs. so you can provide a code for custom post type + db.
the result can be provided as code for functions.php or plugin. - 07/18/10 2:59am
Austin Condiff says:did you get that email and is that all you needed? a fuctions.php file would be great as a result.
- 07/18/10 3:02am
Oleg Butuzov says:2Gustavo
solution for this is hooks, filter, rewrite tags ... etc.
2Austin
got the code.
- 07/18/10 3:05am
Austin Condiff says:do you need anything else from me? It's 2am here and I need to get up at a decent time tomorrow. Just send me the finished code when your done.
austin[dot]condiff[at]gmail[dot]com
Thanks! - 07/18/10 4:20am
Oleg Butuzov says:ok.
- 07/18/10 6:48am
Oleg Butuzov says:Guys... stop commenting...
Issue resolved. Austin just sleeping now. its night in USA.
- 07/18/10 2:36am
-

Last edited:
07/18/10
2:57amGustavo Bordoni says:gustavo@webord.net
I might have another solution.
But as Oleg Butuzov said its on Filters.Previous versions of this answer: 07/18/10 at 2:57am
- 07/18/10 2:57am
Austin Condiff says:What is your solution and what do you mean by filters?
- 07/18/10 3:04am
Gustavo Bordoni says:I'm thinking on something that goes before the set up of the permalink, using filters to create this set up.
Using the hook
.add_filter('the_permalink ', 'my_function');
My question is, do you have a specific category where this should happen or just when it's this custom_post_type?? - 07/18/10 3:07am
Austin Condiff says:all categories in the taxonomy "teams"
- 07/18/10 3:08am
Austin Condiff says:actually, just in the players post type. your referring to the slug rewrite, correct?
- 07/18/10 3:18am
Gustavo Bordoni says:Ok, I was looking for this info to make something on the code to specify witch Posts I have to change the slug.
- 07/18/10 3:24am
Austin Condiff says:i tried to do this on my own, but I couldn't find anything online (after my two day search). I am college aged, What is the best way to learn this (if you don't mind me asking), because schools don't really teach wordpress.
- 07/18/10 3:30am
Gustavo Bordoni says:This level of wordpress You won't find any where... not on books... not even on the Codex this kind of info is well explained...
Yes... this is a problem on WordPress Codex... the lack of information on Hooks and Filters...
But keep an eye on the Trac is a good way, and another way to get on some real good info is to look up for on the files, that are very well commented.
Almost all files on WordPress have a good info for a developer. - 07/18/10 3:34am
Austin Condiff says:Their codex is very lacking. I tried asking several questions on their forums and for all three posts, I didn't get a single response. Here it was almost instantanious. Well money does help, but these forums are a really good idea. Thanks for the tip though. I will follow the trac and take a look at the wordpress files.
- 07/18/10 3:38am
Gustavo Bordoni says:To starters the info is kind of very good but when you start to dig this system...
- 07/18/10 2:57am
-

Last edited:
07/18/10
6:24amJared Williams says:I know about custom post types and taxonomies very well. Contact me directly for help with this.
jaredwilli@gmail.comPrevious versions of this answer: 07/18/10 at 6:24am
- 07/18/10 6:26am
Jared Williams says:There isn't documentation on this type of thing anywhere, that's why I've studied the WP source to learn it.
- 07/18/10 6:29am
Jared Williams says:Perhaps some of this code can help you in some way at all.
It's hard to help not know what you're code looks like or how it's set up. This is a couple ways to create some meta boxes.
// Tell WP that you want these custom areas creating
function admin_init(){
add_meta_box("price-meta", "Price", "product_price", "product", "side", "low"); // the price field
add_meta_box("price_additions", "Price additions", "price_additions", "product", "side", "low"); // the additions to the price
add_meta_box("additional_info", "Additional Information", "additional_info", "product", "advanced", "low"); // the additions to the price
}
// How to create one sigle input area
function product_price(){
global $post;
$custom = get_post_custom($post->ID);
$product_price = $custom["product_price"][0];
// break out & write the html for this
?>
<label>Price (£): </label>
<input name="product_price" value="<?php echo $product_price; ?>" />
<?php
}
// How to create multiple inputs in a grouped area
function price_additions() {
global $post;
$custom = get_post_custom($post->ID);
$tax = $custom["tax"][0];
$pandp = $custom["pandp"][0];
$barcode = $custom["barcode"][0];
// break out & write the html for this
?>
<label>Tax (%): </label>
<input name="tax" value="<?php echo $tax; ?>" /><br />
<label>P&P (£): </label>
<input name="pandp" value="<?php echo $pandp; ?>" /><br />
<label>Barcode: </label>
<input name="barcode" value="<?php echo $barcode; ?>" />
<?php
}
- 07/18/10 6:41am
Jared Williams says:I would assume that you are using this code in your register_post_type() array, but incase not, there is a bug with permalinks in post types.
This is one way to fix it:
rewrite' => array('slug' => 'posttypeslug'),
many people just use rewrite' => true, which causes permalinks to not work. - 07/18/10 7:31am
Jared Williams says:You might want to also try the get_post_permalink() function too. This is new in 3.0.
- 07/18/10 6:26am
This question has expired.
Current status of this question: Completed





