zenstrategist
asked 7 years ago

Hi, guys, I am using DW-Wall.

I cannot get any custom fields to display in my posts. I have tried creating them in the WP editor and through Gravity Forms. I can see the custom field listed in the editor as available, but they will not display in my post.

I am using a Gravity Form to create a drop-down field to add a “Country” to my post. I can see the custom field name in the editor, but the content list of countries is not available.

2 Answers
Jackie Lord
answered 7 years ago

Hi zenstrategist,

To add a new custom field into an article, please follow my instruction:

Step 1: Add custom field into an article that you want

For example:
Custom Field Name: country (this will be fixed and used for other articles)
Custom Field Value: United States
See screenshot: http://i.imgur.com/dcbBNGU.png

Step 2: Go to Dashboard > Appearance > Editor. Select WallPress to edit

Step 3: Select menu: content-single.php on the right side

Step 4:
Find the line:

 <?php the_content( '' ); ?>

Add right after (or before) it these following lines:

 <?php if ( get_post_meta( get_the_ID(), 'country', true ) ) : ?>
<?php echo get_post_meta( get_the_ID(), 'country', true ) ; ?>
<?php endif; ?>

Hope this helps!
Regards,
Jackie

zenstrategist
replied 7 years ago

Fantastic, Jackie, thanks!

zenstrategist
replied 7 years ago

Fantastic, Jackie! I use a child theme so I coped content-single.php into my child theme area. I’d figured out to use < ?php the_meta(); ?> but it was too general. Your code is perfect. By the way, what’s the CSS object I need to change to set a colour for it?

DominicStaff
answered 6 years ago

If you want to change color. Please add the following code to the “Header Code”

<style>
.single .item-content {
    color: #...
}

.single .item-content p {
    color: #...;
}
</style>

 

Powered by DW Question & Answer Pro