admin管理员组文章数量:1025301
I need the child theme to use a 'modified' version of its parent custom post type and correspondent page template. Basically I would like to add 5 new metaboxes, change 2 existing labels, and include the new fields in the page template (code below).
***'Problem': The 'content module' of the page template, the page template itself, and Metaboxes of the custom post type are being defined/registered by the native plugin that the theme developer has also authored. As a very inexperienced aspiring 'developer', i was thinking to save the modified files in the child's directory, same ideas as, for example, header.php, and pray for it to overwrite...
Could you please advise???
/**
* Path: wp-content > plugins > theme plugin > includes > post types > class-realia-post-type-property.php
*/
$metaboxes[REALIA_PROPERTY_PREFIX . 'attributes'] = array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes',
'title' => __( 'Attributes', 'realia' ),
'object_types' => array( 'property' ),
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
'fields' => array(
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_beds',
'name' => __( 'Beds', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_baths',
'name' => __( 'Baths', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_garages',
'name' => __( 'Garages', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_area',
'name' => __( 'Area', 'realia' ),
'type' => 'text',
'description' => __( 'In unit set in settings.', 'realia' ),
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE',
'name' => __( 'NEWONE', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE2',
'name' => __( 'NEWONE2', 'realia' ),
'type' => 'text',
),
)
);
And then, I would go to the page template and:
<div class="entry-content">
<div class="property-overview">
<dl>
<?php $price = Realia_Price::get_property_price(); ?>
<?php if ( ! empty( $price ) ) : ?>
<dt><?php echo __( 'Price', 'realia' )?></dt><dd><?php echo wp_kses( $price, wp_kses_allowed_html( 'post' ) ); ?></dd>
<?php endif; ?>
<?php $id = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'id', true ); ?>
<?php if ( ! empty( $id ) ) : ?>
<dt><?php echo __( 'ID', 'realia' ); ?></dt><dd><?php echo esc_attr( $id ); ?></dd>
<?php endif; ?>
<?php $area = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_area', true ); ?>
<?php if ( ! empty( $area ) ) : ?>
<dt><?php echo __( 'Area', 'realia' ); ?></dt><dd><?php echo esc_attr( $area ); ?> <?php echo get_theme_mod( 'realia_measurement_area_unit', 'sqft' ); ?></dd>
<?php endif; ?>
<?php $baths = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_baths', true ); ?>
<?php if ( ! empty( $baths ) ) : ?>
<dt><?php echo __( 'Baths', 'realia' ); ?></dt><dd><?php echo esc_attr( $baths ); ?></dd>
<?php endif; ?>
<?php $beds = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_beds', true ); ?>
<?php if ( ! empty( $beds ) ) : ?>
<dt><?php echo __( 'Beds', 'realia' ); ?></dt><dd><?php echo esc_attr( $beds ); ?></dd>
<?php endif; ?>
?php $NEWONE = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_NEWONE', true ); ?>
<?php if ( ! empty( $NEWONE ) ) : ?>
<dt><?php echo __( 'NEWONE', 'realia' ); ?></dt><dd><?php echo esc_attr( $NEWONE ); ?></dd>
<?php endif; ?>
?php $NEWONE2 = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_NEWONE2', true ); ?>
<?php if ( ! empty( $NEWONE2 ) ) : ?>
<dt><?php echo __( 'NEWONE2', 'realia' ); ?></dt><dd><?php echo esc_attr( $NEWONE2 ); ?></dd>
<?php endif; ?>
<?php $garages = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_garages', true ); ?>
<?php if ( ! empty( $garages ) ) : ?>
<dt><?php echo __( 'Garages', 'realia' ); ?></dt><dd><?php echo esc_attr( $garages ); ?></dd>
<?php endif; ?>
</dl>
</div><!-- /.property-overview -->
I need the child theme to use a 'modified' version of its parent custom post type and correspondent page template. Basically I would like to add 5 new metaboxes, change 2 existing labels, and include the new fields in the page template (code below).
***'Problem': The 'content module' of the page template, the page template itself, and Metaboxes of the custom post type are being defined/registered by the native plugin that the theme developer has also authored. As a very inexperienced aspiring 'developer', i was thinking to save the modified files in the child's directory, same ideas as, for example, header.php, and pray for it to overwrite...
Could you please advise???
/**
* Path: wp-content > plugins > theme plugin > includes > post types > class-realia-post-type-property.php
*/
$metaboxes[REALIA_PROPERTY_PREFIX . 'attributes'] = array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes',
'title' => __( 'Attributes', 'realia' ),
'object_types' => array( 'property' ),
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
'fields' => array(
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_beds',
'name' => __( 'Beds', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_baths',
'name' => __( 'Baths', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_garages',
'name' => __( 'Garages', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_area',
'name' => __( 'Area', 'realia' ),
'type' => 'text',
'description' => __( 'In unit set in settings.', 'realia' ),
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE',
'name' => __( 'NEWONE', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE2',
'name' => __( 'NEWONE2', 'realia' ),
'type' => 'text',
),
)
);
And then, I would go to the page template and:
<div class="entry-content">
<div class="property-overview">
<dl>
<?php $price = Realia_Price::get_property_price(); ?>
<?php if ( ! empty( $price ) ) : ?>
<dt><?php echo __( 'Price', 'realia' )?></dt><dd><?php echo wp_kses( $price, wp_kses_allowed_html( 'post' ) ); ?></dd>
<?php endif; ?>
<?php $id = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'id', true ); ?>
<?php if ( ! empty( $id ) ) : ?>
<dt><?php echo __( 'ID', 'realia' ); ?></dt><dd><?php echo esc_attr( $id ); ?></dd>
<?php endif; ?>
<?php $area = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_area', true ); ?>
<?php if ( ! empty( $area ) ) : ?>
<dt><?php echo __( 'Area', 'realia' ); ?></dt><dd><?php echo esc_attr( $area ); ?> <?php echo get_theme_mod( 'realia_measurement_area_unit', 'sqft' ); ?></dd>
<?php endif; ?>
<?php $baths = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_baths', true ); ?>
<?php if ( ! empty( $baths ) ) : ?>
<dt><?php echo __( 'Baths', 'realia' ); ?></dt><dd><?php echo esc_attr( $baths ); ?></dd>
<?php endif; ?>
<?php $beds = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_beds', true ); ?>
<?php if ( ! empty( $beds ) ) : ?>
<dt><?php echo __( 'Beds', 'realia' ); ?></dt><dd><?php echo esc_attr( $beds ); ?></dd>
<?php endif; ?>
?php $NEWONE = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_NEWONE', true ); ?>
<?php if ( ! empty( $NEWONE ) ) : ?>
<dt><?php echo __( 'NEWONE', 'realia' ); ?></dt><dd><?php echo esc_attr( $NEWONE ); ?></dd>
<?php endif; ?>
?php $NEWONE2 = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_NEWONE2', true ); ?>
<?php if ( ! empty( $NEWONE2 ) ) : ?>
<dt><?php echo __( 'NEWONE2', 'realia' ); ?></dt><dd><?php echo esc_attr( $NEWONE2 ); ?></dd>
<?php endif; ?>
<?php $garages = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_garages', true ); ?>
<?php if ( ! empty( $garages ) ) : ?>
<dt><?php echo __( 'Garages', 'realia' ); ?></dt><dd><?php echo esc_attr( $garages ); ?></dd>
<?php endif; ?>
</dl>
</div><!-- /.property-overview -->
Share
Improve this question
edited May 20, 2018 at 1:44
Johansson
15.4k11 gold badges43 silver badges79 bronze badges
asked Jun 21, 2015 at 1:25
VA-YVRVA-YVR
411 silver badge3 bronze badges
1 Answer
Reset to default 1It seems to me like this is just a regular addition to functions. Since you are asking, I think you may not be getting the result you are looking for. If this was my project, I would create a new plugin, install it into the regular plugin list so that it does not get overwritten anywhere and then add the new properties.
Create a file called realia-compatiblity.php
or something like that.
Add something like this to the start of the file:
<?php
/*
Plugin Name: Realia Child Theme Compatibility Plugin
Description: This is so my custom stuff doesn't get overwritten when the themes and plugins upgrade. Do not remove.
Version: 1.0
Author: YOUR NAME HERE
Author URI: YOUR SITE HERE
License: LIST LICENSING INFO HERE
*/
// Add your new code here
$metaboxes[REALIA_PROPERTY_PREFIX . 'attributes'] = array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes',
'title' => __( 'Attributes', 'realia' ),
'object_types' => array( 'property' ),
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
'fields' => array(
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_beds',
'name' => __( 'Beds', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_baths',
'name' => __( 'Baths', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_garages',
'name' => __( 'Garages', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_area',
'name' => __( 'Area', 'realia' ),
'type' => 'text',
'description' => __( 'In unit set in settings.', 'realia' ),
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE',
'name' => __( 'NEWONE', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE2',
'name' => __( 'NEWONE2', 'realia' ),
'type' => 'text',
),
)
);
?>
And then your child theme information should be usable with your new child theme plugin.
Although, there seems to be some commands missing. I don't see any Hooks here to hook into an action, or any kind of registration for any custom post types. These would look something like this:
function custom_post_type() {
// Some kind of labels
// Some kind of arguments
// a call to register_post_type();
};
// Hook into the 'init' action
add_action('init', 'custom_post_type', 0);
I am fairly new to all this as well and I could be missing something, however, it seems you may need to add a bit more than that what you have shared with us.
If what you were doing before wasn't working, perhaps this will. The code in the page template would likely remain the same.
I found this page to have a lot of useful information about custom post types in general http://www.smashingmagazine/2012/11/08/complete-guide-custom-post-types/
I hope this answer at least helps a bit! Good luck.
EDIT: I ran across this question initially thinking it was a custom post kind of question. I then went off to do research about a question I had about my own theme adjustments when I realised the stuff I was looking for was echoed here in this question. I reread your question and I saw you are looking for solutions to both the custom post and the custom metaboxes. Since the information is supposed to be added to the functions.php file as well, it is possible my plugin method would also work (untested!) for this metabox question. I found some information here that could illuminate things for you: http://www.creativebloq/wordpress/user-friendly-custom-fields-meta-boxes-wordpress-5113004
I hope that now there is enough here to help find the solutions!
I need the child theme to use a 'modified' version of its parent custom post type and correspondent page template. Basically I would like to add 5 new metaboxes, change 2 existing labels, and include the new fields in the page template (code below).
***'Problem': The 'content module' of the page template, the page template itself, and Metaboxes of the custom post type are being defined/registered by the native plugin that the theme developer has also authored. As a very inexperienced aspiring 'developer', i was thinking to save the modified files in the child's directory, same ideas as, for example, header.php, and pray for it to overwrite...
Could you please advise???
/**
* Path: wp-content > plugins > theme plugin > includes > post types > class-realia-post-type-property.php
*/
$metaboxes[REALIA_PROPERTY_PREFIX . 'attributes'] = array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes',
'title' => __( 'Attributes', 'realia' ),
'object_types' => array( 'property' ),
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
'fields' => array(
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_beds',
'name' => __( 'Beds', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_baths',
'name' => __( 'Baths', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_garages',
'name' => __( 'Garages', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_area',
'name' => __( 'Area', 'realia' ),
'type' => 'text',
'description' => __( 'In unit set in settings.', 'realia' ),
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE',
'name' => __( 'NEWONE', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE2',
'name' => __( 'NEWONE2', 'realia' ),
'type' => 'text',
),
)
);
And then, I would go to the page template and:
<div class="entry-content">
<div class="property-overview">
<dl>
<?php $price = Realia_Price::get_property_price(); ?>
<?php if ( ! empty( $price ) ) : ?>
<dt><?php echo __( 'Price', 'realia' )?></dt><dd><?php echo wp_kses( $price, wp_kses_allowed_html( 'post' ) ); ?></dd>
<?php endif; ?>
<?php $id = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'id', true ); ?>
<?php if ( ! empty( $id ) ) : ?>
<dt><?php echo __( 'ID', 'realia' ); ?></dt><dd><?php echo esc_attr( $id ); ?></dd>
<?php endif; ?>
<?php $area = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_area', true ); ?>
<?php if ( ! empty( $area ) ) : ?>
<dt><?php echo __( 'Area', 'realia' ); ?></dt><dd><?php echo esc_attr( $area ); ?> <?php echo get_theme_mod( 'realia_measurement_area_unit', 'sqft' ); ?></dd>
<?php endif; ?>
<?php $baths = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_baths', true ); ?>
<?php if ( ! empty( $baths ) ) : ?>
<dt><?php echo __( 'Baths', 'realia' ); ?></dt><dd><?php echo esc_attr( $baths ); ?></dd>
<?php endif; ?>
<?php $beds = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_beds', true ); ?>
<?php if ( ! empty( $beds ) ) : ?>
<dt><?php echo __( 'Beds', 'realia' ); ?></dt><dd><?php echo esc_attr( $beds ); ?></dd>
<?php endif; ?>
?php $NEWONE = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_NEWONE', true ); ?>
<?php if ( ! empty( $NEWONE ) ) : ?>
<dt><?php echo __( 'NEWONE', 'realia' ); ?></dt><dd><?php echo esc_attr( $NEWONE ); ?></dd>
<?php endif; ?>
?php $NEWONE2 = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_NEWONE2', true ); ?>
<?php if ( ! empty( $NEWONE2 ) ) : ?>
<dt><?php echo __( 'NEWONE2', 'realia' ); ?></dt><dd><?php echo esc_attr( $NEWONE2 ); ?></dd>
<?php endif; ?>
<?php $garages = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_garages', true ); ?>
<?php if ( ! empty( $garages ) ) : ?>
<dt><?php echo __( 'Garages', 'realia' ); ?></dt><dd><?php echo esc_attr( $garages ); ?></dd>
<?php endif; ?>
</dl>
</div><!-- /.property-overview -->
I need the child theme to use a 'modified' version of its parent custom post type and correspondent page template. Basically I would like to add 5 new metaboxes, change 2 existing labels, and include the new fields in the page template (code below).
***'Problem': The 'content module' of the page template, the page template itself, and Metaboxes of the custom post type are being defined/registered by the native plugin that the theme developer has also authored. As a very inexperienced aspiring 'developer', i was thinking to save the modified files in the child's directory, same ideas as, for example, header.php, and pray for it to overwrite...
Could you please advise???
/**
* Path: wp-content > plugins > theme plugin > includes > post types > class-realia-post-type-property.php
*/
$metaboxes[REALIA_PROPERTY_PREFIX . 'attributes'] = array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes',
'title' => __( 'Attributes', 'realia' ),
'object_types' => array( 'property' ),
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
'fields' => array(
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_beds',
'name' => __( 'Beds', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_baths',
'name' => __( 'Baths', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_garages',
'name' => __( 'Garages', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_area',
'name' => __( 'Area', 'realia' ),
'type' => 'text',
'description' => __( 'In unit set in settings.', 'realia' ),
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE',
'name' => __( 'NEWONE', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE2',
'name' => __( 'NEWONE2', 'realia' ),
'type' => 'text',
),
)
);
And then, I would go to the page template and:
<div class="entry-content">
<div class="property-overview">
<dl>
<?php $price = Realia_Price::get_property_price(); ?>
<?php if ( ! empty( $price ) ) : ?>
<dt><?php echo __( 'Price', 'realia' )?></dt><dd><?php echo wp_kses( $price, wp_kses_allowed_html( 'post' ) ); ?></dd>
<?php endif; ?>
<?php $id = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'id', true ); ?>
<?php if ( ! empty( $id ) ) : ?>
<dt><?php echo __( 'ID', 'realia' ); ?></dt><dd><?php echo esc_attr( $id ); ?></dd>
<?php endif; ?>
<?php $area = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_area', true ); ?>
<?php if ( ! empty( $area ) ) : ?>
<dt><?php echo __( 'Area', 'realia' ); ?></dt><dd><?php echo esc_attr( $area ); ?> <?php echo get_theme_mod( 'realia_measurement_area_unit', 'sqft' ); ?></dd>
<?php endif; ?>
<?php $baths = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_baths', true ); ?>
<?php if ( ! empty( $baths ) ) : ?>
<dt><?php echo __( 'Baths', 'realia' ); ?></dt><dd><?php echo esc_attr( $baths ); ?></dd>
<?php endif; ?>
<?php $beds = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_beds', true ); ?>
<?php if ( ! empty( $beds ) ) : ?>
<dt><?php echo __( 'Beds', 'realia' ); ?></dt><dd><?php echo esc_attr( $beds ); ?></dd>
<?php endif; ?>
?php $NEWONE = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_NEWONE', true ); ?>
<?php if ( ! empty( $NEWONE ) ) : ?>
<dt><?php echo __( 'NEWONE', 'realia' ); ?></dt><dd><?php echo esc_attr( $NEWONE ); ?></dd>
<?php endif; ?>
?php $NEWONE2 = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_NEWONE2', true ); ?>
<?php if ( ! empty( $NEWONE2 ) ) : ?>
<dt><?php echo __( 'NEWONE2', 'realia' ); ?></dt><dd><?php echo esc_attr( $NEWONE2 ); ?></dd>
<?php endif; ?>
<?php $garages = get_post_meta( get_the_ID(), REALIA_PROPERTY_PREFIX . 'attributes_garages', true ); ?>
<?php if ( ! empty( $garages ) ) : ?>
<dt><?php echo __( 'Garages', 'realia' ); ?></dt><dd><?php echo esc_attr( $garages ); ?></dd>
<?php endif; ?>
</dl>
</div><!-- /.property-overview -->
Share
Improve this question
edited May 20, 2018 at 1:44
Johansson
15.4k11 gold badges43 silver badges79 bronze badges
asked Jun 21, 2015 at 1:25
VA-YVRVA-YVR
411 silver badge3 bronze badges
1 Answer
Reset to default 1It seems to me like this is just a regular addition to functions. Since you are asking, I think you may not be getting the result you are looking for. If this was my project, I would create a new plugin, install it into the regular plugin list so that it does not get overwritten anywhere and then add the new properties.
Create a file called realia-compatiblity.php
or something like that.
Add something like this to the start of the file:
<?php
/*
Plugin Name: Realia Child Theme Compatibility Plugin
Description: This is so my custom stuff doesn't get overwritten when the themes and plugins upgrade. Do not remove.
Version: 1.0
Author: YOUR NAME HERE
Author URI: YOUR SITE HERE
License: LIST LICENSING INFO HERE
*/
// Add your new code here
$metaboxes[REALIA_PROPERTY_PREFIX . 'attributes'] = array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes',
'title' => __( 'Attributes', 'realia' ),
'object_types' => array( 'property' ),
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
'fields' => array(
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_beds',
'name' => __( 'Beds', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_baths',
'name' => __( 'Baths', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_garages',
'name' => __( 'Garages', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_area',
'name' => __( 'Area', 'realia' ),
'type' => 'text',
'description' => __( 'In unit set in settings.', 'realia' ),
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE',
'name' => __( 'NEWONE', 'realia' ),
'type' => 'text',
),
array(
'id' => REALIA_PROPERTY_PREFIX . 'attributes_NEWONE2',
'name' => __( 'NEWONE2', 'realia' ),
'type' => 'text',
),
)
);
?>
And then your child theme information should be usable with your new child theme plugin.
Although, there seems to be some commands missing. I don't see any Hooks here to hook into an action, or any kind of registration for any custom post types. These would look something like this:
function custom_post_type() {
// Some kind of labels
// Some kind of arguments
// a call to register_post_type();
};
// Hook into the 'init' action
add_action('init', 'custom_post_type', 0);
I am fairly new to all this as well and I could be missing something, however, it seems you may need to add a bit more than that what you have shared with us.
If what you were doing before wasn't working, perhaps this will. The code in the page template would likely remain the same.
I found this page to have a lot of useful information about custom post types in general http://www.smashingmagazine/2012/11/08/complete-guide-custom-post-types/
I hope this answer at least helps a bit! Good luck.
EDIT: I ran across this question initially thinking it was a custom post kind of question. I then went off to do research about a question I had about my own theme adjustments when I realised the stuff I was looking for was echoed here in this question. I reread your question and I saw you are looking for solutions to both the custom post and the custom metaboxes. Since the information is supposed to be added to the functions.php file as well, it is possible my plugin method would also work (untested!) for this metabox question. I found some information here that could illuminate things for you: http://www.creativebloq/wordpress/user-friendly-custom-fields-meta-boxes-wordpress-5113004
I hope that now there is enough here to help find the solutions!
本文标签:
版权声明:本文标题:How can I modify a custom post type and custom page template for a child theme if all content seams to be handled by theme&# 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745616086a2159300.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论