custom fields
-
Hi, i have just order custom field plugin, but it looks too complicated…
I M FOLLOWING THIS INSTRUCTIONS https://wpadverts.com/documentation/custom-fields/So far i registered custom field with this code and while editing it looks it s working.
add_filter( "adverts_form_load", "my_adverts_form_load" ); function my_adverts_form_load( $form ) { if( $form["name"] != "advert" ) { return $form; } $form["field"][] = array( "name" => "Brand", "type" => "adverts_field_checkbox", "order" => 25, "label" => "Brand", "is_required" => false, "validator" => array( ), "max_choices" => 2, "options" => array( array("value"=>"1", "text"=>"Mercedes"), array("value"=>"2", "text"=>"Audi"), ) );}
NOW, i ve add this code to functions.php
add_filter(“manage_edit-advert_columns”, “my_adverts_edit_columns”, 20);
function my_adverts_edit_columns( $columns ) {
$columns[“brand”] = “Brand”;
return $columns;
}add_action(“manage_advert_posts_custom_column”, “my_adverts_manage_post_columns”, 10, 2);
function my_adverts_manage_post_columns( $column, $post_id ) {
if($column == “brand”) {
$cf = get_post_meta( $post_id, ‘brand’, true );
if(empty($cf)) {
echo “Empty“;
} else {
echo ““.$cf.”“;
}
}
}I CAN SEE THE COLUMN BUT IT SAYS EMPTY instead of showing the value.
What do i do wrong?
Displaying on Ad Details Page is not working either.thanks for help
- The topic ‘custom fields’ is closed to new replies.